diff --git a/docs/build/bundle.js b/docs/build/bundle.js index 2490c0a..d5196df 100644 --- a/docs/build/bundle.js +++ b/docs/build/bundle.js @@ -1,2 +1,2 @@ /*! For license information please see bundle.js.LICENSE.txt */ -(()=>{var t={78845:(t,e,n)=>{"use strict";n.r(e),n.d(e,{AccountClient:()=>ro,AnchorError:()=>Er,AnchorProvider:()=>mr,BN:()=>s(),BorshAccountsCoder:()=>Vr,BorshCoder:()=>Jr,BorshEventCoder:()=>Gr,BorshInstructionCoder:()=>jr,DISCRIMINATOR_SIZE:()=>Kr,EventManager:()=>so,EventParser:()=>ao,IdlError:()=>Ir,LangErrorCode:()=>Br,LangErrorMessage:()=>Lr,MethodsBuilderFactory:()=>vo,Native:()=>Po,Program:()=>xo,ProgramError:()=>Tr,ProgramErrorStack:()=>xr,SystemCoder:()=>Di,eventDiscriminator:()=>Zr,getProvider:()=>_r,parseIdlErrors:()=>Dn,setProvider:()=>wr,splitArgsAndCtx:()=>Ji,toInstruction:()=>Cn,translateAddress:()=>zn,translateError:()=>Pr,utils:()=>Gi,validateAccounts:()=>Nn,web3:()=>i});var r=n(48764),i=n(33957),o=n(13550),s=n.n(o),a=n(77191),u=n.n(a),c=n(23204),d=n.n(c),l=n(61275),h=n(17748);function f(t){let e=t.length;for(;--e>=0;)t[e]=0}const p=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),m=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),g=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),y=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),b=new Array(576);f(b);const w=new Array(60);f(w);const _=new Array(512);f(_);const v=new Array(256);f(v);const k=new Array(29);f(k);const M=new Array(30);function A(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}let S,I,x;function E(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}f(M);const T=t=>t<256?_[t]:_[256+(t>>>7)],P=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},B=(t,e,n)=>{t.bi_valid>16-n?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<{B(t,n[2*e],n[2*e+1])},$=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},R=(t,e,n)=>{const r=new Array(16);let i,o,s=0;for(i=1;i<=15;i++)s=s+n[i-1]<<1,r[i]=s;for(o=0;o<=e;o++){let e=t[2*o+1];0!==e&&(t[2*o]=$(r[e]++,e))}},O=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},D=t=>{t.bi_valid>8?P(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},C=(t,e,n,r)=>{const i=2*e,o=2*n;return t[i]{const r=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i{let r,i,o,s,a=0;if(0!==t.sym_next)do{r=255&t.pending_buf[t.sym_buf+a++],r+=(255&t.pending_buf[t.sym_buf+a++])<<8,i=t.pending_buf[t.sym_buf+a++],0===r?L(t,i,e):(o=v[i],L(t,o+256+1,e),s=p[o],0!==s&&(i-=k[o],B(t,i,s)),r--,o=T(r),L(t,o,n),s=m[o],0!==s&&(r-=M[o],B(t,r,s)))}while(a{const n=e.dyn_tree,r=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.elems;let s,a,u,c=-1;for(t.heap_len=0,t.heap_max=573,s=0;s>1;s>=1;s--)N(t,n,s);u=o;do{s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],N(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=a,n[2*u]=n[2*s]+n[2*a],t.depth[u]=(t.depth[s]>=t.depth[a]?t.depth[s]:t.depth[a])+1,n[2*s+1]=n[2*a+1]=u,t.heap[1]=u++,N(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,u=e.stat_desc.max_length;let c,d,l,h,f,p,m=0;for(h=0;h<=15;h++)t.bl_count[h]=0;for(n[2*t.heap[t.heap_max]+1]=0,c=t.heap_max+1;c<573;c++)d=t.heap[c],h=n[2*n[2*d+1]+1]+1,h>u&&(h=u,m++),n[2*d+1]=h,d>r||(t.bl_count[h]++,f=0,d>=a&&(f=s[d-a]),p=n[2*d],t.opt_len+=p*(h+f),o&&(t.static_len+=p*(i[2*d+1]+f)));if(0!==m){do{for(h=u-1;0===t.bl_count[h];)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[u]--,m-=2}while(m>0);for(h=u;0!==h;h--)for(d=t.bl_count[h];0!==d;)l=t.heap[--c],l>r||(n[2*l+1]!==h&&(t.opt_len+=(h-n[2*l+1])*n[2*l],n[2*l+1]=h),d--)}})(t,e),R(n,c,t.bl_count)},j=(t,e,n)=>{let r,i,o=-1,s=e[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=s,s=e[2*(r+1)+1],++a{let r,i,o=-1,s=e[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),r=0;r<=n;r++)if(i=s,s=e[2*(r+1)+1],!(++a{B(t,0+(r?1:0),3),D(t),P(t,n),P(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var H={_tr_init:t=>{F||((()=>{let t,e,n,r,i;const o=new Array(16);for(n=0,r=0;r<28;r++)for(k[r]=n,t=0;t<1<>=7;r<30;r++)for(M[r]=i<<7,t=0;t<1<{let i,o,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),U(t,t.l_desc),U(t,t.d_desc),s=(t=>{let e;for(j(t,t.dyn_ltree,t.l_desc.max_code),j(t,t.dyn_dtree,t.d_desc.max_code),U(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*y[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?W(t,e,n,r):4===t.strategy||o===i?(B(t,2+(r?1:0),3),z(t,b,w)):(B(t,4+(r?1:0),3),((t,e,n,r)=>{let i;for(B(t,e-257,5),B(t,n-1,5),B(t,r-4,4),i=0;i(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(v[n]+256+1)]++,t.dyn_dtree[2*T(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{B(t,2,3),L(t,256,b),(t=>{16===t.bi_valid?(P(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}},K=(t,e,n,r)=>{let i=65535&t|0,o=t>>>16&65535|0,s=0;for(;0!==n;){s=n>2e3?2e3:n,n-=s;do{i=i+e[r++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0};const q=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var V=(t,e,n,r)=>{const i=q,o=r+n;t^=-1;for(let n=r;n>>8^i[255&(t^e[n])];return-1^t},G={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Z={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:X,_tr_stored_block:J,_tr_flush_block:Q,_tr_tally:tt,_tr_align:et}=H,{Z_NO_FLUSH:nt,Z_PARTIAL_FLUSH:rt,Z_FULL_FLUSH:it,Z_FINISH:ot,Z_BLOCK:st,Z_OK:at,Z_STREAM_END:ut,Z_STREAM_ERROR:ct,Z_DATA_ERROR:dt,Z_BUF_ERROR:lt,Z_DEFAULT_COMPRESSION:ht,Z_FILTERED:ft,Z_HUFFMAN_ONLY:pt,Z_RLE:mt,Z_FIXED:gt,Z_DEFAULT_STRATEGY:yt,Z_UNKNOWN:bt,Z_DEFLATED:wt}=Z,_t=258,vt=262,kt=42,Mt=113,At=666,St=(t,e)=>(t.msg=G[e],e),It=t=>2*t-(t>4?9:0),xt=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Et=t=>{let e,n,r,i=t.w_size;e=t.hash_size,r=e;do{n=t.head[--r],t.head[r]=n>=i?n-i:0}while(--e);e=i,r=e;do{n=t.prev[--r],t.prev[r]=n>=i?n-i:0}while(--e)};let Tt=(t,e,n)=>(e<{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))},Bt=(t,e)=>{Q(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Pt(t.strm)},Lt=(t,e)=>{t.pending_buf[t.pending++]=e},$t=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Rt=(t,e,n,r)=>{let i=t.avail_in;return i>r&&(i=r),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),n),1===t.state.wrap?t.adler=K(t.adler,e,i,n):2===t.state.wrap&&(t.adler=V(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},Ot=(t,e)=>{let n,r,i=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match;const u=t.strstart>t.w_size-vt?t.strstart-(t.w_size-vt):0,c=t.window,d=t.w_mask,l=t.prev,h=t.strstart+_t;let f=c[o+s-1],p=c[o+s];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(n=e,c[n+s]===p&&c[n+s-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&os){if(t.match_start=e,s=r,r>=a)break;f=c[o+s-1],p=c[o+s]}}}while((e=l[e&d])>u&&0!=--i);return s<=t.lookahead?s:t.lookahead},Dt=t=>{const e=t.w_size;let n,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-vt)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Et(t),r+=e),0===t.strm.avail_in)break;if(n=Rt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=n,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Tt(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Tt(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let n,r,i,o=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,s=0,a=t.strm.avail_in;do{if(n=65535,i=t.bi_valid+42>>3,t.strm.avail_outr+t.strm.avail_in&&(n=r+t.strm.avail_in),n>i&&(n=i),n>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Pt(t.strm),r&&(r>n&&(r=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+r),t.strm.next_out),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r,t.block_start+=r,n-=r),n&&(Rt(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}while(0===s);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_wateri&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&(Rt(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,o=i>t.w_size?t.w_size:i,r=t.strstart-t.block_start,(r>=o||(r||e===ot)&&e!==nt&&0===t.strm.avail_in&&r<=i)&&(n=r>i?i:r,s=e===ot&&0===t.strm.avail_in&&n===r?1:0,J(t,t.block_start,n,s),t.block_start+=n,Pt(t.strm)),s?3:1)},Nt=(t,e)=>{let n,r;for(;;){if(t.lookahead=3&&(t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-vt&&(t.match_length=Ot(t,n)),t.match_length>=3)if(r=tt(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+1]);else r=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Bt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===ot?(Bt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bt(t,!1),0===t.strm.avail_out)?1:2},zt=(t,e)=>{let n,r,i;for(;;){if(t.lookahead=3&&(t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,r=tt(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(Bt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(r=tt(t,0,t.window[t.strstart-1]),r&&Bt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=tt(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===ot?(Bt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bt(t,!1),0===t.strm.avail_out)?1:2};function Ut(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}const jt=[new Ut(0,0,0,0,Ct),new Ut(4,4,8,4,Nt),new Ut(4,5,16,8,Nt),new Ut(4,6,32,32,Nt),new Ut(4,4,16,16,zt),new Ut(8,16,32,32,zt),new Ut(8,16,128,128,zt),new Ut(8,32,128,256,zt),new Ut(32,128,258,1024,zt),new Ut(32,258,258,4096,zt)];function Yt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=wt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),xt(this.dyn_ltree),xt(this.dyn_dtree),xt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),xt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),xt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ft=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==kt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Mt&&e.status!==At?1:0},Wt=t=>{if(Ft(t))return St(t,ct);t.total_in=t.total_out=0,t.data_type=bt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?kt:Mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,X(e),at},Ht=t=>{const e=Wt(t);var n;return e===at&&((n=t.state).window_size=2*n.w_size,xt(n.head),n.max_lazy_match=jt[n.level].max_lazy,n.good_match=jt[n.level].good_length,n.nice_match=jt[n.level].nice_length,n.max_chain_length=jt[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),e},Kt=(t,e,n,r,i,o)=>{if(!t)return ct;let s=1;if(e===ht&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>9||n!==wt||r<8||r>15||e<0||e>9||o<0||o>gt||8===r&&1!==s)return St(t,ct);8===r&&(r=9);const a=new Yt;return t.state=a,a.strm=t,a.status=kt,a.wrap=s,a.gzhead=null,a.w_bits=r,a.w_size=1<Kt(t,e,wt,15,8,yt),deflateInit2:Kt,deflateReset:Ht,deflateResetKeep:Wt,deflateSetHeader:(t,e)=>Ft(t)||2!==t.state.wrap?ct:(t.state.gzhead=e,at),deflate:(t,e)=>{if(Ft(t)||e>st||e<0)return t?St(t,ct):ct;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===At&&e!==ot)return St(t,0===t.avail_out?lt:ct);const r=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Pt(t),0===t.avail_out)return n.last_flush=-1,at}else if(0===t.avail_in&&It(e)<=It(r)&&e!==ot)return St(t,lt);if(n.status===At&&0!==t.avail_in)return St(t,lt);if(n.status===kt&&0===n.wrap&&(n.status=Mt),n.status===kt){let e=wt+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=pt||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=r<<6,0!==n.strstart&&(e|=32),e+=31-e%31,$t(n,e),0!==n.strstart&&($t(n,t.adler>>>16),$t(n,65535&t.adler)),t.adler=1,n.status=Mt,Pt(t),0!==n.pending)return n.last_flush=-1,at}if(57===n.status)if(t.adler=0,Lt(n,31),Lt(n,139),Lt(n,8),n.gzhead)Lt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Lt(n,255&n.gzhead.time),Lt(n,n.gzhead.time>>8&255),Lt(n,n.gzhead.time>>16&255),Lt(n,n.gzhead.time>>24&255),Lt(n,9===n.level?2:n.strategy>=pt||n.level<2?4:0),Lt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Lt(n,255&n.gzhead.extra.length),Lt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=V(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Lt(n,0),Lt(n,0),Lt(n,0),Lt(n,0),Lt(n,0),Lt(n,9===n.level?2:n.strategy>=pt||n.level<2?4:0),Lt(n,3),n.status=Mt,Pt(t),0!==n.pending)return n.last_flush=-1,at;if(69===n.status){if(n.gzhead.extra){let e=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=V(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=i,Pt(t),0!==n.pending)return n.last_flush=-1,at;e=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>e&&(t.adler=V(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let e,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(t.adler=V(t.adler,n.pending_buf,n.pending-r,r)),Pt(t),0!==n.pending)return n.last_flush=-1,at;r=0}e=n.gzindexr&&(t.adler=V(t.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(t.adler=V(t.adler,n.pending_buf,n.pending-r,r)),Pt(t),0!==n.pending)return n.last_flush=-1,at;r=0}e=n.gzindexr&&(t.adler=V(t.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Pt(t),0!==n.pending))return n.last_flush=-1,at;Lt(n,255&t.adler),Lt(n,t.adler>>8&255),t.adler=0}if(n.status=Mt,Pt(t),0!==n.pending)return n.last_flush=-1,at}if(0!==t.avail_in||0!==n.lookahead||e!==nt&&n.status!==At){let r=0===n.level?Ct(n,e):n.strategy===pt?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Dt(t),0===t.lookahead)){if(e===nt)return 1;break}if(t.match_length=0,n=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Bt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ot?(Bt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bt(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===mt?((t,e)=>{let n,r,i,o;const s=t.window;for(;;){if(t.lookahead<=_t){if(Dt(t),t.lookahead<=_t&&e===nt)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){o=t.strstart+_t;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=tt(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Bt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ot?(Bt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bt(t,!1),0===t.strm.avail_out)?1:2})(n,e):jt[n.level].func(n,e);if(3!==r&&4!==r||(n.status=At),1===r||3===r)return 0===t.avail_out&&(n.last_flush=-1),at;if(2===r&&(e===rt?et(n):e!==st&&(J(n,0,0,!1),e===it&&(xt(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Pt(t),0===t.avail_out))return n.last_flush=-1,at}return e!==ot?at:n.wrap<=0?ut:(2===n.wrap?(Lt(n,255&t.adler),Lt(n,t.adler>>8&255),Lt(n,t.adler>>16&255),Lt(n,t.adler>>24&255),Lt(n,255&t.total_in),Lt(n,t.total_in>>8&255),Lt(n,t.total_in>>16&255),Lt(n,t.total_in>>24&255)):($t(n,t.adler>>>16),$t(n,65535&t.adler)),Pt(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?at:ut)},deflateEnd:t=>{if(Ft(t))return ct;const e=t.state.status;return t.state=null,e===Mt?St(t,dt):at},deflateSetDictionary:(t,e)=>{let n=e.length;if(Ft(t))return ct;const r=t.state,i=r.wrap;if(2===i||1===i&&r.status!==kt||r.lookahead)return ct;if(1===i&&(t.adler=K(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){0===i&&(xt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let t=new Uint8Array(r.w_size);t.set(e.subarray(n-r.w_size,n),0),e=t,n=r.w_size}const o=t.avail_in,s=t.next_in,a=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Dt(r);r.lookahead>=3;){let t=r.strstart,e=r.lookahead-2;do{r.ins_h=Tt(r,r.ins_h,r.window[t+3-1]),r.prev[t&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=t,t++}while(--e);r.strstart=t,r.lookahead=2,Dt(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=s,t.input=a,t.avail_in=o,r.wrap=i,at},deflateInfo:"pako deflate (from Nodeca project)"};const Vt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Gt={assign:function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const e in n)Vt(n,e)&&(t[e]=n[e])}}return t},flattenChunks:t=>{let e=0;for(let n=0,r=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Xt[254]=Xt[254]=1;var Jt={string2buf:t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,r,i,o,s=t.length,a=0;for(i=0;i>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e},buf2string:(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let r,i;const o=new Array(2*n);for(i=0,r=0;r4)o[i++]=65533,r+=s-1;else{for(e&=2===s?31:3===s?15:7;s>1&&r1?o[i++]=65533:e<65536?o[i++]=e:(e-=65536,o[i++]=55296|e>>10&1023,o[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Zt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let r=0;r{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+Xt[t[n]]>e?n:e}},Qt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const te=Object.prototype.toString,{Z_NO_FLUSH:ee,Z_SYNC_FLUSH:ne,Z_FULL_FLUSH:re,Z_FINISH:ie,Z_OK:oe,Z_STREAM_END:se,Z_DEFAULT_COMPRESSION:ae,Z_DEFAULT_STRATEGY:ue,Z_DEFLATED:ce}=Z;function de(t){this.options=Gt.assign({level:ae,method:ce,chunkSize:16384,windowBits:15,memLevel:8,strategy:ue},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;let n=qt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==oe)throw new Error(G[n]);if(e.header&&qt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?Jt.string2buf(e.dictionary):"[object ArrayBuffer]"===te.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=qt.deflateSetDictionary(this.strm,t),n!==oe)throw new Error(G[n]);this._dict_set=!0}}function le(t,e){const n=new de(e);if(n.push(t,!0),n.err)throw n.msg||G[n.err];return n.result}de.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?ie:ee,"string"==typeof t?n.input=Jt.string2buf(t):"[object ArrayBuffer]"===te.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===ne||o===re)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=qt.deflate(n,o),i===se)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===oe;if(0!==n.avail_out){if(o>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},de.prototype.onData=function(t){this.chunks.push(t)},de.prototype.onEnd=function(t){t===oe&&(this.result=Gt.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var he={Deflate:de,deflate:le,deflateRaw:function(t,e){return(e=e||{}).raw=!0,le(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,le(t,e)},constants:Z};const fe=16209;var pe=function(t,e){let n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,v,k,M,A,S;const I=t.state;n=t.next_in,A=t.input,r=n+(t.avail_in-5),i=t.next_out,S=t.output,o=i-(e-t.avail_out),s=i+(t.avail_out-257),a=I.dmax,u=I.wsize,c=I.whave,d=I.wnext,l=I.window,h=I.hold,f=I.bits,p=I.lencode,m=I.distcode,g=(1<>>24,h>>>=w,f-=w,w=b>>>16&255,0===w)S[i++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(h&(1<>>=w,f-=w),f<15&&(h+=A[n++]<>>24,h>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=m[(65535&b)+(h&(1<a){t.msg="invalid distance too far back",I.mode=fe;break t}if(h>>>=w,f-=w,w=i-o,v>w){if(w=v-w,w>c&&I.sane){t.msg="invalid distance too far back",I.mode=fe;break t}if(k=0,M=l,0===d){if(k+=u-w,w<_){_-=w;do{S[i++]=l[k++]}while(--w);k=i-v,M=S}}else if(d2;)S[i++]=M[k++],S[i++]=M[k++],S[i++]=M[k++],_-=3;_&&(S[i++]=M[k++],_>1&&(S[i++]=M[k++]))}else{k=i-v;do{S[i++]=S[k++],S[i++]=S[k++],S[i++]=S[k++],_-=3}while(_>2);_&&(S[i++]=S[k++],_>1&&(S[i++]=S[k++]))}break}}break}}while(n>3,n-=_,f-=_<<3,h&=(1<{const u=a.bits;let c,d,l,h,f,p,m=0,g=0,y=0,b=0,w=0,_=0,v=0,k=0,M=0,A=0,S=null;const I=new Uint16Array(16),x=new Uint16Array(16);let E,T,P,B=null;for(m=0;m<=15;m++)I[m]=0;for(g=0;g=1&&0===I[b];b--);if(w>b&&(w=b),0===b)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(y=1;y0&&(0===t||1!==b))return-1;for(x[1]=0,m=1;m<15;m++)x[m+1]=x[m]+I[m];for(g=0;g852||2===t&&M>592)return 1;for(;;){E=m-v,s[g]+1=p?(T=B[s[g]-p],P=S[s[g]-p]):(T=96,P=0),c=1<>v)+d]=E<<24|T<<16|P|0}while(0!==d);for(c=1<>=1;if(0!==c?(A&=c-1,A+=c):A=0,g++,0==--I[m]){if(m===b)break;m=e[n+s[g]]}if(m>w&&(A&h)!==l){for(0===v&&(v=w),f+=y,_=m-v,k=1<<_;_+v852||2===t&&M>592)return 1;l=A&h,i[l]=w<<24|_<<16|f-o|0}}return 0!==A&&(i[f+A]=m-v<<24|64<<16|0),a.bits=w,0};const{Z_FINISH:_e,Z_BLOCK:ve,Z_TREES:ke,Z_OK:Me,Z_STREAM_END:Ae,Z_NEED_DICT:Se,Z_STREAM_ERROR:Ie,Z_DATA_ERROR:xe,Z_MEM_ERROR:Ee,Z_BUF_ERROR:Te,Z_DEFLATED:Pe}=Z,Be=16180,Le=16190,$e=16191,Re=16192,Oe=16194,De=16199,Ce=16200,Ne=16206,ze=16209,Ue=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function je(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ye=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},Fe=t=>{if(Ye(t))return Ie;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Be,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Me},We=t=>{if(Ye(t))return Ie;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Fe(t)},He=(t,e)=>{let n;if(Ye(t))return Ie;const r=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Ie:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,We(t))},Ke=(t,e)=>{if(!t)return Ie;const n=new je;t.state=n,n.strm=t,n.window=null,n.mode=Be;const r=He(t,e);return r!==Me&&(t.state=null),r};let qe,Ve,Ge=!0;const Ze=t=>{if(Ge){qe=new Int32Array(512),Ve=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(we(1,t.lens,0,288,qe,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;we(2,t.lens,0,32,Ve,0,t.work,{bits:5}),Ge=!1}t.lencode=qe,t.lenbits=9,t.distcode=Ve,t.distbits=5},Xe=(t,e,n,r)=>{let i;const o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(e.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(e.subarray(n-r,n-r+i),o.wnext),(r-=i)?(o.window.set(e.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whaveKe(t,15),inflateInit2:Ke,inflate:(t,e)=>{let n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,v,k,M,A=0;const S=new Uint8Array(4);let I,x;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ye(t)||!t.output||!t.input&&0!==t.avail_in)return Ie;n=t.state,n.mode===$e&&(n.mode=Re),s=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,r=t.input,a=t.avail_in,c=n.hold,d=n.bits,l=a,h=u,M=Me;t:for(;;)switch(n.mode){case Be:if(0===n.wrap){n.mode=Re;break}for(;d<16;){if(0===a)break t;a--,c+=r[o++]<>>8&255,n.check=V(n.check,S,2,0),c=0,d=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=ze;break}if((15&c)!==Pe){t.msg="unknown compression method",n.mode=ze;break}if(c>>>=4,d-=4,k=8+(15&c),0===n.wbits&&(n.wbits=k),k>15||k>n.wbits){t.msg="invalid window size",n.mode=ze;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=V(n.check,S,2,0)),c=0,d=0,n.mode=16182;case 16182:for(;d<32;){if(0===a)break t;a--,c+=r[o++]<>>8&255,S[2]=c>>>16&255,S[3]=c>>>24&255,n.check=V(n.check,S,4,0)),c=0,d=0,n.mode=16183;case 16183:for(;d<16;){if(0===a)break t;a--,c+=r[o++]<>8),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=V(n.check,S,2,0)),c=0,d=0,n.mode=16184;case 16184:if(1024&n.flags){for(;d<16;){if(0===a)break t;a--,c+=r[o++]<>>8&255,n.check=V(n.check,S,2,0)),c=0,d=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(f=n.length,f>a&&(f=a),f&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+f),k)),512&n.flags&&4&n.wrap&&(n.check=V(n.check,r,f,o)),a-=f,o+=f,n.length-=f),n.length))break t;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===a)break t;f=0;do{k=r[o+f++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k))}while(k&&f>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=$e;break;case 16189:for(;d<32;){if(0===a)break t;a--,c+=r[o++]<>>=7&d,d-=7&d,n.mode=Ne;break}for(;d<3;){if(0===a)break t;a--,c+=r[o++]<>>=1,d-=1,3&c){case 0:n.mode=16193;break;case 1:if(Ze(n),n.mode=De,e===ke){c>>>=2,d-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=ze}c>>>=2,d-=2;break;case 16193:for(c>>>=7&d,d-=7&d;d<32;){if(0===a)break t;a--,c+=r[o++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=ze;break}if(n.length=65535&c,c=0,d=0,n.mode=Oe,e===ke)break t;case Oe:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>u&&(f=u),0===f)break t;i.set(r.subarray(o,o+f),s),a-=f,o+=f,u-=f,s+=f,n.length-=f;break}n.mode=$e;break;case 16196:for(;d<14;){if(0===a)break t;a--,c+=r[o++]<>>=5,d-=5,n.ndist=1+(31&c),c>>>=5,d-=5,n.ncode=4+(15&c),c>>>=4,d-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=ze;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,d-=3}for(;n.have<19;)n.lens[E[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,I={bits:n.lenbits},M=we(0,n.lens,0,19,n.lencode,0,n.work,I),n.lenbits=I.bits,M){t.msg="invalid code lengths set",n.mode=ze;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,y=A>>>16&255,b=65535&A,!(g<=d);){if(0===a)break t;a--,c+=r[o++]<>>=g,d-=g,n.lens[n.have++]=b;else{if(16===b){for(x=g+2;d>>=g,d-=g,0===n.have){t.msg="invalid bit length repeat",n.mode=ze;break}k=n.lens[n.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===b){for(x=g+3;d>>=g,d-=g,k=0,f=3+(7&c),c>>>=3,d-=3}else{for(x=g+7;d>>=g,d-=g,k=0,f=11+(127&c),c>>>=7,d-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=ze;break}for(;f--;)n.lens[n.have++]=k}}if(n.mode===ze)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=ze;break}if(n.lenbits=9,I={bits:n.lenbits},M=we(1,n.lens,0,n.nlen,n.lencode,0,n.work,I),n.lenbits=I.bits,M){t.msg="invalid literal/lengths set",n.mode=ze;break}if(n.distbits=6,n.distcode=n.distdyn,I={bits:n.distbits},M=we(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,I),n.distbits=I.bits,M){t.msg="invalid distances set",n.mode=ze;break}if(n.mode=De,e===ke)break t;case De:n.mode=Ce;case Ce:if(a>=6&&u>=258){t.next_out=s,t.avail_out=u,t.next_in=o,t.avail_in=a,n.hold=c,n.bits=d,pe(t,h),s=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,r=t.input,a=t.avail_in,c=n.hold,d=n.bits,n.mode===$e&&(n.back=-1);break}for(n.back=0;A=n.lencode[c&(1<>>24,y=A>>>16&255,b=65535&A,!(g<=d);){if(0===a)break t;a--,c+=r[o++]<>w)],g=A>>>24,y=A>>>16&255,b=65535&A,!(w+g<=d);){if(0===a)break t;a--,c+=r[o++]<>>=w,d-=w,n.back+=w}if(c>>>=g,d-=g,n.back+=g,n.length=b,0===y){n.mode=16205;break}if(32&y){n.back=-1,n.mode=$e;break}if(64&y){t.msg="invalid literal/length code",n.mode=ze;break}n.extra=15&y,n.mode=16201;case 16201:if(n.extra){for(x=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;A=n.distcode[c&(1<>>24,y=A>>>16&255,b=65535&A,!(g<=d);){if(0===a)break t;a--,c+=r[o++]<>w)],g=A>>>24,y=A>>>16&255,b=65535&A,!(w+g<=d);){if(0===a)break t;a--,c+=r[o++]<>>=w,d-=w,n.back+=w}if(c>>>=g,d-=g,n.back+=g,64&y){t.msg="invalid distance code",n.mode=ze;break}n.offset=b,n.extra=15&y,n.mode=16203;case 16203:if(n.extra){for(x=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=ze;break}n.mode=16204;case 16204:if(0===u)break t;if(f=h-u,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=ze;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),m=n.window}else m=i,p=s-n.offset,f=n.length;f>u&&(f=u),u-=f,n.length-=f;do{i[s++]=m[p++]}while(--f);0===n.length&&(n.mode=Ce);break;case 16205:if(0===u)break t;i[s++]=n.length,u--,n.mode=Ce;break;case Ne:if(n.wrap){for(;d<32;){if(0===a)break t;a--,c|=r[o++]<{if(Ye(t))return Ie;let e=t.state;return e.window&&(e.window=null),t.state=null,Me},inflateGetHeader:(t,e)=>{if(Ye(t))return Ie;const n=t.state;return 0==(2&n.wrap)?Ie:(n.head=e,e.done=!1,Me)},inflateSetDictionary:(t,e)=>{const n=e.length;let r,i,o;return Ye(t)?Ie:(r=t.state,0!==r.wrap&&r.mode!==Le?Ie:r.mode===Le&&(i=1,i=K(i,e,n,0),i!==r.check)?xe:(o=Xe(t,e,n,n),o?(r.mode=16210,Ee):(r.havedict=1,Me)))},inflateInfo:"pako inflate (from Nodeca project)"},Qe=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const tn=Object.prototype.toString,{Z_NO_FLUSH:en,Z_FINISH:nn,Z_OK:rn,Z_STREAM_END:on,Z_NEED_DICT:sn,Z_STREAM_ERROR:an,Z_DATA_ERROR:un,Z_MEM_ERROR:cn}=Z;function dn(t){this.options=Gt.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;let n=Je.inflateInit2(this.strm,e.windowBits);if(n!==rn)throw new Error(G[n]);if(this.header=new Qe,Je.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Jt.string2buf(e.dictionary):"[object ArrayBuffer]"===tn.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=Je.inflateSetDictionary(this.strm,e.dictionary),n!==rn)))throw new Error(G[n])}function ln(t,e){const n=new dn(e);if(n.push(t),n.err)throw n.msg||G[n.err];return n.result}dn.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=e===~~e?e:!0===e?nn:en,"[object ArrayBuffer]"===tn.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=Je.inflate(n,s),o===sn&&i&&(o=Je.inflateSetDictionary(n,i),o===rn?o=Je.inflate(n,s):o===un&&(o=sn));n.avail_in>0&&o===on&&n.state.wrap>0&&0!==t[n.next_in];)Je.inflateReset(n),o=Je.inflate(n,s);switch(o){case an:case un:case sn:case cn:return this.onEnd(o),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||o===on))if("string"===this.options.to){let t=Jt.utf8border(n.output,n.next_out),e=n.next_out-t,i=Jt.buf2string(n.output,t);n.next_out=e,n.avail_out=r-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(o!==rn||0!==a){if(o===on)return o=Je.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},dn.prototype.onData=function(t){this.chunks.push(t)},dn.prototype.onEnd=function(t){t===rn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Gt.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var hn={Inflate:dn,inflate:ln,inflateRaw:function(t,e){return(e=e||{}).raw=!0,ln(t,e)},ungzip:ln,constants:Z};const{Deflate:fn,deflate:pn,deflateRaw:mn,gzip:gn}=he,{Inflate:yn,inflate:bn,inflateRaw:wn,ungzip:_n}=hn;var vn=bn,kn=n(26729),Mn=n.n(kn),An=n(48764).Buffer;const Sn=t=>"version"in t;var In=Object.freeze({__proto__:null,encode:function(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"0x")},decode:function(t){0===t.indexOf("0x")&&(t=t.substr(2)),t.length%2==1&&(t="0"+t);let e=t.match(/.{2}/g);return null===e?r.Buffer.from([]):r.Buffer.from(e.map((t=>parseInt(t,16))))}});function xn(t){return new TextDecoder("utf-8").decode(t)}function En(t){return(new TextEncoder).encode(t)}var Tn=Object.freeze({__proto__:null,decode:xn,encode:En});function Pn(t){return u().encode(t)}var Bn=Object.freeze({__proto__:null,encode:Pn,decode:function(t){return u().decode(t)}});function Ln(t){return t.toString("base64")}function $n(t){return r.Buffer.from(t,"base64")}var Rn=Object.freeze({__proto__:null,encode:Ln,decode:$n}),On=Object.freeze({__proto__:null,hex:In,utf8:Tn,bs58:Bn,base64:Rn});function Dn(t){const e=new Map;return t.errors&&t.errors.forEach((t=>{var n;let r=null!==(n=t.msg)&&void 0!==n?n:t.name;e.set(t.code,r)})),e}function Cn(t,...e){if(t.args.length!=e.length)throw new Error("Invalid argument length");const n={};let r=0;return t.args.forEach((t=>{n[t.name]=e[r],r+=1})),n}function Nn(t,e={}){t.forEach((t=>{if("accounts"in t)Nn(t.accounts,e[t.name]);else if(void 0===e[t.name])throw new Error(`Invalid arguments: ${t.name} not provided.`)}))}function zn(t){return t instanceof i.PublicKey?t:new i.PublicKey(t)}class Un extends TypeError{constructor(t,e){let n;const{message:r,...i}=t,{path:o}=t;super(0===o.length?r:"At path: "+o.join(".")+" -- "+r),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[t,...e()]}}}function jn(t){return"object"==typeof t&&null!=t}function Yn(t){return"string"==typeof t?JSON.stringify(t):""+t}function Fn(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:o}=e,{type:s}=n,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+Yn(r)+"`"}=t;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:u}}function*Wn(t,e,n,r){var i;jn(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]);for(const i of t){const t=Fn(i,e,n,r);t&&(yield t)}}function*Hn(t,e,n){void 0===n&&(n={});const{path:r=[],branch:i=[t],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(t=e.coercer(t,a),s&&"type"!==e.type&&jn(e.schema)&&jn(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let u=!0;for(const n of e.validator(t,a))u=!1,yield[n,void 0];for(let[n,c,d]of e.entries(t,a)){const e=Hn(c,d,{path:void 0===n?r:[...r,n],branch:void 0===n?i:[...i,c],coerce:o,mask:s});for(const r of e)r[0]?(u=!1,yield[r[0],void 0]):o&&(c=r[1],void 0===n?t=c:t instanceof Map?t.set(n,c):t instanceof Set?t.add(c):jn(t)&&(t[n]=c))}if(u)for(const n of e.refiner(t,a))u=!1,yield[n,void 0];u&&(yield[void 0,t])}class Kn{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:n,validator:r,refiner:i,coercer:o=(t=>t),entries:s=function*(){}}=t;this.type=e,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(t,e)=>Wn(r(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>Wn(i(t,e),e,this,t):()=>[]}assert(t){return function(t,e){const n=Gn(t,e);if(n[0])throw n[0]}(t,this)}create(t){return qn(t,this)}is(t){return Vn(t,this)}mask(t){return function(t,e){const n=Gn(t,e,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(t,this)}validate(t,e){return void 0===e&&(e={}),Gn(t,this,e)}}function qn(t,e){const n=Gn(t,e,{coerce:!0});if(n[0])throw n[0];return n[1]}function Vn(t,e){return!Gn(t,e)[0]}function Gn(t,e,n){void 0===n&&(n={});const r=Hn(t,e,n),i=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(r);return i[0]?[new Un(i[0],(function*(){for(const t of r)t[0]&&(yield t[0])})),void 0]:[void 0,i[1]]}function Zn(t,e){return new Kn({type:t,schema:null,validator:e})}function Xn(t){return new Kn({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+Yn(t)})}function Jn(t){const e=Yn(t),n=typeof t;return new Kn({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||"Expected the literal `"+e+"`, but received: "+Yn(n)})}function Qn(t){return new Kn({...t,validator:(e,n)=>null===e||t.validator(e,n),refiner:(e,n)=>null===e||t.refiner(e,n)})}function tr(){return Zn("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+Yn(t)))}function er(t){return new Kn({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function nr(){return Zn("string",(t=>"string"==typeof t||"Expected a string, but received: "+Yn(t)))}function rr(t){const e=Object.keys(t);return new Kn({type:"type",schema:t,*entries(n){if(jn(n))for(const r of e)yield[r,n[r],t[r]]},validator:t=>jn(t)||"Expected an object, but received: "+Yn(t)})}function ir(t){const e=t.map((t=>t.type)).join(" | ");return new Kn({type:"union",schema:null,coercer:(e,n)=>(t.find((t=>{const[n]=t.validate(e,{coerce:!0});return!n}))||or()).coercer(e,n),validator(n,r){const i=[];for(const e of t){const[...t]=Hn(n,e,r),[o]=t;if(!o[0])return[];for(const[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+Yn(n),...i]}})}function or(){return Zn("unknown",(()=>!0))}async function sr(t,e,n){if(e.length<=99)return await ar(t,e,n);{const r=function(t,e){return Array.apply(0,new Array(Math.ceil(t.length/99))).map(((e,n)=>t.slice(99*n,99*(n+1))))}(e);return(await Promise.all(r.map((e=>ar(t,e,n))))).flat()}}async function ar(t,e,n){const r=null!=n?n:t.commitment,{value:i,context:o}=await t.getMultipleAccountsInfoAndContext(e,r);return i.map(((t,n)=>null===t?null:{publicKey:e[n],account:t,context:o}))}async function ur(t,e,n,r,o){var s;n&&n.length>0&&e.sign(...n);const a=e._compile(),u=a.serialize(),c=e._serialize(u).toString("base64"),d={encoding:"base64",commitment:null!=r?r:t.commitment};if(o){const t=(Array.isArray(o)?o:a.nonProgramIds()).map((t=>t.toBase58()));d.accounts={encoding:"base64",addresses:t}}n&&(d.sigVerify=!0);const l=[c,d],h=qn(await t._rpcRequest("simulateTransaction",l),lr);if("error"in h){let t;if("data"in h.error&&(t=null===(s=h.error.data)||void 0===s?void 0:s.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(h.error.message,n)}throw new i.SendTransactionError("failed to simulate transaction: "+h.error.message,t)}return h.result}const cr=dr(or());function dr(t){return ir([rr({jsonrpc:Jn("2.0"),id:nr(),result:t}),rr({jsonrpc:Jn("2.0"),id:nr(),error:rr({code:or(),message:nr(),data:er(Zn("any",(()=>!0)))})})])}const lr=(fr=rr({err:Qn(ir([rr({}),nr()])),logs:Qn(Xn(nr())),accounts:er(Qn(Xn(Qn(rr({executable:Zn("boolean",(t=>"boolean"==typeof t)),owner:nr(),lamports:tr(),data:Xn(nr()),rentEpoch:er(tr())}))))),unitsConsumed:er(tr())}),function(t,e,n){return new Kn({...t,coercer:(n,r)=>Vn(n,e)?t.coercer((t=>"error"in t?t:{...t,result:qn(t.result,hr)})(n),r):t.coercer(n,r)})}(dr(hr=rr({context:rr({slot:tr()}),value:fr})),cr));var hr,fr,pr=Object.freeze({__proto__:null,invoke:async function(t,e,n,r){t=zn(t),r||(r=_r());const o=new i.Transaction;if(o.add(new i.TransactionInstruction({programId:t,keys:null!=e?e:[],data:n})),void 0===r.sendAndConfirm)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await r.sendAndConfirm(o,[])},getMultipleAccounts:async function(t,e,n){return(await sr(t,e,n)).map((t=>t?{publicKey:t.publicKey,account:t.account}:null))},getMultipleAccountsAndContext:sr,simulateTransaction:ur});class mr{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=null==e?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var r,o,s,a;if(void 0===n&&(n=this.opts),Sn(t))e&&t.sign(e);else if(t.feePayer=null!==(r=t.feePayer)&&void 0!==r?r:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const n of e)t.partialSign(n);const u=(t=await this.wallet.signTransaction(t)).serialize();try{return await yr(this.connection,u,n)}catch(e){if(e instanceof br){const n=Pn(Sn(t)?(null===(o=t.signatures)||void 0===o?void 0:o[0])||new Uint8Array:null!==(s=t.signature)&&void 0!==s?s:new Uint8Array),r=await this.connection.getTransaction(n,{commitment:"confirmed"});if(r){const t=null===(a=r.meta)||void 0===a?void 0:a.logMessages;throw t?new i.SendTransactionError(e.message,t):e}throw e}throw e}}async sendAll(t,e){var n,r,o;void 0===e&&(e=this.opts);const s=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let a=t.map((t=>{var e,n;if(Sn(t.tx)){let e=t.tx;return t.signers&&e.sign(t.signers),e}{let r=t.tx,i=null!==(e=t.signers)&&void 0!==e?e:[];return r.feePayer=null!==(n=r.feePayer)&&void 0!==n?n:this.wallet.publicKey,r.recentBlockhash=s,i.forEach((t=>{r.partialSign(t)})),r}}));const u=await this.wallet.signAllTransactions(a),c=[];for(let t=0;tt.startsWith("Program log: AnchorError")));if(-1===e)return null;const n=t[e],r=[n];let o;if(e+11)return null;r=t[0].match(/([0-9]+)/g)[0]}try{i=parseInt(r)}catch(t){return null}let o=e.get(i);return void 0!==o?new Tr(i,o,t.logs):(o=Lr.get(i),void 0!==o?new Tr(i,o,t.logs):null)}get program(){var t;return null===(t=this._programErrorStack)||void 0===t?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return null===(t=this._programErrorStack)||void 0===t?void 0:t.stack}toString(){return this.msg}}function Pr(t,e){Ar("debug-logs")&&console.log("Translating error:",t);const n=Er.parse(t.logs);if(n)return n;const r=Tr.parse(t,e);if(r)return r;if(t.logs){const e={get:function(e,n){return"programErrorStack"===n?e.programErrorStack.stack:"program"===n?e.programErrorStack.stack[t.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return t.programErrorStack=xr.parse(t.logs),new Proxy(t,e)}return t}const Br={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},Lr=new Map([[Br.InstructionMissing,"8 byte instruction identifier not provided"],[Br.InstructionFallbackNotFound,"Fallback functions are not supported"],[Br.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[Br.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[Br.IdlInstructionStub,"The program was compiled without idl instructions"],[Br.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[Br.ConstraintMut,"A mut constraint was violated"],[Br.ConstraintHasOne,"A has one constraint was violated"],[Br.ConstraintSigner,"A signer constraint was violated"],[Br.ConstraintRaw,"A raw constraint was violated"],[Br.ConstraintOwner,"An owner constraint was violated"],[Br.ConstraintRentExempt,"A rent exemption constraint was violated"],[Br.ConstraintSeeds,"A seeds constraint was violated"],[Br.ConstraintExecutable,"An executable constraint was violated"],[Br.ConstraintState,"Deprecated Error, feel free to replace with something else"],[Br.ConstraintAssociated,"An associated constraint was violated"],[Br.ConstraintAssociatedInit,"An associated init constraint was violated"],[Br.ConstraintClose,"A close constraint was violated"],[Br.ConstraintAddress,"An address constraint was violated"],[Br.ConstraintZero,"Expected zero account discriminant"],[Br.ConstraintTokenMint,"A token mint constraint was violated"],[Br.ConstraintTokenOwner,"A token owner constraint was violated"],[Br.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[Br.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[Br.ConstraintMintDecimals,"A mint decimals constraint was violated"],[Br.ConstraintSpace,"A space constraint was violated"],[Br.ConstraintAccountIsNone,"A required account for the constraint is None"],[Br.RequireViolated,"A require expression was violated"],[Br.RequireEqViolated,"A require_eq expression was violated"],[Br.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[Br.RequireNeqViolated,"A require_neq expression was violated"],[Br.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[Br.RequireGtViolated,"A require_gt expression was violated"],[Br.RequireGteViolated,"A require_gte expression was violated"],[Br.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[Br.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[Br.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[Br.AccountDidNotDeserialize,"Failed to deserialize the account"],[Br.AccountDidNotSerialize,"Failed to serialize the account"],[Br.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[Br.AccountNotMutable,"The given account is not mutable"],[Br.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[Br.InvalidProgramId,"Program ID was not as expected"],[Br.InvalidProgramExecutable,"Program account is not executable"],[Br.AccountNotSigner,"The given account did not sign"],[Br.AccountNotSystemOwned,"The given account is not owned by the system program"],[Br.AccountNotInitialized,"The program expected this account to be already initialized"],[Br.AccountNotProgramData,"The given account is not a program data account"],[Br.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[Br.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[Br.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[Br.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[Br.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[Br.Deprecated,"The API being used is deprecated and should no longer be used"]]);var $r=function(){return $r=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.name===r));if(1!==i.length)throw new Ir(`Type not found: ${JSON.stringify(t)}`);return zr.typeDefLayout(i[0],e,n)}if("array"in t.type){let r=t.type.array[0],i=t.type.array[1],o=zr.fieldLayout({name:void 0,type:r},e);return l.array(o,i,n)}throw new Error(`Not yet implemented: ${t}`)}}static typeDefLayout(t,e=[],n){switch(t.type.kind){case"struct":{const r=t.type.fields.map((t=>zr.fieldLayout(t,e)));return l.struct(r,n)}case"enum":{let r=t.type.variants.map((t=>{const n=d()(t.name);if(!t.fields)return l.struct([],n);const r=t.fields.map(((t,n)=>(null==t?void 0:t.name)?zr.fieldLayout(t,e):zr.fieldLayout({type:t,name:n.toString()},e)));return l.struct(r,n)}));return void 0!==n?l.rustEnum(r).replicate(n):l.rustEnum(r,n)}case"alias":return zr.fieldLayout({type:t.type.value,name:t.name},e)}}}const Ur="global";class jr{constructor(t){this.idl=t,this.ixLayout=jr.parseIxLayout(t);const e=new Map;t.instructions.forEach((t=>{const n=Fr(Ur,t.name);e.set(u().encode(n),{layout:this.ixLayout.get(t.name),name:t.name})})),this.sighashLayouts=e}encode(t,e){return this._encode(Ur,t,e)}_encode(t,e,n){const i=r.Buffer.alloc(1e3),o=d()(e),s=this.ixLayout.get(o);if(!s)throw new Error(`Unknown method: ${o}`);const a=s.encode(n,i),u=i.slice(0,a);return r.Buffer.concat([Fr(t,e),u])}static parseIxLayout(t){const e=t.instructions.map((e=>{let n=e.args.map((e=>{var n,r;return zr.fieldLayout(e,Array.from([...null!==(n=t.accounts)&&void 0!==n?n:[],...null!==(r=t.types)&&void 0!==r?r:[]]))}));const r=d()(e.name);return[r,l.struct(n,r)]}));return new Map(e)}decode(t,e="hex"){"string"==typeof t&&(t="hex"===e?r.Buffer.from(t,"hex"):u().decode(t));let n=u().encode(t.slice(0,8)),i=t.slice(8);const o=this.sighashLayouts.get(n);return o?{data:o.layout.decode(i),name:o.name}:null}format(t,e){return Yr.format(t,e,this.idl)}}class Yr{static format(t,e,n){const r=n.instructions.filter((e=>t.name===e.name))[0];if(void 0===r)return console.error("Invalid instruction given"),null;const i=r.args.map((e=>({name:e.name,type:Yr.formatIdlType(e.type),data:Yr.formatIdlData(e,t.data[e.name],n.types)}))),o=Yr.flattenIdlAccounts(r.accounts);return{args:i,accounts:e.map(((t,e)=>e`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if("string"==typeof t.type)return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map((e=>this.formatIdlData({name:"",type:t.type.vec},e))).join(", ")+"]";if(t.type.hasOwnProperty("option"))return null===e?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(void 0===n)throw new Error("User defined types not provided");const r=n.filter((e=>e.name===t.type.defined));if(1!==r.length)throw new Error(`Type not found: ${t.type.defined}`);return Yr.formatIdlDataDefined(r[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){switch(t.type.kind){case"struct":{const r=t.type;return"{ "+Object.keys(e).map((t=>{const i=r.fields.find((e=>e.name===t));if(!i)throw new Error("Unable to find type");return t+": "+Yr.formatIdlData(i,e[t],n)})).join(", ")+" }"}case"enum":if(0===t.type.variants.length)return"{}";if(t.type.variants[0].name){const r=t.type.variants,i=Object.keys(e)[0],o=e[i],s=Object.keys(o).map((t=>{var e;const s=o[t],a=null===(e=r[i])||void 0===e?void 0:e.find((e=>e.name===t));if(!a)throw new Error("Unable to find variant");return t+": "+Yr.formatIdlData(a,s,n)})).join(", "),a=d()(i,{pascalCase:!0});return 0===s.length?a:`${a} { ${s} }`}return"Tuple formatting not yet implemented";case"alias":return Yr.formatIdlType(t.type.value)}}static flattenIdlAccounts(t,e){return t.map((t=>{const n=function(t){const e=t.replace(/([A-Z])/g," $1");return e.charAt(0).toUpperCase()+e.slice(1)}(t.name);if(t.hasOwnProperty("accounts")){const r=e?`${e} > ${n}`:n;return Yr.flattenIdlAccounts(t.accounts,r)}return{...t,name:e?`${e} > ${n}`:n}})).flat()}}function Fr(t,e){var n;let i=`${t}:${void 0===n&&(n={}),function(t,e){return void 0===e&&(e={}),function(t,e){void 0===e&&(e={});for(var n=e.splitRegexp,r=void 0===n?Dr:n,i=e.stripRegexp,o=void 0===i?Cr:i,s=e.transform,a=void 0===s?Or:s,u=e.delimiter,c=void 0===u?" ":u,d=Nr(Nr(t,r,"$1\0$2"),o,"\0"),l=0,h=d.length;"\0"===d.charAt(l);)l++;for(;"\0"===d.charAt(h-1);)h--;return d.slice(l,h).split("\0").map(a).join(c)}(t,Rr({delimiter:"."},e))}(e,$r({delimiter:"_"},n))}`;return r.Buffer.from((0,h.J)(i).slice(0,8))}function Wr(t,e){switch(e.type.kind){case"struct":return e.type.fields.map((e=>Hr(t,e.type))).reduce(((t,e)=>t+e),0);case"enum":{const n=e.type.variants.map((e=>e.fields?e.fields.map((e=>Hr(t,"object"==typeof e&&"name"in e?e.type:e))).reduce(((t,e)=>t+e),0):0));return Math.max(...n)+1}case"alias":return Hr(t,e.type.value)}}function Hr(t,e){var n,r;switch(e){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"publicKey":return 32;default:if("vec"in e)return 1;if("option"in e)return 1+Hr(t,e.option);if("coption"in e)return 4+Hr(t,e.coption);if("defined"in e){const i=null!==(r=null===(n=t.types)||void 0===n?void 0:n.filter((t=>t.name===e.defined)))&&void 0!==r?r:[];if(1!==i.length)throw new Ir(`Type not found: ${JSON.stringify(e)}`);return Wr(t,i[0])}if("array"in e){let n=e.array[0],r=e.array[1];return Hr(t,n)*r}throw new Error(`Invalid type ${JSON.stringify(e)}`)}}const Kr=8;function qr(t){return An.from((0,h.J)(t).slice(0,Kr))}class Vr{constructor(t){if(void 0===t.accounts)return void(this.accountLayouts=new Map);const e=t.accounts.map((e=>[e.name,zr.typeDefLayout(e,t.types)]));this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=r.Buffer.alloc(1e3),i=this.accountLayouts.get(t);if(!i)throw new Error(`Unknown account: ${t}`);const o=i.encode(e,n);let s=n.slice(0,o),a=Vr.accountDiscriminator(t);return r.Buffer.concat([a,s])}decode(t,e){if(Vr.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find((t=>Vr.accountDiscriminator(t).equals(e)));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(Kr),r=this.accountLayouts.get(t);if(!r)throw new Error(`Unknown account: ${t}`);return r.decode(n)}memcmp(t,e){const n=Vr.accountDiscriminator(t);return{offset:0,bytes:u().encode(e?r.Buffer.concat([n,e]):n)}}size(t){var e;return Kr+(null!==(e=Wr(this.idl,t))&&void 0!==e?e:0)}static accountDiscriminator(t){return qr(`account:${d()(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`)}}class Gr{constructor(t){if(void 0===t.events)return void(this.layouts=new Map);const e=t.events.map((e=>{let n={name:e.name,type:{kind:"struct",fields:e.fields.map((t=>({name:t.name,type:t.type})))}};return[e.name,zr.typeDefLayout(n,t.types)]}));this.layouts=new Map(e),this.discriminators=new Map(void 0===t.events?[]:t.events.map((t=>[Ln(Zr(t.name)),t.name])))}decode(t){let e;try{e=$n(t)}catch(t){return null}const n=Ln(e.slice(0,8)),r=this.discriminators.get(n);if(void 0===r)return null;const i=this.layouts.get(r);if(!i)throw new Error(`Unknown event: ${r}`);return{data:i.decode(e.slice(8)),name:r}}}function Zr(t){return qr(`event:${t}`)}class Xr{constructor(t){if(void 0===t.types)return void(this.typeLayouts=new Map);const e=t.types.map((e=>[e.name,zr.typeDefLayout(e,t.types)]));this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=r.Buffer.alloc(1e3),i=this.typeLayouts.get(t);if(!i)throw new Error(`Unknown type: ${t}`);const o=i.encode(e,n);return n.slice(0,o)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class Jr{constructor(t){this.instruction=new jr(t),this.accounts=new Vr(t),this.events=new Gr(t),this.types=new Xr(t)}}var Qr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function ti(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}class ei{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var ni=ei;class ri extends ei{isCount(){throw new Error("ExternalLayout is abstract")}}class ii extends ri{constructor(t,e,n){if(!(t instanceof ei))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof oi||this.layout instanceof si}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class oi extends ei{constructor(t,e){if(super(t,e),6t&&e instanceof ei),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class hi{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class fi extends hi{constructor(t,e){if(!(t instanceof ri&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class pi extends ei{constructor(t,e,n){const r=t instanceof oi||t instanceof si;if(r)t=new fi(new ii(t));else if(t instanceof ri&&t.isCount())t=new fi(t);else if(!(t instanceof hi))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof ei))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new mi(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return An.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class mi extends ei{constructor(t,e,n,r){if(!(t instanceof pi))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof ei))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class gi extends ei{constructor(t,e){if(!(t instanceof ri&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof ri||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof ri&&(r=t.length),!An.isBuffer(t)||r!==t.length)throw new TypeError((i="Blob.encode",(this.property?i+"["+this.property+"]":i)+" requires (length "+r+") Buffer as src"));var i;if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof ri&&this.length.encode(r,e,n),r}}var yi=(t,e,n)=>new ii(t,e,n),bi=t=>new oi(4,t),wi=t=>new di(t),_i=(t,e,n)=>new li(t,e,n),vi=(t,e,n)=>new pi(t,e,n),ki=(t,e)=>new gi(t,e);class Mi{constructor(t){}encode(t,e){switch(d()(t)){case"createAccount":return function({lamports:t,space:e,owner:n}){return Ei({createAccount:{lamports:t,space:e,owner:n.toBuffer()}})}(e);case"assign":return function({owner:t}){return Ei({assign:{owner:t.toBuffer()}})}(e);case"transfer":return function({lamports:t}){return Ei({transfer:{lamports:t}})}(e);case"createAccountWithSeed":return function({base:t,seed:e,lamports:n,space:r,owner:i}){return Ei({createAccountWithSeed:{base:t.toBuffer(),seed:e,lamports:n,space:r,owner:i.toBuffer()}},xi.getVariant(3).span+e.length)}(e);case"advanceNonceAccount":return function({authorized:t}){return Ei({advanceNonceAccount:{authorized:t.toBuffer()}})}(e);case"withdrawNonceAccount":return function({lamports:t}){return Ei({withdrawNonceAccount:{lamports:t}})}(e);case"initializeNonceAccount":return function({authorized:t}){return Ei({initializeNonceAccount:{authorized:t.toBuffer()}})}(e);case"authorizeNonceAccount":return function({authorized:t}){return Ei({authorizeNonceAccount:{authorized:t.toBuffer()}})}(e);case"allocate":return function({space:t}){return Ei({allocate:{space:t}})}(e);case"allocateWithSeed":return function({base:t,seed:e,space:n,owner:r}){return Ei({allocateWithSeed:{base:t.toBuffer(),seed:e,space:n,owner:r.toBuffer()}},xi.getVariant(9).span+e.length)}(e);case"assignWithSeed":return function({base:t,seed:e,owner:n}){return Ei({assignWithSeed:{base:t.toBuffer(),seed:e,owner:n.toBuffer()}},xi.getVariant(10).span+e.length)}(e);case"transferWithSeed":return function({lamports:t,seed:e,owner:n}){return Ei({transferWithSeed:{lamports:t,seed:e,owner:n.toBuffer()}},xi.getVariant(11).span+e.length)}(e);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,e){throw new Error("System does not have state")}}class Ai extends ni{constructor(t){super(-1,t),this.property=t,this.layout=_i([bi("length"),bi("lengthPadding"),ki(yi(bi(),-8),"chars")],this.property)}encode(t,e,n=0){if(null==t)return this.layout.span;const r={chars:An.from(t,"utf8")};return this.layout.encode(r,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return bi().span+bi().span+new(s())(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function Si(t){return new Ai(t)}function Ii(t){return ki(32,t)}const xi=vi(bi("instruction"));function Ei(t,e){const n=An.alloc(null!=e?e:Ti),r=xi.encode(t,n);return void 0===e?n.slice(0,r):n}xi.addVariant(0,_i([wi("lamports"),wi("space"),Ii("owner")]),"createAccount"),xi.addVariant(1,_i([Ii("owner")]),"assign"),xi.addVariant(2,_i([wi("lamports")]),"transfer"),xi.addVariant(3,_i([Ii("base"),Si("seed"),wi("lamports"),wi("space"),Ii("owner")]),"createAccountWithSeed"),xi.addVariant(4,_i([Ii("authorized")]),"advanceNonceAccount"),xi.addVariant(5,_i([wi("lamports")]),"withdrawNonceAccount"),xi.addVariant(6,_i([Ii("authorized")]),"initializeNonceAccount"),xi.addVariant(7,_i([Ii("authorized")]),"authorizeNonceAccount"),xi.addVariant(8,_i([wi("space")]),"allocate"),xi.addVariant(9,_i([Ii("base"),Si("seed"),wi("space"),Ii("owner")]),"allocateWithSeed"),xi.addVariant(10,_i([Ii("base"),Si("seed"),Ii("owner")]),"assignWithSeed"),xi.addVariant(11,_i([wi("lamports"),Si("seed"),Ii("owner")]),"transferWithSeed");const Ti=Math.max(...Object.values(xi.registry).map((t=>t.span)));class Pi{constructor(t){this.idl=t}async encode(t,e){if("nonce"===t){const t=An.alloc(i.NONCE_ACCOUNT_LENGTH),n=$i.encode(e,t);return t.slice(0,n)}throw new Error(`Invalid account name: ${t}`)}decode(t,e){return this.decodeUnchecked(t,e)}decodeUnchecked(t,e){if("nonce"===t)return function(t){return $i.decode(t)}(e);throw new Error(`Invalid account name: ${t}`)}memcmp(t,e){if("nonce"===t)return{dataSize:i.NONCE_ACCOUNT_LENGTH};throw new Error(`Invalid account name: ${t}`)}size(t){var e;return null!==(e=Wr(this.idl,t))&&void 0!==e?e:0}}class Bi extends ni{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function Li(t){return new Bi(ki(32),(t=>new i.PublicKey(t)),(t=>t.toBuffer()),t)}const $i=_i([bi("version"),bi("state"),Li("authorizedPubkey"),Li("nonce"),_i([("lamportsPerSignature",new class extends ei{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return ci(t.readUInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=ui(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}("lamportsPerSignature"))],"feeCalculator")]);class Ri{constructor(t){}decode(t){throw new Error("System program does not have events")}}class Oi{constructor(t){}encode(t,e){throw new Error("System does not have user-defined types")}decode(t,e){throw new Error("System does not have user-defined types")}}class Di{constructor(t){this.instruction=new Mi(t),this.accounts=new Pi(t),this.events=new Ri(t),this.types=new Oi(t)}}var Ci=Object.freeze({__proto__:null,hash:function(t){return(new TextDecoder).decode((0,h.J)(t))}});function Ni(t,...e){let n=[r.Buffer.from([97,110,99,104,111,114])];e.forEach((t=>{n.push(t instanceof r.Buffer?t:zn(t).toBuffer())}));const[o]=i.PublicKey.findProgramAddressSync(n,zn(t));return o}var zi=Object.freeze({__proto__:null,createWithSeedSync:function(t,e,n){const o=r.Buffer.concat([t.toBuffer(),r.Buffer.from(e),n.toBuffer()]);return new i.PublicKey((0,h.J)(o))},associated:Ni});const Ui=new i.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),ji=new i.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var Yi=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Ui,ASSOCIATED_PROGRAM_ID:ji,associatedAddress:function({mint:t,owner:e}){return i.PublicKey.findProgramAddressSync([e.toBuffer(),Ui.toBuffer(),t.toBuffer()],ji)[0]}}),Fi={exports:{}};!function(t,e){var n="undefined"!=typeof self?self:Qr,r=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function m(t){var e=new FileReader,n=p(e);return e.readAsArrayBuffer(t),n}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=p(e);return e.readAsText(t),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function _(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function v(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];v.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function M(t,n){return new Promise((function(r,o){var s=new w(t,n);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new v(i,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}M.polyfill=!0,t.fetch||(t.fetch=M,t.Headers=h,t.Request=w,t.Response=v),e.Headers=h,e.Request=w,e.Response=v,e.fetch=M,Object.defineProperty(e,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(Fi,Fi.exports);var Wi=ti(Fi.exports);async function Hi(t,e){const n=await t.getAccountInfo(e);if(null===n)throw new Error("program account not found");const{program:r}=qi(n.data),i=await t.getAccountInfo(r.programdataAddress);if(null===i)throw new Error("program data account not found");const{programData:o}=qi(i.data);return o}const Ki=l.rustEnum([l.struct([],"uninitialized"),l.struct([l.option(l.publicKey(),"authorityAddress")],"buffer"),l.struct([l.publicKey("programdataAddress")],"program"),l.struct([l.u64("slot"),l.option(l.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,l.u32());function qi(t){return Ki.decode(t)}var Vi=Object.freeze({__proto__:null,verifiedBuild:async function(t,e,n=5){const r=`https://api.apr.dev/api/v0/program/${e.toString()}/latest?limit=${n}`,[i,o]=await Promise.all([Hi(t,e),Wi(r)]),s=(await o.json()).filter((t=>!t.aborted&&"Built"===t.state&&"Verified"===t.verified));if(0===s.length)return null;const a=s[0];return i.slot.toNumber()!==a.verified_slot?null:a},fetchData:Hi,decodeUpgradeableLoaderState:qi}),Gi=Object.freeze({__proto__:null,sha256:Ci,rpc:pr,publicKey:zi,bytes:On,token:Yi,features:Sr,registry:Vi});function Zi(t){return"accounts"in t}const Xi=l.struct([l.publicKey("authority"),l.vecU8("data")]);function Ji(t,e){var n,r;let i={};const o=t.args?t.args.length:0;if(e.length>o){if(e.length!==o+1)throw new Error(`provided too many arguments ${e} to instruction ${null==t?void 0:t.name} expecting: ${null!==(r=null===(n=t.args)||void 0===n?void 0:n.map((t=>t.name)))&&void 0!==r?r:[]}`);i=e.pop()}return[e,i]}class Qi{static build(t,e,n){if("_inner"===t.name)throw new Ir("the _inner name is reserved");const r=(...o)=>{const[s,a]=Ji(t,[...o]);Nn(t.accounts,a.accounts);const u=r.accounts(a.accounts);return void 0!==a.remainingAccounts&&u.push(...a.remainingAccounts),Ar("debug-logs")&&console.log("Outgoing account metas:",u),new i.TransactionInstruction({keys:u,programId:n,data:e(t.name,Cn(t,...s))})};return r.accounts=e=>Qi.accountsArray(e,t.accounts,n,t.name),r}static accountsArray(t,e,n,r){return t?e.map((e=>{if(void 0!==("accounts"in e?e.accounts:void 0)){const i=t[e.name];return Qi.accountsArray(i,e.accounts,n,r).flat()}{const i=e;let o;try{o=zn(t[e.name])}catch(t){throw new Error(`Wrong input type for account "${e.name}" in the instruction accounts object${void 0!==r?' for instruction "'+r+'"':""}. Expected PublicKey or string.`)}const s=i.isOptional&&o.equals(n);return{pubkey:o,isWritable:i.isMut&&!s,isSigner:i.isSigner&&!s}}})).flat():[]}}class to{static build(t,e){return(...n)=>{var r,o,s;const[,a]=Ji(t,[...n]),u=new i.Transaction;if(a.preInstructions&&a.instructions)throw new Error("instructions is deprecated, use preInstructions");return null===(r=a.preInstructions)||void 0===r||r.forEach((t=>u.add(t))),null===(o=a.instructions)||void 0===o||o.forEach((t=>u.add(t))),u.add(e(...n)),null===(s=a.postInstructions)||void 0===s||s.forEach((t=>u.add(t))),u}}}class eo{static build(t,e,n,r){return async(...i)=>{var o;const s=e(...i),[,a]=Ji(t,[...i]);if(void 0===r.sendAndConfirm)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await r.sendAndConfirm(s,null!==(o=a.signers)&&void 0!==o?o:[],a.options)}catch(t){throw Pr(t,n)}}}}class no{static build(t,e,n,r){var i;const o={};return null===(i=t.accounts)||void 0===i||i.forEach((i=>{const s=d()(i.name);o[s]=new ro(t,i,n,r,e)})),o}}class ro{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,r,i){this._idlAccount=e,this._programId=n,this._provider=null!=r?r:_r(),this._coder=null!=i?i:new Jr(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:r,context:i}=n;return{data:r&&0!==r.data.length?this._coder.accounts.decode(this._idlAccount.name,r.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(null===n)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:r}=await this.fetchNullableAndContext(t,e);if(null===n)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:r}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map((t=>t?t.data:null))}async fetchMultipleAndContext(t,e){return(await sr(this._provider.connection,t.map((t=>zn(t))),e)).map((t=>{if(null==t)return null;const{account:e,context:n}=t;return{data:this._coder.accounts.decode(this._idlAccount.name,e.data),context:n}}))}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof An?t:void 0),n=[];return null!=(null==e?void 0:e.offset)&&null!=(null==e?void 0:e.bytes)&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),null!=(null==e?void 0:e.dataSize)&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map((({pubkey:t,account:e})=>({publicKey:t,account:this._coder.accounts.decode(this._idlAccount.name,e.data)})))}subscribe(t,e){const n=io.get(t.toString());if(n)return n.ee;const r=new(Mn());t=zn(t);const i=this._provider.connection.onAccountChange(t,(t=>{const e=this._coder.accounts.decode(this._idlAccount.name,t.data);r.emit("change",e)}),e);return io.set(t.toString(),{ee:r,listener:i}),r}async unsubscribe(t){let e=io.get(t.toString());e?io&&await this._provider.connection.removeAccountChangeListener(e.listener).then((()=>{io.delete(t.toString())})).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(t,e){const n=this.size;if(void 0===this._provider.publicKey)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return i.SystemProgram.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:null!=e?e:n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(null!=e?e:n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await Ni(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(zn(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(zn(t),e)}}const io=new Map,oo="Program log: ";class so{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new ao(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let r=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,(null!==(n=this._eventListeners.get(t))&&void 0!==n?n:[]).concat(r)),this._eventCallbacks.set(r,[t,e]),void 0!==this._onLogsSubscriptionId||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,((t,e)=>{if(!t.err)for(const n of this._eventParser.parseLogs(t.logs)){const r=this._eventListeners.get(n.name);r&&r.forEach((r=>{const i=this._eventCallbacks.get(r);if(i){const[,r]=i;r(n.data,e.slot,t.signature)}}))}}))),r}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let r=this._eventListeners.get(n);if(!r)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),r=r.filter((e=>e!==t)),this._eventListeners.set(n,r),0===r.length&&this._eventListeners.delete(n),0===this._eventCallbacks.size){if(0!==this._eventListeners.size)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);void 0!==this._onLogsSubscriptionId&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class ao{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new co(t),r=new uo;let i=n.next();for(;null!==i;){let[t,o,s]=this.handleLog(r,i,e);t&&(yield t),o&&r.push(o),s&&r.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(oo)||t.startsWith("Program data: ")){const n=t.startsWith(oo)?t.slice(13):t.slice(14),r=this.coder.events.decode(n);if(e&&null===r)throw new Error(`Unable to decode event ${n}`);return[r,null,!1]}return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return null!==e.match(/^Program (.*) success/g)?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class uo{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class co{constructor(t){this.logs=t}next(){if(0===this.logs.length)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class lo{static build(t,e,n,r,i,o,s){return async(...a)=>{var u;const c=e(...a),[,d]=Ji(t,[...a]);let l;if(void 0===r.simulate)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{l=await r.simulate(c,d.signers,null===(u=d.options)||void 0===u?void 0:u.commitment)}catch(t){throw Pr(t,n)}if(void 0===l)throw new Error("Unable to simulate transaction");const h=l.logs;if(!h)throw new Error("Simulated logs not found");const f=[];if(s.events){let t=new ao(o,i);for(const e of t.parseLogs(h))f.push(e)}return{events:f,raw:h}}}}function ho(t){return new mo(ki(8),(t=>yo.fromBuffer(t)),(t=>t.toBuffer()),t)}function fo(t){return new mo(ki(32),(t=>new i.PublicKey(t)),(t=>t.toBuffer()),t)}function po(t,e){return new go(t,e)}class mo extends ni{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class go extends ni{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=bi()}encode(t,e,n=0){return null==t?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class yo extends(s()){toBuffer(){const t=super.toArray().reverse(),e=An.from(t);if(8===e.length)return e;if(e.length>=8)throw new Error("u64 too large");const n=An.alloc(8);return e.copy(n),n}static fromBuffer(t){if(8!==t.length)throw new Error(`Invalid buffer length: ${t.length}`);return new yo([...t].reverse().map((t=>`00${t.toString(16)}`.slice(-2))).join(""),16)}}const bo=_i([fo("mint"),fo("owner"),ho("amount"),po(fo(),"delegate"),(t=>{const e=vi(new oi(1,"discriminator"),null,"state");return e.addVariant(0,_i([]),"uninitialized"),e.addVariant(1,_i([]),"initialized"),e.addVariant(2,_i([]),"frozen"),e})(),po(ho(),"isNative"),ho("delegatedAmount"),po(fo(),"closeAuthority")]);class wo{constructor(t,e,n,r,i,o,s,a){this._accounts=e,this._provider=n,this._programId=r,this._idlIx=i,this._idlTypes=s,this._customResolver=a,this._args=t,this._accountStore=new _o(n,o,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const r of e){const e=r.name,i=t[e];void 0!==i&&(ko(i)?Zi(r)?n[e]=this.resolveOptionalsHelper(i,r.accounts):n[e]=Mo(i,!0):null!==i?n[e]=zn(i):r.isOptional&&(n[e]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce(((t,e)=>t&&t[e]),this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach(((r,i)=>{i==t.length-1&&(n[r]=e),n[r]=n[r]||{},n=n[r]}))}async resolveConst(t,e=[]){for(let n=0;n0&&!this.get([...e,a])&&Boolean(await this.autoPopulatePda(s,e))&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let r=0;r!this.get([...e,d()(t)])));if(n+=t.length,t.length>0){const n=await this._accountStore.fetchAccount({publicKey:c});await Promise.all(t.map((async t=>{const r=d()(t);return this.set([...e,r],n[r]),n[r]})))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map((t=>this.toBuffer(t,e))));if(n.some((t=>void 0===t)))return;const r=await this.parseProgramId(t,e);if(!r)return;const[o]=await i.PublicKey.findProgramAddress(n,r);this.set([...e,d()(t.name)],o)}async parseProgramId(t,e=[]){var n;if(!(null===(n=t.pda)||void 0===n?void 0:n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new i.PublicKey(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find((e=>e.name===t.defined));if(!n)throw new Error(`Cannot find type ${t.defined}`);const r=n.type.fields.find((t=>t.name===e[0]));return this.getType(r.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(void 0!==e)return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=d()(e[0]),r=this._idlIx.args.findIndex((t=>t.name===n));if(-1===r)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce(((t,e)=>(t||{})[e]),this._args[r])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),r=n[0],i=this.get([...e,d()(r)]);if(null===i)throw new Error("fieldPubkey is null");if(1===n.length)return i;const o=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(o,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[d()(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return An.from([e]);case"u16":let n=An.alloc(2);return n.writeUInt16LE(e),n;case"u32":let r=An.alloc(4);return r.writeUInt32LE(e),r;case"u64":let i=An.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return An.from(En(e));case"publicKey":return e.toBuffer();default:if(t.array)return An.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}wo.CONST_ACCOUNTS={associatedTokenProgram:ji,rent:i.SYSVAR_RENT_PUBKEY,systemProgram:i.SystemProgram.programId,tokenProgram:Ui,clock:i.SYSVAR_CLOCK_PUBKEY};class _o{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await xo.fetchIdl(t,this._provider);if(e){const n=new xo(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const r=t.toString();if(!this._cache.has(r))if("TokenAccount"===e){const e=await this._provider.connection.getAccountInfo(t);if(null===e)throw new Error(`invalid account info for ${r}`);const n=(i=e.data,bo.decode(i));this._cache.set(r,n)}else if(e){const i=await this.ensureIdl(n);if(i){const n=i[d()(e)];if(n){const e=await n.fetch(t);this._cache.set(r,e)}}}else{const e=await this._provider.connection.getAccountInfo(t);if(null===e)throw new Error(`invalid account info for ${r}`);const n=e.data,i=await this.ensureIdl(e.owner);if(i){const t=Object.values(i)[0];if(!t)throw new Error("No accounts for this program");const e=t.coder.accounts.decodeAny(n);this._cache.set(r,e)}}var i;return this._cache.get(r)}}class vo{static build(t,e,n,r,i,o,s,a,u,c,d){return(...l)=>new Ao(l,r,i,o,s,a,t,e,n,u,c,d)}}function ko(t){return"object"==typeof t&&null!==t&&!("_bn"in t)}function Mo(t,e){const n={};for(const r in t){const i=t[r];if(null!==i)n[r]=ko(i)?Mo(i,!0):zn(i);else if(e)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!")}return n}class Ao{constructor(t,e,n,r,i,o,s,a,u,c,d,l){this._ixFn=e,this._txFn=n,this._rpcFn=r,this._simulateFn=i,this._viewFn=o,this._programId=a,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new wo(t,this._accounts,s,a,u,c,d,l)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class So{static build(t,e,n,r){const i=e.accounts.find((t=>t.isMut)),o=!!e.returns;if(!i&&o)return async(...i)=>{var o,s;let a=await n(...i);const u=`Program return: ${t} `;let c=a.raw.find((t=>t.startsWith(u)));if(!c)throw new Error("View expected return log");let d=$n(c.slice(u.length)),l=e.returns;if(!l)throw new Error("View expected return type");return zr.fieldLayout({type:l},Array.from([...null!==(o=r.accounts)&&void 0!==o?o:[],...null!==(s=r.types)&&void 0!==s?s:[]])).decode(d)}}}class Io{static build(t,e,n,r,i){const o={},s={},a={},u={},c={},l={},h=Dn(t),f=t.accounts?no.build(t,e,n,r):{};return t.instructions.forEach((p=>{const m=Qi.build(p,((t,n)=>e.instruction.encode(t,n)),n),g=to.build(p,m),y=eo.build(p,g,h,r),b=lo.build(p,g,h,r,e,n,t),w=So.build(n,p,b,t),_=vo.build(r,n,p,m,g,y,b,w,f,t.types||[],i&&i(p)),v=d()(p.name);s[v]=m,a[v]=g,o[v]=y,u[v]=b,c[v]=_,w&&(l[v]=w)})),[o,s,a,f,u,c,l]}}class xo{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,r,i){e=zn(e),n||(n=_r()),this._idl=t,this._provider=n,this._programId=e,this._coder=null!=r?r:new Jr(t),this._events=new so(this._programId,n,this._coder);const[o,s,a,u,c,d,l]=Io.build(t,this._coder,e,n,null!=i?i:()=>{});this.rpc=o,this.instruction=s,this.transaction=a,this.account=u,this.simulate=c,this.methods=d,this.views=l}static async at(t,e){const n=zn(t),r=await xo.fetchIdl(n,e);if(!r)throw new Error(`IDL not found for program: ${t.toString()}`);return new xo(r,n,e)}static async fetchIdl(t,e){e=null!=e?e:_r();const n=zn(t),r=await async function(t){const e=(await i.PublicKey.findProgramAddress([],t))[0];return await i.PublicKey.createWithSeed(e,"anchor:idl",t)}(n),o=await e.connection.getAccountInfo(r);if(!o)return null;let s=(a=o.data.slice(8),Xi.decode(a));var a;const u=vn(s.data);return JSON.parse(xn(u))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}const Eo=new i.PublicKey("11111111111111111111111111111111");const To={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};class Po{static system(t){return function(t){return new xo(To,Eo,t,new Di(To))}(t)}}},6378:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.associatedAddress=e.ASSOCIATED_PROGRAM_ID=e.TOKEN_PROGRAM_ID=void 0;const r=n(33957);e.TOKEN_PROGRAM_ID=new r.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),e.ASSOCIATED_PROGRAM_ID=new r.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),e.associatedAddress=function({mint:t,owner:n}){return r.PublicKey.findProgramAddressSync([n.toBuffer(),e.TOKEN_PROGRAM_ID.toBuffer(),t.toBuffer()],e.ASSOCIATED_PROGRAM_ID)[0]}},61275:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.array=e.rustEnum=e.str=e.vecU8=e.tagged=e.vec=e.bool=e.option=e.publicKey=e.i256=e.u256=e.i128=e.u128=e.i64=e.u64=e.struct=e.f64=e.f32=e.i32=e.u32=e.i16=e.u16=e.i8=e.u8=void 0;const o=n(20698),s=n(33957),a=i(n(13550));var u=n(20698);Object.defineProperty(e,"u8",{enumerable:!0,get:function(){return u.u8}}),Object.defineProperty(e,"i8",{enumerable:!0,get:function(){return u.s8}}),Object.defineProperty(e,"u16",{enumerable:!0,get:function(){return u.u16}}),Object.defineProperty(e,"i16",{enumerable:!0,get:function(){return u.s16}}),Object.defineProperty(e,"u32",{enumerable:!0,get:function(){return u.u32}}),Object.defineProperty(e,"i32",{enumerable:!0,get:function(){return u.s32}}),Object.defineProperty(e,"f32",{enumerable:!0,get:function(){return u.f32}}),Object.defineProperty(e,"f64",{enumerable:!0,get:function(){return u.f64}}),Object.defineProperty(e,"struct",{enumerable:!0,get:function(){return u.struct}});class c extends o.Layout{constructor(t,e,n){super(t,n),this.blob=(0,o.blob)(t),this.signed=e}decode(t,e=0){const n=new a.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(t,e,n=0){return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(r,"le",this.span),e,n)}}function d(t){return new c(8,!1,t)}e.u64=d,e.i64=function(t){return new c(8,!0,t)},e.u128=function(t){return new c(16,!1,t)},e.i128=function(t){return new c(16,!0,t)},e.u256=function(t){return new c(32,!1,t)},e.i256=function(t){return new c(32,!0,t)};class l extends o.Layout{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}e.publicKey=function(t){return new l((0,o.blob)(32),(t=>new s.PublicKey(t)),(t=>t.toBuffer()),t)};class h extends o.Layout{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=(0,o.u8)()}encode(t,e,n=0){return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}getSpan(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}function f(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function p(t){return t?1:0}function m(t){const e=(0,o.u32)("length"),n=(0,o.struct)([e,(0,o.blob)((0,o.offset)(e,-e.span),"data")]);return new l(n,(({data:t})=>t),(t=>({data:t})),t)}e.option=function(t,e){return new h(t,e)},e.bool=function(t){return new l((0,o.u8)(),f,p,t)},e.vec=function(t,e){const n=(0,o.u32)("length"),r=(0,o.struct)([n,(0,o.seq)(t,(0,o.offset)(n,-n.span),"values")]);return new l(r,(({values:t})=>t),(t=>({values:t})),e)},e.tagged=function(t,e,n){const r=(0,o.struct)([d("tag"),e.replicate("data")]);return new l(r,(function({tag:e,data:n}){if(!e.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+e.toString("hex"));return n}),(e=>({tag:t,data:e})),n)},e.vecU8=m,e.str=function(t){return new l(m(),(t=>t.toString("utf-8")),(t=>r.from(t,"utf-8")),t)},e.rustEnum=function(t,e,n){const r=(0,o.union)(null!=n?n:(0,o.u8)(),e);return t.forEach(((t,e)=>r.addVariant(e,t,t.property))),r},e.array=function(t,e,n){const r=(0,o.struct)([(0,o.seq)(t,e,"values")]);return new l(r,(({values:t})=>t),(t=>({values:t})),n)};class g extends o.Layout{constructor(t,e,n){super(t.span+e.span,n),this.keyLayout=t,this.valueLayout=e}decode(t,e){return e=e||0,[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}encode(t,e,n){n=n||0;const r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}getSpan(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}e.map=function(t,e,n){const r=(0,o.u32)("length"),i=(0,o.struct)([r,(0,o.seq)(new g(t,e),(0,o.offset)(r,-r.span),"values")]);return new l(i,(({values:t})=>new Map(t)),(t=>({values:Array.from(t.entries())})),n)}},33957:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Account:()=>Jn,AddressLookupTableAccount:()=>ai,AddressLookupTableInstruction:()=>ns,AddressLookupTableProgram:()=>rs,Authorized:()=>ps,BLOCKHASH_CACHE_TIMEOUT_MS:()=>fi,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>Qn,BPF_LOADER_PROGRAM_ID:()=>qr,BpfLoader:()=>Vr,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>os,ComputeBudgetInstruction:()=>is,ComputeBudgetProgram:()=>ss,Connection:()=>Qo,Ed25519Program:()=>us,Enum:()=>Wn,EpochSchedule:()=>ei,FeeCalculatorLayout:()=>Cr,Keypair:()=>ts,LAMPORTS_PER_SOL:()=>Cs,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>es,Loader:()=>Kr,Lockup:()=>ms,MAX_SEED_LENGTH:()=>Vn,Message:()=>mr,MessageAccountKeys:()=>sr,MessageV0:()=>gr,NONCE_ACCOUNT_LENGTH:()=>zr,NonceAccount:()=>Ur,PACKET_DATA_SIZE:()=>tr,PUBLIC_KEY_LENGTH:()=>Gn,PublicKey:()=>Xn,SIGNATURE_LENGTH_IN_BYTES:()=>nr,SOLANA_SCHEMA:()=>Hn,STAKE_CONFIG_ID:()=>fs,STAKE_INSTRUCTION_LAYOUTS:()=>ys,SYSTEM_INSTRUCTION_LAYOUTS:()=>Fr,SYSVAR_CLOCK_PUBKEY:()=>Ar,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>Sr,SYSVAR_INSTRUCTIONS_PUBKEY:()=>Ir,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>xr,SYSVAR_RENT_PUBKEY:()=>Er,SYSVAR_REWARDS_PUBKEY:()=>Tr,SYSVAR_SLOT_HASHES_PUBKEY:()=>Pr,SYSVAR_SLOT_HISTORY_PUBKEY:()=>Br,SYSVAR_STAKE_HISTORY_PUBKEY:()=>Lr,Secp256k1Program:()=>ls,SendTransactionError:()=>ni,SolanaJSONRPCError:()=>ii,SolanaJSONRPCErrorCode:()=>ri,StakeAuthorizationLayout:()=>bs,StakeInstruction:()=>gs,StakeProgram:()=>ws,Struct:()=>Fn,SystemInstruction:()=>Yr,SystemProgram:()=>Wr,Transaction:()=>vr,TransactionExpiredBlockheightExceededError:()=>rr,TransactionExpiredNonceInvalidError:()=>or,TransactionExpiredTimeoutError:()=>ir,TransactionInstruction:()=>_r,TransactionMessage:()=>kr,TransactionStatus:()=>br,VALIDATOR_INFO_KEY:()=>Ss,VERSION_PREFIX_MASK:()=>er,VOTE_PROGRAM_ID:()=>Es,ValidatorInfo:()=>xs,VersionedMessage:()=>yr,VersionedTransaction:()=>Mr,VoteAccount:()=>Ps,VoteAuthorizationLayout:()=>Ms,VoteInit:()=>_s,VoteInstruction:()=>vs,VoteProgram:()=>As,clusterApiUrl:()=>Os,sendAndConfirmRawTransaction:()=>Ds,sendAndConfirmTransaction:()=>$r});var r={};n.r(r),n.d(r,{dQ:()=>rt,ci:()=>K,bytesToNumberBE:()=>X,ty:()=>J,eV:()=>nt,n$:()=>st,ql:()=>et,hexToBytes:()=>Z,_t:()=>W,tL:()=>Q,S5:()=>tt,FF:()=>ut});var i=n(48764);function o(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function s(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}const u="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function c(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const d=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),l=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function h(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function f(t){if("string"==typeof t&&(t=h(t)),!c(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function p(...t){let e=0;for(let n=0;nt().update(f(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function y(t=32){if(u&&"function"==typeof u.getRandomValues)return u.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class b extends m{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=d(this.buffer)}update(t){a(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=f(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const u=d(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t>_&w)}:{h:0|Number(t>>_&w),l:0|Number(t&w)}}const k=function(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it>>>n,A=(t,e,n)=>t<<32-n|e>>>n,S=(t,e,n)=>t>>>n|e<<32-n,I=(t,e,n)=>t<<32-n|e>>>n,x=(t,e,n)=>t<<64-n|e>>>n-32,E=(t,e,n)=>t>>>n-32|e<<64-n,T=function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},P=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),B=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,L=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),$=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,R=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,O=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0),[D,C]=(()=>k(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),N=new Uint32Array(80),z=new Uint32Array(80);class U extends b{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)N[n]=t.getUint32(e),z[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|N[t-15],n=0|z[t-15],r=S(e,n,1)^S(e,n,8)^M(e,n,7),i=I(e,n,1)^I(e,n,8)^A(e,n,7),o=0|N[t-2],s=0|z[t-2],a=S(o,s,19)^x(o,s,61)^M(o,s,6),u=I(o,s,19)^E(o,s,61)^A(o,s,6),c=L(i,u,z[t-7],z[t-16]),d=$(c,r,a,N[t-7],N[t-16]);N[t]=0|d,z[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=S(d,l,14)^S(d,l,18)^x(d,l,41),b=I(d,l,14)^I(d,l,18)^E(d,l,41),w=d&h^~d&p,_=O(y,b,l&f^~l&m,C[t],z[t]),v=R(_,g,e,w,D[t],N[t]),k=0|_,M=S(n,r,28)^x(n,r,34)^x(n,r,39),A=I(n,r,28)^E(n,r,34)^E(n,r,39),L=n&i^n&s^i&s,$=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|d,f=0|l,({h:d,l}=T(0|u,0|c,0|v,0|k)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const U=P(k,A,$);n=B(U,v,M,L),r=0|U}({h:n,l:r}=T(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=T(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=T(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=T(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=T(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=T(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=T(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=T(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y)}roundClean(){N.fill(0),z.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const j=g((()=>new U)),Y=(BigInt(0),BigInt(1)),F=BigInt(2);function W(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const H=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function K(t){if(!W(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n=V._0&&t<=V._9?t-V._0:t>=V._A&&t<=V._F?t-(V._A-10):t>=V._a&&t<=V._f?t-(V._a-10):void 0}function Z(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(F<new Uint8Array(t),ot=t=>Uint8Array.from(t);function st(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=it(t),i=it(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=it())=>{i=a(ot([0]),t),r=a(),0!==t.length&&(i=a(ot([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const at={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||W(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function ut(t,e,n={}){const r=(e,n,r)=>{const i=at[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const ct=BigInt(0),dt=BigInt(1),lt=BigInt(2),ht=BigInt(3),ft=BigInt(4),pt=BigInt(5),mt=BigInt(8);function gt(t,e){const n=t%e;return n>=ct?n:e+n}function yt(t,e,n){if(n<=ct||e 0");if(n===dt)return ct;let r=dt;for(;e>ct;)e&dt&&(r=r*t%n),t=t*t%n,e>>=dt;return r}function bt(t,e,n){let r=t;for(;e-- >ct;)r*=r,r%=n;return r}function wt(t,e){if(t===ct||e<=ct)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=gt(t,e),r=e,i=ct,o=dt,s=dt,a=ct;for(;n!==ct;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==dt)throw new Error("invert: does not exist");return gt(i,e)}BigInt(9),BigInt(16);const _t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function vt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function kt(t,e,n=!1,r={}){if(t<=ct)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=vt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%ft===ht){const e=(t+dt)/ft;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%mt===pt){const e=(t-pt)/mt;return function(t,n){const r=t.mul(n,lt),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,lt),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-dt)/lt;let n,r,i;for(n=t-dt,r=0;n%lt===ct;n/=lt,r++);for(i=lt;igt(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return ct<=e&&et===ct,isOdd:t=>(t&dt)===dt,neg:e=>gt(-e,t),eql:(t,e)=>t===e,sqr:e=>gt(e*e,t),add:(e,n)=>gt(e+n,t),sub:(e,n)=>gt(e-n,t),mul:(e,n)=>gt(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===ct)return t.ONE;if(n===dt)return e;let r=t.ONE,i=e;for(;n>ct;)n&dt&&(r=t.mul(r,i)),i=t.sqr(i),n>>=dt;return r}(a,t,e),div:(e,n)=>gt(e*wt(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>wt(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?tt(t,o):Q(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?J(t):X(t)}});return Object.freeze(a)}function Mt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function At(t){const e=Mt(t);return e+Math.ceil(e/2)}const St=BigInt(0),It=BigInt(1);function xt(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>St;)n&It&&(r=r.add(i)),i=i.double(),n>>=It;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=It);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function Et(t){return ut(t.Fp,_t.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),ut(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...vt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const Tt=BigInt(0),Pt=BigInt(1),Bt=BigInt(2),Lt=BigInt(8),$t={zip215:!0};function Rt(t){const e=function(t){const e=Et(t);return ut(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=Bt<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:Tt}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&Ttp(t)&&p(e)&&tt===Tt||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===Tt?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,Pt,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(Bt*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===Tt)return this.double();const r=d(s*Bt*h),f=d(a*Bt*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===Tt?M:this.equals(M)||e===Pt?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?Lt:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:Tt,y:Pt};if(u!==Pt)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===Pt?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=et("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=J(a);h===Tt||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-Pt),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&Pt)===Pt,_=0!=(128&u);if(!r&&b===Tt&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return x(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=tt(e,n.BYTES);return r[r.length-1]|=t&Pt?128:0,r}toHex(){return K(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,Pt,d(e.Gx*e.Gy)),v.ZERO=new v(Tt,Pt,Pt,Tt);const{BASE:k,ZERO:M}=v,A=xt(v,8*a);function S(t){return gt(t,r)}function I(t){return S(J(t))}function x(t){const e=a;t=et("private key",t,e);const n=et("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function E(t=new Uint8Array,...e){const n=nt(...e);return I(o(f(n,et("context",t),!!i)))}const T=$t;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return x(t).pointBytes},sign:function(t,e,r={}){t=et("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=x(e),c=E(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+E(r.context,d,u,t)*s);return b(l),et("result",nt(d,tt(l,n.BYTES)),2*a)},verify:function(t,e,r,o=T){const{context:s,zip215:a}=o,u=n.BYTES;t=et("signature",t,2*u),e=et("message",e),i&&(e=i(e));const c=J(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=E(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const Ot=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Dt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Ct=(BigInt(0),BigInt(1)),Nt=BigInt(2),zt=BigInt(5),Ut=BigInt(10),jt=BigInt(20),Yt=BigInt(40),Ft=BigInt(80);const Wt=kt(Ot,void 0,!0),Ht={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Wt,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:j,randomBytes:y,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=Ot,r=gt(e*e*e,n),i=gt(r*r*e,n);let o=gt(t*r*function(t){const e=Ot,n=t*t%e*t%e,r=bt(n,Nt,e)*n%e,i=bt(r,Ct,e)*t%e,o=bt(i,zt,e)*i%e,s=bt(o,Ut,e)*o%e,a=bt(s,jt,e)*s%e,u=bt(a,Yt,e)*a%e,c=bt(u,Ft,e)*u%e,d=bt(c,Ft,e)*u%e,l=bt(d,Ut,e)*o%e;return{pow_p_5_8:bt(l,Nt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=gt(e*o*o,n),a=o,u=gt(o*Dt,n),c=s===t,d=s===gt(-t,n),l=s===gt(-t*Dt,n);return c&&(o=a),(d||l)&&(o=u),(gt(o,n)&dt)===dt&&(o=gt(-o,n)),{isValid:c||d,value:o}}},Kt=Rt(Ht);const qt=(Wt.ORDER+BigInt(3))/BigInt(8);Wt.pow(Nt,qt),Wt.sqrt(Wt.neg(Wt.ONE)),Wt.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(Wt,Wt.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Vt=n(13550),Gt=n.n(Vt),Zt=n(77191),Xt=n.n(Zt);function Jt(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Qt(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function te(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ee(t,e){Qt(t);const n=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),re=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function ie(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),!((e=t)instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name))throw new Error("expected Uint8Array, got "+typeof t);var e;return t}class oe{clone(){return this._cloneInto()}}function se(t){const e=e=>t().update(ie(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}class ae extends oe{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ne(this.buffer)}update(t){te(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=ie(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=ne(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;tt&e^t&n^e&n,ce=new Uint32Array([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]),de=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),le=new Uint32Array(64);class he extends ae{constructor(){super(64,32,8,!1),this.A=0|de[0],this.B=0|de[1],this.C=0|de[2],this.D=0|de[3],this.E=0|de[4],this.F=0|de[5],this.G=0|de[6],this.H=0|de[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)le[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=le[t-15],n=le[t-2],r=re(e,7)^re(e,18)^e>>>3,i=re(n,17)^re(n,19)^n>>>10;le[t]=i+le[t-7]+r+le[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(re(s,6)^re(s,11)^re(s,25))+((d=s)&a^~d&u)+ce[t]+le[t]|0,l=(re(n,2)^re(n,13)^re(n,22))+ue(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){le.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const fe=se((()=>new he));var pe=n(25532),me=n(39386),ge=n(40475);class ye extends TypeError{constructor(t,e){let n;const{message:r,...i}=t,{path:o}=t;super(0===o.length?r:"At path: "+o.join(".")+" -- "+r),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[t,...e()]}}}function be(t){return"object"==typeof t&&null!=t}function we(t){return"string"==typeof t?JSON.stringify(t):""+t}function _e(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:o}=e,{type:s}=n,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+we(r)+"`"}=t;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:u}}function*ve(t,e,n,r){var i;be(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]);for(const i of t){const t=_e(i,e,n,r);t&&(yield t)}}function*ke(t,e,n={}){const{path:r=[],branch:i=[t],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(t=e.coercer(t,a),s&&"type"!==e.type&&be(e.schema)&&be(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let u=!0;for(const n of e.validator(t,a))u=!1,yield[n,void 0];for(let[n,c,d]of e.entries(t,a)){const e=ke(c,d,{path:void 0===n?r:[...r,n],branch:void 0===n?i:[...i,c],coerce:o,mask:s});for(const r of e)r[0]?(u=!1,yield[r[0],void 0]):o&&(c=r[1],void 0===n?t=c:t instanceof Map?t.set(n,c):t instanceof Set?t.add(c):be(t)&&(t[n]=c))}if(u)for(const n of e.refiner(t,a))u=!1,yield[n,void 0];u&&(yield[void 0,t])}class Me{constructor(t){const{type:e,schema:n,validator:r,refiner:i,coercer:o=(t=>t),entries:s=function*(){}}=t;this.type=e,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(t,e)=>ve(r(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>ve(i(t,e),e,this,t):()=>[]}assert(t){return Ae(t,this)}create(t){return Se(t,this)}is(t){return Ie(t,this)}mask(t){return function(t,e){const n=xe(t,e,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(t,this)}validate(t,e={}){return xe(t,this,e)}}function Ae(t,e){const n=xe(t,e);if(n[0])throw n[0]}function Se(t,e){const n=xe(t,e,{coerce:!0});if(n[0])throw n[0];return n[1]}function Ie(t,e){return!xe(t,e)[0]}function xe(t,e,n={}){const r=ke(t,e,n),i=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(r);return i[0]?[new ye(i[0],(function*(){for(const t of r)t[0]&&(yield t[0])})),void 0]:[void 0,i[1]]}function Ee(t,e){return new Me({type:t,schema:null,validator:e})}function Te(t){return new Me({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+we(t)})}function Pe(){return Ee("boolean",(t=>"boolean"==typeof t))}function Be(t){return Ee("instance",(e=>e instanceof t||"Expected a `"+t.name+"` instance, but received: "+we(e)))}function Le(t){const e=we(t),n=typeof t;return new Me({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||"Expected the literal `"+e+"`, but received: "+we(n)})}function $e(t){return new Me({...t,validator:(e,n)=>null===e||t.validator(e,n),refiner:(e,n)=>null===e||t.refiner(e,n)})}function Re(){return Ee("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+we(t)))}function Oe(t){return new Me({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function De(t,e){return new Me({type:"record",schema:null,*entries(n){if(be(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:t=>be(t)||"Expected an object, but received: "+we(t)})}function Ce(){return Ee("string",(t=>"string"==typeof t||"Expected a string, but received: "+we(t)))}function Ne(t){const e=Ee("never",(()=>!1));return new Me({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(t.length,n.length);for(let i=0;iArray.isArray(t)||"Expected an array, but received: "+we(t)})}function ze(t){const e=Object.keys(t);return new Me({type:"type",schema:t,*entries(n){if(be(n))for(const r of e)yield[r,n[r],t[r]]},validator:t=>be(t)||"Expected an object, but received: "+we(t)})}function Ue(t){const e=t.map((t=>t.type)).join(" | ");return new Me({type:"union",schema:null,validator(n,r){const i=[];for(const e of t){const[...t]=ke(n,e,r),[o]=t;if(!o[0])return[];for(const[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+we(n),...i]}})}function je(){return Ee("unknown",(()=>!0))}function Ye(t,e,n){return new Me({...t,coercer:(r,i)=>Ie(r,e)?t.coercer(n(r,i),i):t.coercer(r,i)})}var Fe=n(31198),We=n.n(Fe),He=n(80158),Ke=n(16916);const qe=BigInt(2**32-1),Ve=BigInt(32);function Ge(t,e=!1){return e?{h:Number(t&qe),l:Number(t>>Ve&qe)}:{h:0|Number(t>>Ve&qe),l:0|Number(t&qe)}}function Ze(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i>rn)*sn)%on,e&nn&&(i^=en<<(en<n>32?((t,e,n)=>e<>>64-n)(t,e,n):((t,e,n)=>t<>>32-n)(t,e,n),dn=(t,e,n)=>n>32?((t,e,n)=>t<>>64-n)(t,e,n):((t,e,n)=>e<>>32-n)(t,e,n);class ln extends oe{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Jt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=cn(o,s,1)^n[r],u=dn(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=Je[n],o=cn(e,i,r),s=dn(e,i,r),a=Xe[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=an[r],t[1]^=un[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){te(this);const{blockLen:e,state:n}=this,r=(t=ie(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Jt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ee(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new ln(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const hn=((t,e,n)=>se((()=>new ln(e,t,n))))(1,136,32),fn=(t,e,n)=>t&e^t&n^e&n,pn=new Uint32Array([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]),mn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gn=new Uint32Array(64);class yn extends b{constructor(){super(64,32,8,!1),this.A=0|mn[0],this.B=0|mn[1],this.C=0|mn[2],this.D=0|mn[3],this.E=0|mn[4],this.F=0|mn[5],this.G=0|mn[6],this.H=0|mn[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)gn[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=gn[t-15],n=gn[t-2],r=l(e,7)^l(e,18)^e>>>3,i=l(n,17)^l(n,19)^n>>>10;gn[t]=i+gn[t-7]+r+gn[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(l(s,6)^l(s,11)^l(s,25))+((d=s)&a^~d&u)+pn[t]+gn[t]|0,h=(l(n,2)^l(n,13)^l(n,22))+fn(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+h|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){gn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const bn=g((()=>new yn));class wn extends m{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(t.outputLen),o(t.blockLen)}(t);const n=f(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew wn(t,e).update(n).digest();_n.create=(t,e)=>new wn(t,e);const{bytesToNumberBE:vn,hexToBytes:kn}=r,Mn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=Mn;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:vn(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Mn,n="string"==typeof t?kn(t):t;if(!W(n))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=Mn._parseInt(n.subarray(2)),{d:s,l:a}=Mn._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},An=BigInt(0),Sn=BigInt(1),In=(BigInt(2),BigInt(3));function xn(t){const e=function(t){const e=Et(t);return ut(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return gt(t,r)}function a(t){return wt(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=Et(t);ut(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return nt(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&Ann.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(et("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,In),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,In);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===An)return r;if(a(t),t===Sn)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>An||c>An;)s&Sn&&(d=d.add(p)),c&Sn&&(h=h.add(p)),p=p.double(),s>>=Sn,c>>=Sn;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==An&&e!==Sn&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Sn)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Sn?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return K(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=xt(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=nt;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=X(s);if(!(An<(a=t)&&aK(Q(t,e.nByteLength));function f(t){return t>r>>Sn}const p=(t,e,n)=>X(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=et("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=Mn.toSig(et("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(et("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return Z(this.toDERHex())}toDERHex(){return Mn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Z(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=At(e.n);return function(t,e,n=!1){const r=t.length,i=Mt(e),o=At(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=gt(n?X(t):J(t),e-dt)+dt;return n?tt(s,i):Q(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=W(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=X(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=rt(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(An<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Q(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=et("msgHash",t),p&&(t=et("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g){const t=!0===g?d(n.BYTES):g;M.push(et("extraEntropy",t))}const A=nt(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===An)return;const o=s(n*s(S+i*_));if(o===An)return;let c=(r.x===i?0:2)|Number(r.y&Sn),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return st(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=et("msgHash",n),r=et("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||W(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof Mn.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function En(t){return{hash:t,hmac:(e,...n)=>_n(t,e,p(...n)),randomBytes:y}}BigInt(4);const Tn=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Pn=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Bn=BigInt(1),Ln=BigInt(2),$n=(t,e)=>(t+e/Ln)/e;const Rn=kt(Tn,void 0,void 0,{sqrt:function(t){const e=Tn,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=bt(d,n,e)*d%e,h=bt(l,n,e)*d%e,f=bt(h,Ln,e)*c%e,p=bt(f,i,e)*f%e,m=bt(p,o,e)*p%e,g=bt(m,a,e)*m%e,y=bt(g,u,e)*g%e,b=bt(y,a,e)*m%e,w=bt(b,n,e)*d%e,_=bt(w,s,e)*p%e,v=bt(_,r,e)*c%e,k=bt(v,Ln,e);if(!Rn.eql(Rn.sqr(k),t))throw new Error("Cannot find square root");return k}}),On=function(t,e){const n=e=>xn({...t,...En(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Rn,n:Pn,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Pn,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Bn*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=$n(o*t,e),u=$n(-r*t,e);let c=gt(t-a*n-u*i,e),d=gt(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},bn);BigInt(0),On.ProjectivePoint;const Dn=Kt.utils.randomPrivateKey,Cn=()=>{const t=Kt.utils.randomPrivateKey(),e=Nn(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},Nn=Kt.getPublicKey;function zn(t){try{return Kt.ExtendedPoint.fromHex(t),!0}catch{return!1}}const Un=(t,e)=>Kt.sign(t,e.slice(0,32)),jn=Kt.verify,Yn=t=>i.Buffer.isBuffer(t)?t:t instanceof Uint8Array?i.Buffer.from(t.buffer,t.byteOffset,t.byteLength):i.Buffer.from(t);class Fn{constructor(t){Object.assign(this,t)}encode(){return i.Buffer.from((0,pe.serialize)(Hn,this))}static decode(t){return(0,pe.deserialize)(Hn,this,t)}static decodeUnchecked(t){return(0,pe.deserializeUnchecked)(Hn,this,t)}}class Wn extends Fn{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}}const Hn=new Map;var Kn;let qn;const Vn=32,Gn=32;let Zn=1;qn=Symbol.toStringTag;class Xn extends Fn{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Xt().decode(t);if(e.length!=Gn)throw new Error("Invalid public key input");this._bn=new(Gt())(e)}else this._bn=new(Gt())(t);if(this._bn.byteLength()>Gn)throw new Error("Invalid public key input")}}static unique(){const t=new Xn(Zn);return Zn+=1,new Xn(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Xt().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(i.Buffer);if(t.length===Gn)return t;const e=i.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[qn](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=i.Buffer.concat([t.toBuffer(),i.Buffer.from(e),n.toBuffer()]),o=fe(r);return new Xn(o)}static createProgramAddressSync(t,e){let n=i.Buffer.alloc(0);t.forEach((function(t){if(t.length>Vn)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Yn(t)])})),n=i.Buffer.concat([n,e.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=fe(n);if(zn(r))throw new Error("Invalid seeds, address must fall off the curve");return new Xn(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const o=t.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return zn(new Xn(t).toBytes())}}Kn=Xn,Xn.default=new Kn("11111111111111111111111111111111"),Hn.set(Xn,{kind:"struct",fields:[["_bn","u256"]]});class Jn{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=Yn(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Yn(Dn()),this._publicKey=Yn(Nn(this._secretKey))}get publicKey(){return new Xn(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const Qn=new Xn("BPFLoader1111111111111111111111111111111111"),tr=1232,er=127,nr=64;class rr extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(rr.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class ir extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(ir.prototype,"name",{value:"TransactionExpiredTimeoutError"});class or extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(or.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class sr{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const ar=(t="publicKey")=>me.blob(32,t),ur=(t="signature")=>me.blob(64,t),cr=(t="string")=>{const e=me.struct([me.u32("length"),me.u32("lengthPadding"),me.blob(me.offset(me.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),o=e;return o.decode=(t,e)=>n(t,e).chars.toString(),o.encode=(t,e,n)=>{const o={chars:i.Buffer.from(t,"utf8")};return r(o,e,n)},o.alloc=t=>me.u32().span+me.u32().span+i.Buffer.from(t,"utf8").length,o};function dr(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return dr({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function lr(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function hr(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function fr(t,e){if(!t)throw new Error(e||"Assertion failed")}class pr{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new pr(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];fr(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{fr(e.length>0,"Expected at least one writable signer key");const[t]=e[0];fr(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Xn(t))),...n.map((([t])=>new Xn(t))),...r.map((([t])=>new Xn(t))),...i.map((([t])=>new Xn(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Xn(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(fr(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}class mr{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Xn(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Xt().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new sr(this.staticAccountKeys)}static compile(t){const e=pr.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new sr(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Xt().encode(t.data)})));return new mr({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];hr(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Xt().decode(t.data));let o=[];hr(o,e.length);let s=[];return hr(s,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:e,dataLength:i.Buffer.from(s),data:r}}));let r=[];hr(r,n.length);let o=i.Buffer.alloc(tr);i.Buffer.from(r).copy(o);let s=r.length;n.forEach((t=>{const e=me.struct([me.u8("programIdIndex"),me.blob(t.keyIndicesCount.length,"keyIndicesCount"),me.seq(me.u8("keyIndex"),t.keyIndices.length,"keyIndices"),me.blob(t.dataLength.length,"dataLength"),me.seq(me.u8("userdatum"),t.data.length,"data")]).encode(t,o,s);s+=e})),o=o.slice(0,s);const a=me.struct([me.blob(1,"numRequiredSignatures"),me.blob(1,"numReadonlySignedAccounts"),me.blob(1,"numReadonlyUnsignedAccounts"),me.blob(e.length,"keyCount"),me.seq(ar("key"),t,"keys"),ar("recentBlockhash")]),u={numRequiredSignatures:i.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:i.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:i.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:i.Buffer.from(e),keys:this.accountKeys.map((t=>Yn(t.toBytes()))),recentBlockhash:Xt().decode(this.recentBlockhash)};let c=i.Buffer.alloc(2048);const d=a.encode(u,c);return o.copy(c,d),c.slice(0,d+o.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&er))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=e.shift(),o=e.shift(),s=lr(e);let a=[];for(let t=0;t0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new sr(this.staticAccountKeys,e)}isAccountSigner(t){return t=n?t-nt+e.writableIndexes.length),0):t>=this.header.numRequiredSignatures?t-et.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const t of n.writableIndexes){if(!(tt.toBytes())),recentBlockhash:Xt().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let t=0;const e=new Uint8Array(tr);for(const n of this.compiledInstructions){const r=Array();hr(r,n.accountKeyIndexes.length);const i=Array();hr(i,n.data.length),t+=me.struct([me.u8("programIdIndex"),me.blob(r.length,"encodedAccountKeyIndexesLength"),me.seq(me.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),me.blob(i.length,"encodedDataLength"),me.blob(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(tr);for(const n of this.addressTableLookups){const r=Array();hr(r,n.writableIndexes.length);const i=Array();hr(i,n.readonlyIndexes.length),t+=me.struct([ar("accountKey"),me.blob(r.length,"encodedWritableIndexesLength"),me.seq(me.u8(),n.writableIndexes.length,"writableIndexes"),me.blob(i.length,"encodedReadonlyIndexesLength"),me.seq(me.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),r=n&er;fr(n!==r,"Expected versioned message but received legacy message"),fr(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},o=[],s=lr(e);for(let t=0;t{const e=yr.deserializeMessageVersion(t);if("legacy"===e)return mr.from(t);if(0===e)return gr.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let br=function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t}({});const wr=i.Buffer.alloc(nr).fill(0);class _r{constructor(t){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class vr{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new _r(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Xn(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Xt().encode(e)}}));return f.forEach((t=>{fr(t.programIdIndex>=0),t.accounts.forEach((t=>fr(t>=0)))})),new mr({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=Un(n,t.secretKey);this._addSignature(t.publicKey,Yn(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){fr(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=i.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):jn(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];hr(n,e.length);const r=n.length+64*e.length+t.length,o=i.Buffer.alloc(r);return fr(e.length<256),i.Buffer.from(n).copy(o,0),e.forEach((({signature:t},e)=>{null!==t&&(fr(64===t.length,"signature has invalid length"),i.Buffer.from(t).copy(o,n.length+64*e))})),t.copy(o,n.length+64*e.length),fr(o.length<=tr,`Transaction too large: ${o.length} > ${tr}`),o}get keys(){return fr(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return fr(1===this.instructions.length),this.instructions[0].programId}get data(){return fr(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=lr(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Xt().encode(wr)?null:Xt().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new _r({keys:r,programId:t.accountKeys[e.programIdIndex],data:Xt().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}class kr{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:r,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;fr(u>0,"Message header is invalid");const c=t.staticAccountKeys.length-o-a;fr(c>=0,"Message header is invalid");const d=t.getAccountKeys(e),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const t of r){const e=[];for(const r of t.accountKeyIndexes){const t=d.get(r);if(void 0===t)throw new Error(`Failed to find key for account key index ${r}`);let i;i=rt.equals(r.publicKey)));fr(t>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[t]=Un(e,r.secretKey)}}addSignature(t,e){fr(64===e.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((e=>e.equals(t)));fr(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const Ar=new Xn("SysvarC1ock11111111111111111111111111111111"),Sr=new Xn("SysvarEpochSchedu1e111111111111111111111111"),Ir=new Xn("Sysvar1nstructions1111111111111111111111111"),xr=new Xn("SysvarRecentB1ockHashes11111111111111111111"),Er=new Xn("SysvarRent111111111111111111111111111111111"),Tr=new Xn("SysvarRewards111111111111111111111111111111"),Pr=new Xn("SysvarS1otHashes111111111111111111111111111"),Br=new Xn("SysvarS1otHistory11111111111111111111111111"),Lr=new Xn("SysvarStakeHistory1111111111111111111111111");async function $r(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function Rr(t){return new Promise((e=>setTimeout(e,t)))}function Or(t,e){const n=t.layout.span>=0?t.layout.span:dr(t,e),r=i.Buffer.alloc(n),o=Object.assign({instruction:t.index},e);return t.layout.encode(o,r),r}function Dr(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const Cr=me.nu64("lamportsPerSignature"),Nr=me.struct([me.u32("version"),me.u32("state"),ar("authorizedPubkey"),ar("nonce"),me.struct([Cr],"feeCalculator")]),zr=Nr.span;class Ur{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=Nr.decode(Yn(t),0);return new Ur({authorizedPubkey:new Xn(e.authorizedPubkey),nonce:new Xn(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const jr=(8,t=>{const e=(0,me.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return(0,ge.toBigIntLE)(i.Buffer.from(n))},o.encode=(t,e,r)=>{const i=(0,ge.toBufferLE)(t,8);return n(i,e,r)},o});class Yr{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Fr))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=Dr(Fr.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new Xn(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=Dr(Fr.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=Dr(Fr.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new Xn(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=Dr(Fr.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=Dr(Fr.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Xn(e),seed:n,space:r,programId:new Xn(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=Dr(Fr.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new Xn(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=Dr(Fr.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Xn(e),seed:n,programId:new Xn(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=Dr(Fr.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new Xn(e),seed:n,lamports:r,space:i,programId:new Xn(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=Dr(Fr.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new Xn(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Dr(Fr.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Dr(Fr.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=Dr(Fr.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new Xn(e)}}static checkProgramId(t){if(!t.equals(Wr.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length0?i:1,space:o.length,programId:r}));null!==a&&await $r(t,a,[e,n],{commitment:"confirmed"})}const s=me.struct([me.u32("instruction"),me.u32("offset"),me.u32("bytesLength"),me.u32("bytesLengthPadding"),me.seq(me.u8("byte"),me.offset(me.u32(),-8),"bytes")]),a=Kr.chunkSize;let u=0,c=o,d=[];for(;c.length>0;){const o=c.slice(0,a),l=i.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:o,bytesLength:0,bytesLengthPadding:0},l);const h=(new vr).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push($r(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await Rr(1e3/t)}u+=a,c=c.slice(a)}await Promise.all(d);{const o=me.struct([me.u32("instruction")]),s=i.Buffer.alloc(o.span);o.encode({instruction:1},s);const a=(new vr).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Er,isSigner:!1,isWritable:!1}],programId:r,data:s}),u="processed",c=await t.sendTransaction(a,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}Kr.chunkSize=Hr;const qr=new Xn("BPFLoader2111111111111111111111111111111111");class Vr{static getMinNumSignatures(t){return Kr.getMinNumSignatures(t)}static load(t,e,n,r,i){return Kr.load(t,e,n,i,r)}}function Gr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Zr=Object.prototype.toString,Xr=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function Jr(t,e){var n,r,i,o,s,a,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return Jr(t.toJSON(),e);if("[object Array]"===(u=Zr.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=Jr(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Xr(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}class ei{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32)))-ti(32)-1;return[n,t-(this.getSlotsInEpoch(n)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}var e}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const n=(0,Ke.Z)(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in n?n.socket:n,n}),t,e,n),this.underlyingSocket=void 0}call(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class ai{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${t.index}`);return n}(ui,t),n=t.length-56;fr(n>=0,"lookup table is invalid"),fr(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=me.struct([me.seq(ar(),r,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new Xn(e.authority[0]):void 0,addresses:i.map((t=>new Xn(t)))}}}const ui={index:1,layout:me.struct([me.u32("typeIndex"),jr("deactivationSlot"),me.nu64("lastExtendedSlot"),me.u8("lastExtendedStartIndex"),me.u8(),me.seq(ar(),me.offset(me.u8(),-1),"authority")])},ci=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,di=Ye(Be(Xn),Ce(),(t=>new Xn(t))),li=Ne([Ce(),Le("base64")]),hi=Ye(Be(i.Buffer),li,(t=>i.Buffer.from(t[0],"base64"))),fi=3e4;function pi(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function mi(t){return Ue([ze({jsonrpc:Le("2.0"),id:Ce(),result:t}),ze({jsonrpc:Le("2.0"),id:Ce(),error:ze({code:je(),message:Ce(),data:Oe(Ee("any",(()=>!0)))})})])}const gi=mi(je());function yi(t){return Ye(mi(t),gi,(e=>"error"in e?e:{...e,result:Se(e.result,t)}))}function bi(t){return yi(ze({context:ze({slot:Re()}),value:t}))}function wi(t){return ze({context:ze({slot:Re()}),value:t})}function _i(t,e){return 0===t?new gr({header:e.header,staticAccountKeys:e.accountKeys.map((t=>new Xn(t))),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Xt().decode(t.data)}))),addressTableLookups:e.addressTableLookups}):new mr(e)}const vi=ze({foundation:Re(),foundationTerm:Re(),initial:Re(),taper:Re(),terminal:Re()}),ki=yi(Te($e(ze({epoch:Re(),effectiveSlot:Re(),amount:Re(),postBalance:Re(),commission:Oe($e(Re()))})))),Mi=Te(ze({slot:Re(),prioritizationFee:Re()})),Ai=ze({total:Re(),validator:Re(),foundation:Re(),epoch:Re()}),Si=ze({epoch:Re(),slotIndex:Re(),slotsInEpoch:Re(),absoluteSlot:Re(),blockHeight:Oe(Re()),transactionCount:Oe(Re())}),Ii=ze({slotsPerEpoch:Re(),leaderScheduleSlotOffset:Re(),warmup:Pe(),firstNormalEpoch:Re(),firstNormalSlot:Re()}),xi=De(Ce(),Te(Re())),Ei=$e(Ue([ze({}),Ce()])),Ti=ze({err:Ei}),Pi=Le("receivedSignature"),Bi=ze({"solana-core":Ce(),"feature-set":Oe(Re())}),Li=bi(ze({err:$e(Ue([ze({}),Ce()])),logs:$e(Te(Ce())),accounts:Oe($e(Te($e(ze({executable:Pe(),owner:Ce(),lamports:Re(),data:Te(Ce()),rentEpoch:Oe(Re())}))))),unitsConsumed:Oe(Re()),returnData:Oe($e(ze({programId:Ce(),data:Ne([Ce(),Le("base64")])})))})),$i=bi(ze({byIdentity:De(Ce(),Te(Re())),range:ze({firstSlot:Re(),lastSlot:Re()})})),Ri=yi(vi),Oi=yi(Ai),Di=yi(Mi),Ci=yi(Si),Ni=yi(Ii),zi=yi(xi),Ui=yi(Re()),ji=bi(ze({total:Re(),circulating:Re(),nonCirculating:Re(),nonCirculatingAccounts:Te(di)})),Yi=ze({amount:Ce(),uiAmount:$e(Re()),decimals:Re(),uiAmountString:Oe(Ce())}),Fi=bi(Te(ze({address:di,amount:Ce(),uiAmount:$e(Re()),decimals:Re(),uiAmountString:Oe(Ce())}))),Wi=bi(Te(ze({pubkey:di,account:ze({executable:Pe(),owner:di,lamports:Re(),data:hi,rentEpoch:Re()})}))),Hi=ze({program:Ce(),parsed:je(),space:Re()}),Ki=bi(Te(ze({pubkey:di,account:ze({executable:Pe(),owner:di,lamports:Re(),data:Hi,rentEpoch:Re()})}))),qi=bi(Te(ze({lamports:Re(),address:di}))),Vi=ze({executable:Pe(),owner:di,lamports:Re(),data:hi,rentEpoch:Re()}),Gi=ze({pubkey:di,account:Vi}),Zi=Ye(Ue([Be(i.Buffer),Hi]),Ue([li,Hi]),(t=>Array.isArray(t)?Se(t,hi):t)),Xi=ze({executable:Pe(),owner:di,lamports:Re(),data:Zi,rentEpoch:Re()}),Ji=ze({pubkey:di,account:Xi}),Qi=ze({state:Ue([Le("active"),Le("inactive"),Le("activating"),Le("deactivating")]),active:Re(),inactive:Re()}),to=yi(Te(ze({signature:Ce(),slot:Re(),err:Ei,memo:$e(Ce()),blockTime:Oe($e(Re()))}))),eo=yi(Te(ze({signature:Ce(),slot:Re(),err:Ei,memo:$e(Ce()),blockTime:Oe($e(Re()))}))),no=ze({subscription:Re(),result:wi(Vi)}),ro=ze({pubkey:di,account:Vi}),io=ze({subscription:Re(),result:wi(ro)}),oo=ze({parent:Re(),slot:Re(),root:Re()}),so=ze({subscription:Re(),result:oo}),ao=Ue([ze({type:Ue([Le("firstShredReceived"),Le("completed"),Le("optimisticConfirmation"),Le("root")]),slot:Re(),timestamp:Re()}),ze({type:Le("createdBank"),parent:Re(),slot:Re(),timestamp:Re()}),ze({type:Le("frozen"),slot:Re(),timestamp:Re(),stats:ze({numTransactionEntries:Re(),numSuccessfulTransactions:Re(),numFailedTransactions:Re(),maxTransactionsPerEntry:Re()})}),ze({type:Le("dead"),slot:Re(),timestamp:Re(),err:Ce()})]),uo=ze({subscription:Re(),result:ao}),co=ze({subscription:Re(),result:wi(Ue([Ti,Pi]))}),lo=ze({subscription:Re(),result:Re()}),ho=ze({pubkey:Ce(),gossip:$e(Ce()),tpu:$e(Ce()),rpc:$e(Ce()),version:$e(Ce())}),fo=ze({votePubkey:Ce(),nodePubkey:Ce(),activatedStake:Re(),epochVoteAccount:Pe(),epochCredits:Te(Ne([Re(),Re(),Re()])),commission:Re(),lastVote:Re(),rootSlot:$e(Re())}),po=yi(ze({current:Te(fo),delinquent:Te(fo)})),mo=Ue([Le("processed"),Le("confirmed"),Le("finalized")]),go=ze({slot:Re(),confirmations:$e(Re()),err:Ei,confirmationStatus:Oe(mo)}),yo=bi(Te($e(go))),bo=yi(Re()),wo=ze({accountKey:di,writableIndexes:Te(Re()),readonlyIndexes:Te(Re())}),_o=ze({signatures:Te(Ce()),message:ze({accountKeys:Te(Ce()),header:ze({numRequiredSignatures:Re(),numReadonlySignedAccounts:Re(),numReadonlyUnsignedAccounts:Re()}),instructions:Te(ze({accounts:Te(Re()),data:Ce(),programIdIndex:Re()})),recentBlockhash:Ce(),addressTableLookups:Oe(Te(wo))})}),vo=ze({pubkey:di,signer:Pe(),writable:Pe(),source:Oe(Ue([Le("transaction"),Le("lookupTable")]))}),ko=ze({accountKeys:Te(vo),signatures:Te(Ce())}),Mo=ze({parsed:je(),program:Ce(),programId:di}),Ao=ze({accounts:Te(di),data:Ce(),programId:di}),So=Ye(Ue([Ao,Mo]),Ue([ze({parsed:je(),program:Ce(),programId:Ce()}),ze({accounts:Te(Ce()),data:Ce(),programId:Ce()})]),(t=>Se(t,"accounts"in t?Ao:Mo))),Io=ze({signatures:Te(Ce()),message:ze({accountKeys:Te(vo),instructions:Te(So),recentBlockhash:Ce(),addressTableLookups:Oe($e(Te(wo)))})}),xo=ze({accountIndex:Re(),mint:Ce(),owner:Oe(Ce()),uiTokenAmount:Yi}),Eo=ze({writable:Te(di),readonly:Te(di)}),To=ze({err:Ei,fee:Re(),innerInstructions:Oe($e(Te(ze({index:Re(),instructions:Te(ze({accounts:Te(Re()),data:Ce(),programIdIndex:Re()}))})))),preBalances:Te(Re()),postBalances:Te(Re()),logMessages:Oe($e(Te(Ce()))),preTokenBalances:Oe($e(Te(xo))),postTokenBalances:Oe($e(Te(xo))),loadedAddresses:Oe(Eo),computeUnitsConsumed:Oe(Re())}),Po=ze({err:Ei,fee:Re(),innerInstructions:Oe($e(Te(ze({index:Re(),instructions:Te(So)})))),preBalances:Te(Re()),postBalances:Te(Re()),logMessages:Oe($e(Te(Ce()))),preTokenBalances:Oe($e(Te(xo))),postTokenBalances:Oe($e(Te(xo))),loadedAddresses:Oe(Eo),computeUnitsConsumed:Oe(Re())}),Bo=Ue([Le(0),Le("legacy")]),Lo=ze({pubkey:Ce(),lamports:Re(),postBalance:$e(Re()),rewardType:$e(Ce()),commission:Oe($e(Re()))}),$o=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:_o,meta:$e(To),version:Oe(Bo)})),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),Ro=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),Oo=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:ko,meta:$e(To),version:Oe(Bo)})),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),Do=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:Io,meta:$e(Po),version:Oe(Bo)})),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),Co=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:ko,meta:$e(Po),version:Oe(Bo)})),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),No=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),zo=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:_o,meta:$e(To)})),rewards:Oe(Te(Lo)),blockTime:$e(Re())}))),Uo=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),signatures:Te(Ce()),blockTime:$e(Re())}))),jo=yi($e(ze({slot:Re(),meta:$e(To),blockTime:Oe($e(Re())),transaction:_o,version:Oe(Bo)}))),Yo=yi($e(ze({slot:Re(),transaction:Io,meta:$e(Po),blockTime:Oe($e(Re())),version:Oe(Bo)}))),Fo=bi(ze({blockhash:Ce(),feeCalculator:ze({lamportsPerSignature:Re()})})),Wo=bi(ze({blockhash:Ce(),lastValidBlockHeight:Re()})),Ho=bi(Pe()),Ko=yi(Te(ze({slot:Re(),numTransactions:Re(),numSlots:Re(),samplePeriodSecs:Re()}))),qo=bi($e(ze({feeCalculator:ze({lamportsPerSignature:Re()})}))),Vo=yi(Ce()),Go=yi(Ce()),Zo=ze({err:Ei,logs:Te(Ce()),signature:Ce()}),Xo=ze({result:wi(Zo),subscription:Re()}),Jo={"solana-client":"js/0.0.0-development"};class Qo{constructor(t,e){let n,r,i,o,s,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const t={};return async e=>{const{commitment:n,config:r}=pi(e),i=this._buildArgs([],n,void 0,r),o=Qr(i);return t[o]=t[o]??(async()=>{try{const t=Se(await this._rpcRequest("getBlockHeight",i),yi(Re()));if("error"in t)throw new ii(t.error,"failed to get block height information");return t.result}finally{delete t[o]}})(),await t[o]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,n=e.wsEndpoint,r=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=n||function(t){const e=t.match(ci);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);const[n,r,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(t),this._rpcClient=function(t,e,n,r,i,o){const s=n||oi;let a;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(t,e)=>{const n=await new Promise(((n,i)=>{try{r(t,e,((t,e)=>n([t,e])))}catch(t){i(t)}}));return await s(...n)}),new(We())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},Jo)};try{let e,n=5,u=500;for(;e=a?await a(t,o):await s(t,o),429===e.status&&!0!==i&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await Rr(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{})}(t,r,i,o,s,a),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new si(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=Se(await this._rpcRequest("getBalance",i),bi(Re()));if("error"in o)throw new ii(o.error,`failed to get balance for ${t.toBase58()}`);return o.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=Se(await this._rpcRequest("getBlockTime",[t]),yi($e(Re())));if("error"in e)throw new ii(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){const t=Se(await this._rpcRequest("minimumLedgerSlot",[]),yi(Re()));if("error"in t)throw new ii(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){const t=Se(await this._rpcRequest("getFirstAvailableBlock",[]),Ui);if("error"in t)throw new ii(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=Se(await this._rpcRequest("getSupply",[e]),ji);if("error"in n)throw new ii(n.error,"failed to get supply");return n.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=Se(await this._rpcRequest("getTokenSupply",n),bi(Yi));if("error"in r)throw new ii(r.error,"failed to get token supply");return r.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=Se(await this._rpcRequest("getTokenAccountBalance",n),bi(Yi));if("error"in r)throw new ii(r.error,"failed to get token account balance");return r.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=pi(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=Se(await this._rpcRequest("getTokenAccountsByOwner",s),Wi);if("error"in a)throw new ii(a.error,`failed to get token accounts owned by account ${t.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=Se(await this._rpcRequest("getTokenAccountsByOwner",i),Ki);if("error"in o)throw new ii(o.error,`failed to get token accounts owned by account ${t.toBase58()}`);return o.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=Se(await this._rpcRequest("getLargestAccounts",n),qi);if("error"in r)throw new ii(r.error,"failed to get largest accounts");return r.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=Se(await this._rpcRequest("getTokenLargestAccounts",n),Fi);if("error"in r)throw new ii(r.error,"failed to get token largest accounts");return r.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=Se(await this._rpcRequest("getAccountInfo",i),bi($e(Vi)));if("error"in o)throw new ii(o.error,`failed to get info about account ${t.toBase58()}`);return o.result}async getParsedAccountInfo(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=Se(await this._rpcRequest("getAccountInfo",i),bi($e(Xi)));if("error"in o)throw new ii(o.error,`failed to get info about account ${t.toBase58()}`);return o.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){const{commitment:n,config:r}=pi(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=Se(await this._rpcRequest("getMultipleAccounts",o),bi(Te($e(Xi))));if("error"in s)throw new ii(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=pi(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),s=Se(await this._rpcRequest("getMultipleAccounts",o),bi(Te($e(Vi))));if("error"in s)throw new ii(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=pi(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),s=Se(await this._rpcRequest("getStakeActivation",o),yi(Qi));if("error"in s)throw new ii(s.error,`failed to get Stake Activation ${t.toBase58()}`);return s.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=pi(e),{encoding:i,...o}=r||{},s=this._buildArgs([t.toBase58()],n,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=Te(Gi),c=!0===o.withContext?Se(a,bi(u)):Se(a,yi(u));if("error"in c)throw new ii(c.error,`failed to get accounts owned by program ${t.toBase58()}`);return c.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=Se(await this._rpcRequest("getProgramAccounts",i),yi(Te(Ji)));if("error"in o)throw new ii(o.error,`failed to get accounts owned by program ${t.toBase58()}`);return o.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{const e=t;if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);n=e.signature}try{r=Xt().decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}return fr(64===r.length,"signature has invalid length"),"string"==typeof t?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise(((e,n)=>{null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(()=>{n(t.reason)})))}))}getTransactionConfirmationPromise({commitment:t,signature:e}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,s)=>{try{n=this.onSignature(e,((t,e)=>{n=void 0;const r={context:e,value:t};o({__type:br.PROCESSED,response:r})}),t);const a=new Promise((t=>{null==n?t():r=this._onSubscriptionStateChange(n,(e=>{"subscribed"===e&&t()}))}));(async()=>{if(await a,i)return;const n=await this.getSignatureStatus(e);if(i)return;if(null==n)return;const{context:r,value:u}=n;if(null!=u)if(u?.err)s(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,o({__type:br.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((e=>{const r=async()=>{try{return await this.getBlockHeight(t)}catch(t){return-1}};(async()=>{let t=await r();if(!i){for(;t<=n;){if(await Rr(1e3),i)return;if(t=await r(),i)return}e({__type:br.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:t,signature:r}),u=this.getCancellationPromise(e);let c;try{const t=await Promise.race([u,a,o]);if(t.__type!==br.PROCESSED)throw new rr(r);c=t.response}finally{i=!0,s()}return c}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let s=!1;const a=new Promise((e=>{let o=i,a=null;const u=async()=>{try{const{context:e,value:i}=await this.getNonceAndContext(r,{commitment:t,minContextSlot:n});return a=e.slot,i?.nonce}catch(t){return o}};(async()=>{if(o=await u(),!s)for(;;){if(i!==o)return void e({__type:br.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await Rr(2e3),s)return;if(o=await u(),s)return}})()})),{abortConfirmation:u,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(e);let l;try{const e=await Promise.race([d,c,a]);if(e.__type===br.PROCESSED)l=e.response;else{let r;for(;;){const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(e.slotInWhichNonceDidAdvance??n))){r=t;break}await Rr(400)}if(!r?.value)throw new or(o);{const e=t||"finalized",{confirmationStatus:n}=r.value;switch(e){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new or(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new or(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new or(o)}l={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,u()}return l}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let n;const r=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>e({__type:br.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});let s;try{const t=await Promise.race([o,r]);if(t.__type!==br.PROCESSED)throw new ir(e,t.timeoutMs/1e3);s=t.response}finally{clearTimeout(n),i()}return s}async getClusterNodes(){const t=Se(await this._rpcRequest("getClusterNodes",[]),yi(Te(ho)));if("error"in t)throw new ii(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=Se(await this._rpcRequest("getVoteAccounts",e),po);if("error"in n)throw new ii(n.error,"failed to get vote accounts");return n.result}async getSlot(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getSlot",r),yi(Re()));if("error"in i)throw new ii(i.error,"failed to get slot");return i.result}async getSlotLeader(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getSlotLeader",r),yi(Ce()));if("error"in i)throw new ii(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(t,e){const n=[t,e],r=Se(await this._rpcRequest("getSlotLeaders",n),yi(Te(di)));if("error"in r)throw new ii(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);return fr(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=Se(await this._rpcRequest("getSignatureStatuses",n),yo);if("error"in r)throw new ii(r.error,"failed to get signature status");return r.result}async getTransactionCount(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getTransactionCount",r),yi(Re()));if("error"in i)throw new ii(i.error,"failed to get transaction count");return i.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=Se(await this._rpcRequest("getInflationGovernor",e),Ri);if("error"in n)throw new ii(n.error,"failed to get inflation");return n.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=pi(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:i?.epoch}),s=Se(await this._rpcRequest("getInflationReward",o),ki);if("error"in s)throw new ii(s.error,"failed to get inflation reward");return s.result}async getInflationRate(){const t=Se(await this._rpcRequest("getInflationRate",[]),Oi);if("error"in t)throw new ii(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getEpochInfo",r),Ci);if("error"in i)throw new ii(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const t=Se(await this._rpcRequest("getEpochSchedule",[]),Ni);if("error"in t)throw new ii(t.error,"failed to get epoch schedule");const e=t.result;return new ei(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){const t=Se(await this._rpcRequest("getLeaderSchedule",[]),zi);if("error"in t)throw new ii(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=Se(await this._rpcRequest("getMinimumBalanceForRentExemption",n),bo);return"error"in r?(console.warn("Unable to fetch minimum balance for rent exemption"),0):r.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=Se(await this._rpcRequest("getRecentBlockhash",e),Fo);if("error"in n)throw new ii(n.error,"failed to get recent blockhash");return n.result}async getRecentPerformanceSamples(t){const e=Se(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),Ko);if("error"in e)throw new ii(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=Se(await this._rpcRequest("getFeeCalculatorForBlockhash",n),qo);if("error"in r)throw new ii(r.error,"failed to get fee calculator");const{context:i,value:o}=r.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(t,e){const n=Yn(t.serialize()).toString("base64"),r=this._buildArgs([n],e),i=Se(await this._rpcRequest("getFeeForMessage",r),bi($e(Re())));if("error"in i)throw new ii(i.error,"failed to get fee for message");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentPrioritizationFees(t){const e=t?.lockedWritableAccounts?.map((t=>t.toBase58())),n=e?.length?[e]:[],r=Se(await this._rpcRequest("getRecentPrioritizationFees",n),Di);if("error"in r)throw new ii(r.error,"failed to get recent prioritization fees");return r.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getLatestBlockhash",r),Wo);if("error"in i)throw new ii(i.error,"failed to get latest blockhash");return i.result}async isBlockhashValid(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t],n,void 0,r),o=Se(await this._rpcRequest("isBlockhashValid",i),Ho);if("error"in o)throw new ii(o.error,"failed to determine if the blockhash `"+t+"`is valid");return o.result}async getVersion(){const t=Se(await this._rpcRequest("getVersion",[]),yi(Bi));if("error"in t)throw new ii(t.error,"failed to get version");return t.result}async getGenesisHash(){const t=Se(await this._rpcRequest("getGenesisHash",[]),yi(Ce()));if("error"in t)throw new ii(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=Se(o,Oo);if("error"in t)throw t.error;return t.result}case"none":{const t=Se(o,Ro);if("error"in t)throw t.error;return t.result}default:{const t=Se(o,$o);if("error"in t)throw t.error;const{result:e}=t;return e?{...e,transactions:e.transactions.map((({transaction:t,meta:e,version:n})=>({meta:e,transaction:{...t,message:_i(n,t.message)},version:n})))}:null}}}catch(t){throw new ii(t,"failed to get confirmed block")}}async getParsedBlock(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=Se(o,Co);if("error"in t)throw t.error;return t.result}case"none":{const t=Se(o,No);if("error"in t)throw t.error;return t.result}default:{const t=Se(o,Do);if("error"in t)throw t.error;return t.result}}}catch(t){throw new ii(t,"failed to get block")}}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=Se(await this._rpcRequest("getBlockProduction",r),$i);if("error"in i)throw new ii(i.error,"failed to get block production information");return i.result}async getTransaction(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=Se(await this._rpcRequest("getTransaction",i),jo);if("error"in o)throw new ii(o.error,"failed to get transaction");const s=o.result;return s?{...s,transaction:{...s.transaction,message:_i(s.version,s.transaction.message)}}:s}async getParsedTransaction(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=Se(await this._rpcRequest("getTransaction",i),Yo);if("error"in o)throw new ii(o.error,"failed to get transaction");return o.result}async getParsedTransactions(t,e){const{commitment:n,config:r}=pi(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=Se(t,Yo);if("error"in e)throw new ii(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const{commitment:n,config:r}=pi(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=Se(t,jo);if("error"in e)throw new ii(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:_i(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=Se(await this._rpcRequest("getConfirmedBlock",n),zo);if("error"in r)throw new ii(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");const o={...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new mr(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...o,transactions:o.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:vr.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=Se(await this._rpcRequest("getBlocks",r),yi(Te(Re())));if("error"in i)throw new ii(i.error,"failed to get blocks");return i.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=Se(await this._rpcRequest("getBlock",n),Uo);if("error"in r)throw new ii(r.error,"failed to get block");const i=r.result;if(!i)throw new Error("Block "+t+" not found");return i}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=Se(await this._rpcRequest("getConfirmedBlock",n),Uo);if("error"in r)throw new ii(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");return i}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=Se(await this._rpcRequest("getConfirmedTransaction",n),jo);if("error"in r)throw new ii(r.error,"failed to get transaction");const i=r.result;if(!i)return i;const o=new mr(i.transaction.message),s=i.transaction.signatures;return{...i,transaction:vr.populate(o,s)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=Se(await this._rpcRequest("getConfirmedTransaction",n),Yo);if("error"in r)throw new ii(r.error,"failed to get confirmed transaction");return r.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=Se(t,Yo);if("error"in e)throw new ii(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=Se(await this._rpcRequest("getConfirmedSignaturesForAddress2",r),to);if("error"in i)throw new ii(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=Se(await this._rpcRequest("getSignaturesForAddress",r),eo);if("error"in i)throw new ii(i.error,"failed to get signatures for address");return i.result}async getAddressLookupTable(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=new ai({key:t,state:ai.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=Ur.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=Se(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),Vo);if("error"in n)throw new ii(n.error,`airdrop to ${t.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await Rr(100);const t=Date.now()-this._blockhashInfo.lastFetch>=fi;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await Rr(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,"base64",n),i=Se(await this._rpcRequest("getStakeMinimumDelegation",r),bi(Re()));if("error"in i)throw new ii(i.error,"failed to get stake minimum delegation");return i.result}async simulateTransaction(t,e,n){if("message"in t){const r=t.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(e)||void 0!==n)throw new Error("Invalid arguments");const s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment);const a=[o,s],u=Se(await this._rpcRequest("simulateTransaction",a),Li);if("error"in u)throw new Error("failed to simulate transaction: "+u.error.message);return u.result}let r;if(t instanceof vr){let e=t;r=new vr,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=vr.populate(t),r._message=r._json=void 0;if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid arguments");const o=e;if(r.nonceInfo&&o)r.sign(...o);else{let t=this._disableBlockhashCaching;for(;;){const e=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=e.lastValidBlockHeight,r.recentBlockhash=e.blockhash,!o)break;if(r.sign(...o),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}t=!0}}const s=r._compile(),a=s.serialize(),u=r._serialize(a).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:s.nonProgramIds()).map((t=>t.toBase58()));c.accounts={encoding:"base64",addresses:t}}o&&(c.sigVerify=!0);const d=[u,c],l=Se(await this._rpcRequest("simulateTransaction",d),Li);if("error"in l){let t;if("data"in l.error&&(t=l.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(l.error.message,n)}throw new ni("failed to simulate transaction: "+l.error.message,t)}return l.result}async sendTransaction(t,e,n){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const n=t.serialize();return await this.sendRawTransaction(n,e)}if(void 0===e||!Array.isArray(e))throw new Error("Invalid arguments");const r=e;if(t.nonceInfo)t.sign(...r);else{let e=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(e);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...r),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}e=!0}}const i=t.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(t,e){const n=Yn(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],s=Se(await this._rpcRequest("sendTransaction",o),Go);if("error"in s){let t;throw"data"in s.error&&(t=s.error.data.logs),new ni("failed to send transaction: "+s.error.message,t)}return s.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(t,e){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,n!==e.state){const n=this._subscriptionStateChangeCallbacksByHash[t];n&&n.forEach((t=>{try{t(e.state)}catch{}}))}}_onSubscriptionStateChange(t,e){const n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(e),()=>{r.delete(e),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const e=await this._rpcWebSocket.call(i,r);this._setSubscription(t,{...n,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=Se(t,no);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=Qr([t.method,e],!0),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];fr(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=Se(t,io);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=Se(t,Xo);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=Se(t,so);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=Se(t,uo);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=Se(t,co);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),s=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=Se(t,lo);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class ts{constructor(t){this._keypair=void 0,this._keypair=t??Cn()}static generate(){return new ts(Cn())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=Nn(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new ts({publicKey:n,secretKey:t})}static fromSeed(t){const e=Nn(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new ts({publicKey:e,secretKey:n})}get publicKey(){return new Xn(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const es=Object.freeze({CreateLookupTable:{index:0,layout:me.struct([me.u32("instruction"),jr("recentSlot"),me.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:me.struct([me.u32("instruction")])},ExtendLookupTable:{index:2,layout:me.struct([me.u32("instruction"),jr(),me.seq(ar(),me.offset(me.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:me.struct([me.u32("instruction")])},CloseLookupTable:{index:4,layout:me.struct([me.u32("instruction")])}});class ns{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(es))if(r.index==e){n=t;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);const{recentSlot:e}=Dr(es.CreateLookupTable,t.data);return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error(`invalid instruction; found ${t.keys.length} keys, expected at least 2`);const{addresses:e}=Dr(es.ExtendLookupTable,t.data);return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((t=>new Xn(t)))}}static decodeCloseLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}static decodeFreezeLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static decodeDeactivateLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(rs.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(t,e){if(t.lengtht.toBytes()))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Wr.programId,isSigner:!1,isWritable:!1}),new _r({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=Or(es.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new _r({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=Or(es.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new _r({programId:this.programId,keys:n,data:e})}}rs.programId=new Xn("AddressLookupTab1e1111111111111111111111111");class is{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u8("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(os))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=Dr(os.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=Dr(os.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=Dr(os.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=Dr(os.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(ss.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const os=Object.freeze({RequestUnits:{index:0,layout:me.struct([me.u8("instruction"),me.u32("units"),me.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:me.struct([me.u8("instruction"),me.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:me.struct([me.u8("instruction"),me.u32("units")])},SetComputeUnitPrice:{index:3,layout:me.struct([me.u8("instruction"),jr("microLamports")])}});class ss{constructor(){}static requestUnits(t){const e=Or(os.RequestUnits,t);return new _r({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=Or(os.RequestHeapFrame,t);return new _r({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=Or(os.SetComputeUnitLimit,t);return new _r({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=Or(os.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new _r({keys:[],programId:this.programId,data:e})}}ss.programId=new Xn("ComputeBudget111111111111111111111111111111");const as=me.struct([me.u8("numSignatures"),me.u8("padding"),me.u16("signatureOffset"),me.u16("signatureInstructionIndex"),me.u16("publicKeyOffset"),me.u16("publicKeyInstructionIndex"),me.u16("messageDataOffset"),me.u16("messageDataSize"),me.u16("messageInstructionIndex")]);class us{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:o}=t;fr(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),fr(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const s=as.span,a=s+e.length,u=a+r.length,c=i.Buffer.alloc(u+n.length),d=null==o?65535:o;return as.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,s),c.fill(r,a),c.fill(n,u),new _r({keys:[],programId:us.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;fr(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=ts.fromSecretKey(e),i=t.publicKey.toBytes(),o=Un(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}us.programId=new Xn("Ed25519SigVerify111111111111111111111111111"),On.utils.isValidPrivateKey;const cs=On.getPublicKey,ds=me.struct([me.u8("numSignatures"),me.u16("signatureOffset"),me.u8("signatureInstructionIndex"),me.u16("ethAddressOffset"),me.u8("ethAddressInstructionIndex"),me.u16("messageDataOffset"),me.u16("messageDataSize"),me.u8("messageInstructionIndex"),me.blob(20,"ethAddress"),me.blob(64,"signature"),me.u8("recoveryId")]);class ls{constructor(){}static publicKeyToEthAddress(t){fr(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return i.Buffer.from(hn(Yn(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return ls.createInstructionWithEthAddress({ethAddress:ls.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:o,instructionIndex:s=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?i.Buffer.from(e.substr(2),"hex"):i.Buffer.from(e,"hex"):e,fr(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,c=u+r.length+1,d=i.Buffer.alloc(ds.span+n.length);return ds.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:s,signature:Yn(r),ethAddress:Yn(a),recoveryId:o},d),d.fill(Yn(n),ds.span),new _r({keys:[],programId:ls.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;fr(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=Yn(e),o=cs(t,!1).slice(1),s=i.Buffer.from(hn(Yn(n))),[a,u]=((t,e)=>{const n=On.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(s,t);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var hs;ls.programId=new Xn("KeccakSecp256k11111111111111111111111111111");const fs=new Xn("StakeConfig11111111111111111111111111111111");class ps{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class ms{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}hs=ms,ms.default=new hs(0,0,Xn.default);class gs{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ys))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=Dr(ys.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new ps(new Xn(e.staker),new Xn(e.withdrawer)),lockup:new ms(n.unixTimestamp,n.epoch,new Xn(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),Dr(ys.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=Dr(ys.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Xn(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Dr(ys.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new Xn(i),newAuthorizedPubkey:new Xn(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Dr(ys.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Dr(ys.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Dr(ys.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Dr(ys.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(ws.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.lengthme.struct([ar("staker"),ar("withdrawer")],t))(),((t="lockup")=>me.struct([me.ns64("unixTimestamp"),me.ns64("epoch"),ar("custodian")],t))()])},Authorize:{index:1,layout:me.struct([me.u32("instruction"),ar("newAuthorized"),me.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:me.struct([me.u32("instruction")])},Split:{index:3,layout:me.struct([me.u32("instruction"),me.ns64("lamports")])},Withdraw:{index:4,layout:me.struct([me.u32("instruction"),me.ns64("lamports")])},Deactivate:{index:5,layout:me.struct([me.u32("instruction")])},Merge:{index:7,layout:me.struct([me.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:me.struct([me.u32("instruction"),ar("newAuthorized"),me.u32("stakeAuthorizationType"),cr("authoritySeed"),ar("authorityOwner")])}}),bs=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class ws{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||ms.default,o=Or(ys.Initialize,{authorized:{staker:Yn(n.staker.toBuffer()),withdrawer:Yn(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Yn(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Er,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new _r(s)}static createAccountWithSeed(t){const e=new vr;e.add(Wr.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new vr;e.add(Wr.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=Or(ys.Delegate);return(new vr).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:Lr,isSigner:!1,isWritable:!1},{pubkey:fs,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=Or(ys.Authorize,{newAuthorized:Yn(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new vr).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=Or(ys.AuthorizeWithSeed,{newAuthorized:Yn(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:Yn(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:Ar,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new vr).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=Or(ys.Split,{lamports:i});return new _r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new vr;return e.add(Wr.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:s}=t,a=new vr;return a.add(Wr.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),a.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:s}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=Or(ys.Merge);return(new vr).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:Lr,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=Or(ys.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:Lr,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new vr).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=Or(ys.Deactivate);return(new vr).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}ws.programId=new Xn("Stake11111111111111111111111111111111111111"),ws.space=200;class _s{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}class vs{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ks))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=Dr(ks.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new _s(new Xn(e.nodePubkey),new Xn(e.authorizedVoter),new Xn(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=Dr(ks.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Xn(e),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:e,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Dr(ks.AuthorizeWithSeed,t.data);return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new Xn(e),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new Xn(r),voteAuthorizationType:{index:i},votePubkey:t.keys[0].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Dr(ks.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(As.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.lengthme.struct([ar("nodePubkey"),ar("authorizedVoter"),ar("authorizedWithdrawer"),me.u8("commission")],t))()])},Authorize:{index:1,layout:me.struct([me.u32("instruction"),ar("newAuthorized"),me.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:me.struct([me.u32("instruction"),me.ns64("lamports")])},AuthorizeWithSeed:{index:10,layout:me.struct([me.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>me.struct([me.u32("voteAuthorizationType"),ar("currentAuthorityDerivedKeyOwnerPubkey"),cr("currentAuthorityDerivedKeySeed"),ar("newAuthorized")],t))()])}}),Ms=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class As{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=Or(ks.InitializeAccount,{voteInit:{nodePubkey:Yn(r.nodePubkey.toBuffer()),authorizedVoter:Yn(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Yn(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Er,isSigner:!1,isWritable:!1},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new _r(o)}static createAccount(t){const e=new vr;return e.add(Wr.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=Or(ks.Authorize,{newAuthorized:Yn(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new vr).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=Or(ks.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Yn(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Yn(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new vr).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=Or(ks.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new vr).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return As.withdraw(t)}}As.programId=new Xn("Vote111111111111111111111111111111111111111"),As.space=3731;const Ss=new Xn("Va1idator1nfo111111111111111111111111111111"),Is=ze({name:Ce(),website:Oe(Ce()),details:Oe(Ce()),keybaseUsername:Oe(Ce())});class xs{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==lr(e))return null;const n=[];for(let t=0;t<2;t++){const t=new Xn(e.slice(0,Gn));e=e.slice(Gn);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(Ss)&&n[1].isSigner){const t=cr().decode(i.Buffer.from(e)),r=JSON.parse(t);return Ae(r,Is),new xs(n[1].publicKey,r)}return null}}const Es=new Xn("Vote111111111111111111111111111111111111111"),Ts=me.struct([ar("nodePubkey"),ar("authorizedWithdrawer"),me.u8("commission"),me.nu64(),me.seq(me.struct([me.nu64("slot"),me.u32("confirmationCount")]),me.offset(me.u32(),-8),"votes"),me.u8("rootSlotValid"),me.nu64("rootSlot"),me.nu64(),me.seq(me.struct([me.nu64("epoch"),ar("authorizedVoter")]),me.offset(me.u32(),-8),"authorizedVoters"),me.struct([me.seq(me.struct([ar("authorizedPubkey"),me.nu64("epochOfLastAuthorizedSwitch"),me.nu64("targetEpoch")]),32,"buf"),me.nu64("idx"),me.u8("isEmpty")],"priorVoters"),me.nu64(),me.seq(me.struct([me.nu64("epoch"),me.nu64("credits"),me.nu64("prevCredits")]),me.offset(me.u32(),-8),"epochCredits"),me.struct([me.nu64("slot"),me.nu64("timestamp")],"lastTimestamp")]);class Ps{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=Ts.decode(Yn(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Ps({nodePubkey:new Xn(e.nodePubkey),authorizedWithdrawer:new Xn(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(Bs),priorVoters:$s(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function Bs({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new Xn(t)}}function Ls({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new Xn(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function $s({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(Ls),...t.slice(0,e).map(Ls)]}const Rs={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Os(t,e){const n=!1===e?"http":"https";if(!t)return Rs[n].devnet;const r=Rs[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r}async function Ds(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await t.sendRawTransaction(e,s),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(a,u),d=(await c).value;if(d.err)throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`);return a}const Cs=1e9},80158:(t,e,n)=>{"use strict";var r=n(48764).Buffer,i=n(64836);e.Z=void 0;var o=i(n(64687)),s=i(n(17156)),a=i(n(18698)),u=i(n(56690)),c=i(n(89728)),d=i(n(61655)),l=i(n(94993)),h=i(n(73808)),f=n(26729),p=n(52742);var m=function(t){(0,d.default)(b,t);var e,n,i,f,m,g,y=(m=b,g=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=(0,h.default)(m);if(g){var n=(0,h.default)(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return(0,l.default)(this,t)});function b(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;(0,u.default)(this,b);var s=r.autoconnect,a=void 0===s||s,c=r.reconnect,d=void 0===c||c,l=r.reconnect_interval,h=void 0===l?1e3:l,f=r.max_reconnects,m=void 0===f?5:f,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);in.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),b}(f.EventEmitter);e.Z=m},16916:(t,e,n)=>{"use strict";var r=n(64836);e.Z=function(t,e){return new c(t,e)};var i=r(n(56690)),o=r(n(89728)),s=r(n(61655)),a=r(n(94993)),u=r(n(73808));var c=function(t){(0,s.default)(c,t);var e,n,r=(e=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=(0,u.default)(e);if(n){var i=(0,u.default)(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return(0,a.default)(this,t)});function c(t,e,n){var o;return(0,i.default)(this,c),(o=r.call(this)).socket=new window.WebSocket(t,n),o.socket.onopen=function(){return o.emit("open")},o.socket.onmessage=function(t){return o.emit("message",t.data)},o.socket.onerror=function(t){return o.emit("error",t)},o.socket.onclose=function(t){o.emit("close",t.code,t.reason)},o}return(0,o.default)(c,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),c}(n(26729).EventEmitter)},52742:(t,e,n)=>{"use strict";var r=n(64836);Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDataPack=void 0,e.createError=function(t,e){var n={code:t,message:s.get(t)||"Internal Server Error"};return e&&(n.data=e),n};var i=r(n(56690)),o=r(n(89728)),s=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),a=function(){function t(){(0,i.default)(this,t)}return(0,o.default)(t,[{key:"encode",value:function(t){return JSON.stringify(t)}},{key:"decode",value:function(t){return JSON.parse(t)}}]),t}();e.DefaultDataPack=a},27320:(t,e)=>{"use strict";function n(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function r(t){if("boolean"!=typeof t)throw new Error(`boolean expected, not ${t}`)}function i(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}function o(t,...e){if(!i(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function s(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");n(t.outputLen),n(t.blockLen)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){o(t);const n=e.outputLen;if(t.length{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HashMD=e.Maj=e.Chi=void 0;const r=n(27320),i=n(98089);e.Chi=(t,e,n)=>t&e^~t&n,e.Maj=(t,e,n)=>t&e^t&n^e&n;class o extends i.Hash{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.createView)(this.buffer)}update(t){(0,r.exists)(this);const{view:e,buffer:n,blockLen:o}=this,s=(t=(0,i.toBytes)(t)).length;for(let r=0;ro-a&&(this.process(n,0),a=0);for(let t=a;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,o-8,BigInt(8*this.length),s),this.process(n,0);const u=(0,i.createView)(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,l=this.get();if(d>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},23061:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const r=n(75457),i=n(98089),o=new Uint32Array([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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class u extends r.HashMD{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)a[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=a[t-15],n=a[t-2],r=(0,i.rotr)(e,7)^(0,i.rotr)(e,18)^e>>>3,o=(0,i.rotr)(n,17)^(0,i.rotr)(n,19)^n>>>10;a[t]=o+a[t-7]+r+a[t-16]|0}let{A:n,B:s,C:u,D:c,E:d,F:l,G:h,H:f}=this;for(let t=0;t<64;t++){const e=f+((0,i.rotr)(d,6)^(0,i.rotr)(d,11)^(0,i.rotr)(d,25))+(0,r.Chi)(d,l,h)+o[t]+a[t]|0,p=((0,i.rotr)(n,2)^(0,i.rotr)(n,13)^(0,i.rotr)(n,22))+(0,r.Maj)(n,s,u)|0;f=h,h=l,l=d,d=c+e|0,c=u,u=s,s=n,n=e+p|0}n=n+this.A|0,s=s+this.B|0,u=u+this.C|0,c=c+this.D|0,d=d+this.E|0,l=l+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(n,s,u,c,d,l,h,f)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class c extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}e.sha256=(0,i.wrapConstructor)((()=>new u)),e.sha224=(0,i.wrapConstructor)((()=>new c))},98089:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const r=n(31945),i=n(27320);e.isBytes=function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name},e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),e.rotr=(t,e)=>t<<32-e|t>>>e,e.rotl=(t,e)=>t<>>32-e>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.byteSwap=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,e.byteSwapIfBE=e.isLE?t=>t:t=>(0,e.byteSwap)(t),e.byteSwap32=function(t){for(let n=0;ne.toString(16).padStart(2,"0")));e.bytesToHex=function(t){(0,i.bytes)(t);let e="";for(let n=0;n=s&&t<=a?t-s:t>=u&&t<=c?t-(u-10):t>=d&&t<=l?t-(d-10):void 0}function f(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function p(t){return"string"==typeof t&&(t=f(t)),(0,i.bytes)(t),t}e.hexToBytes=function(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e{},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o=0&&tt().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e},e.wrapXOFConstructorWithOpts=function(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(r.crypto&&"function"==typeof r.crypto.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}},71794:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.constructRemoveRewardsIx=e.constructSetEmissionsPerSecondIx=e.constructHarvestIx=e.constructRevertTokensIx=e.constructConvertTokensIx=e.constructInitUserFarmIx=e.constructInitGlobalFarmIx=e.getUserFarmAddress=e.fetchUserFarms=e.fetchGlobalFarms=e.UserFarm=e.GlobalFarm=e.Aquafarm=void 0;const a=s(n(19359));e.Aquafarm=a.default;const u=s(n(20880));e.GlobalFarm=u.default;const c=o(n(64097));e.UserFarm=c.default,Object.defineProperty(e,"getUserFarmAddress",{enumerable:!0,get:function(){return c.getUserFarmAddress}});const d=n(87990);Object.defineProperty(e,"fetchGlobalFarms",{enumerable:!0,get:function(){return d.fetchGlobalFarms}}),Object.defineProperty(e,"fetchUserFarms",{enumerable:!0,get:function(){return d.fetchUserFarms}});const l=n(59968);Object.defineProperty(e,"constructInitGlobalFarmIx",{enumerable:!0,get:function(){return l.constructInitGlobalFarmIx}}),Object.defineProperty(e,"constructInitUserFarmIx",{enumerable:!0,get:function(){return l.constructInitUserFarmIx}}),Object.defineProperty(e,"constructConvertTokensIx",{enumerable:!0,get:function(){return l.constructConvertTokensIx}}),Object.defineProperty(e,"constructRevertTokensIx",{enumerable:!0,get:function(){return l.constructRevertTokensIx}}),Object.defineProperty(e,"constructHarvestIx",{enumerable:!0,get:function(){return l.constructHarvestIx}}),Object.defineProperty(e,"constructSetEmissionsPerSecondIx",{enumerable:!0,get:function(){return l.constructSetEmissionsPerSecondIx}}),Object.defineProperty(e,"constructRemoveRewardsIx",{enumerable:!0,get:function(){return l.constructRemoveRewardsIx}})},59968:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.constructRemoveRewardsIx=e.constructSetEmissionsPerSecondIx=e.constructHarvestIx=e.constructRevertTokensIx=e.constructConvertTokensIx=e.constructInitUserFarmIx=e.constructInitGlobalFarmIx=e.INSTRUCTIONS=void 0;const i=n(86664),o=n(52454),s=n(61401),a=r(n(20698));var u;!function(t){t[t.InitGlobalFarm=0]="InitGlobalFarm",t[t.InitUserFarm=1]="InitUserFarm",t[t.ConvertTokens=2]="ConvertTokens",t[t.RevertTokens=3]="RevertTokens",t[t.Harvest=4]="Harvest",t[t.RemoveRewards=5]="RemoveRewards",t[t.SetEmissionsPerSecond=6]="SetEmissionsPerSecond"}(u=e.INSTRUCTIONS||(e.INSTRUCTIONS={})),e.constructInitGlobalFarmIx=function(t,e,n,r,a,c,d,l,h,f,p,m){const g=[{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:m,isSigner:!0,isWritable:!1},{pubkey:o.SystemProgram.programId,isSigner:!1,isWritable:!1}];return new o.TransactionInstruction({keys:g,programId:p,data:s.generateBufferData(s.INIT_GLOBAL_FARM_DATA_LAYOUT,{instruction:u.InitGlobalFarm,nonce:f,tokenProgramId:i.TOKEN_PROGRAM_ID.toBuffer(),emissionsAuthority:c.toBuffer(),removeRewardsAuthority:d.toBuffer(),emissionsPerSecondNumerator:l.toBuffer(),emissionsPerSecondDenominator:h.toBuffer()})})},e.constructInitUserFarmIx=function(t,e,n,r){const i=[{pubkey:t,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:o.SystemProgram.programId,isSigner:!1,isWritable:!1}];return new o.TransactionInstruction({keys:i,programId:r,data:s.generateBufferData(s.INIT_USER_FARM_DATA_LAYOUT,{instruction:u.InitUserFarm})})},e.constructConvertTokensIx=function(t,e,n,r,c,d,l,h,f,p,m,g,y){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!0,isWritable:!1},{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:m,isSigner:!1,isWritable:!1},{pubkey:i.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1}],programId:g,data:s.generateBufferData(a.default.struct([a.default.u8("instruction"),s.uint64("amountToConvert")]),{instruction:u.ConvertTokens,amountToConvert:y.toBuffer()})})},e.constructRevertTokensIx=function(t,e,n,r,c,d,l,h,f,p,m,g,y){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!0,isWritable:!1},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:m,isSigner:!1,isWritable:!1},{pubkey:i.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1}],programId:g,data:s.generateBufferData(a.default.struct([a.default.u8("instruction"),s.uint64("amountToRevert")]),{instruction:u.RevertTokens,amountToRevert:y.toBuffer()})})},e.constructHarvestIx=function(t,e,n,r,c,d,l,h){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:l,isSigner:!1,isWritable:!1},{pubkey:i.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1}],programId:h,data:s.generateBufferData(a.default.struct([a.default.u8("instruction")]),{instruction:u.Harvest})})},e.constructSetEmissionsPerSecondIx=function(t,e,n,r,i,c){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!0,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],programId:r,data:s.generateBufferData(a.default.struct([a.default.u8("instruction"),s.uint64("emissionsPerSecondNumerator"),s.uint64("emissionsPerSecondDenominator")]),{instruction:u.SetEmissionsPerSecond,emissionsPerSecondNumerator:s.u64ToBuffer(i),emissionsPerSecondDenominator:s.u64ToBuffer(c)})})},e.constructRemoveRewardsIx=function(t,e,n,r,c,d,l){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:i.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1}],programId:d,data:s.generateBufferData(a.default.struct([a.default.u8("instruction"),s.uint64("amountToRemove")]),{instruction:u.RemoveRewards,amountToRemove:l.toBuffer()})})}},19359:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=n(86664),o=r(n(93776)),s=n(71794),a=n(82657),u=n(59968);e.default=class{constructor(t,e,n){this.globalFarm=t,this.programId=e,this.userFarm=n}getEmissionsPer1000USDPerDay(t,e){return new o.default(this.globalFarm.emissionsPerSecondNumerator.toString()).mul(864e5).div(this.globalFarm.emissionsPerSecondDenominator.toString()).div(t).div(new o.default(10).pow(e))}getWeeklyEmissions(t){return new o.default(this.globalFarm.emissionsPerSecondNumerator.toString()).mul(604800).div(this.globalFarm.emissionsPerSecondDenominator.toString()).div(new o.default(10).pow(t))}getHarvestableAmount(){if(null===this.userFarm)return;const t=this.globalFarm.cumulativeEmissionsPerFarmToken.sub(this.userFarm.cumulativeEmissionsCheckpoint);return new i.u64(new o.default(this.userFarm.baseTokensConverted.toString()).mul(t).floor().toString())}getCurrentHarvestableAmount(t){const e=this.getHarvestableAmount();if(!e||this.globalFarm.emissionsPerSecondDenominator.eq(a.ZERO)||t.eq(a.ZERO))return e;const n=new i.u64(Date.now()/1e3).sub(this.globalFarm.lastUpdatedTimestamp);return this.globalFarm.emissionsPerSecondNumerator.mul(n).mul(this.userFarm.baseTokensConverted).div(this.globalFarm.emissionsPerSecondDenominator).div(t).add(e)}isUserFarmInitialized(){var t;return(null===(t=this.userFarm)||void 0===t?void 0:t.isInitialized)||!1}constructInitUserFarmIx(t,e){return u.constructInitUserFarmIx(this.globalFarm.publicKey,e,t,this.programId)}constructConvertTokensIx(t,e,n,r,i,o,s){var a,c;const d=(null===(a=this.userFarm)||void 0===a?void 0:a.owner)||s;return o=(null===(c=this.userFarm)||void 0===c?void 0:c.publicKey)||o,d&&o?u.constructConvertTokensIx(d,t,e,n,r,this.globalFarm.baseTokenVault,this.globalFarm.farmTokenMint,this.globalFarm.publicKey,o,this.globalFarm.rewardTokenVault,this.globalFarm.authority,this.programId,i):null}constructRevertTokensIx(t,e,n,r,i){return this.userFarm?s.constructRevertTokensIx(this.userFarm.owner,t,e,n,r,this.globalFarm.baseTokenVault,this.globalFarm.farmTokenMint,this.globalFarm.publicKey,this.userFarm.publicKey,this.globalFarm.rewardTokenVault,this.globalFarm.authority,this.programId,i):null}constructHarvestIx(t){return this.userFarm?u.constructHarvestIx(this.userFarm.owner,t,this.globalFarm.baseTokenVault,this.globalFarm.publicKey,this.userFarm.publicKey,this.globalFarm.rewardTokenVault,this.globalFarm.authority,this.programId):null}}},20880:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getGlobalFarmAddress=e.getAuthorityAndNonce=void 0;const i=n(52454),o=n(59968);e.default=class{constructor(t){this.publicKey=t.publicKey,this.isInitialized=t.isInitialized,this.tokenProgramId=t.publicKey,this.authority=t.authority,this.nonce=t.nonce,this.emissionsAuthority=t.emissionsAuthority,this.removeRewardsAuthority=t.removeRewardsAuthority,this.baseTokenMint=t.baseTokenMint,this.baseTokenVault=t.baseTokenVault,this.rewardTokenVault=t.rewardTokenVault,this.farmTokenMint=t.farmTokenMint,this.emissionsPerSecondNumerator=t.emissionsPerSecondNumerator,this.emissionsPerSecondDenominator=t.emissionsPerSecondDenominator,this.lastUpdatedTimestamp=t.lastUpdatedTimestamp,this.cumulativeEmissionsPerFarmToken=t.cumulativeEmissionsPerFarmToken}constructSetEmissionsPerSecondIx(t,e,n){return o.constructSetEmissionsPerSecondIx(this.emissionsAuthority,this.publicKey,this.baseTokenVault,n,t,e)}toString(){return JSON.stringify({publicKey:this.publicKey.toBase58(),isInitialized:this.isInitialized,authority:this.authority.toBase58(),nonce:this.nonce,tokenProgramId:this.tokenProgramId.toBase58(),emissionsAuthority:this.emissionsAuthority.toBase58(),removeRewardsAuthority:this.removeRewardsAuthority.toBase58(),baseTokenMint:this.baseTokenMint.toBase58(),baseTokenVault:this.baseTokenVault.toBase58(),rewardTokenVault:this.rewardTokenVault.toBase58(),farmTokenMint:this.farmTokenMint.toBase58(),emissionsPerSecondNumerator:this.emissionsPerSecondNumerator.toString(),emissionsPerSecondDenominator:this.emissionsPerSecondDenominator.toString(),lastUpdatedTimestamp:this.lastUpdatedTimestamp.toString(),cumulativeEmissionsPerFarmToken:this.cumulativeEmissionsPerFarmToken.toString()},null,2)}},e.getAuthorityAndNonce=function(t,e){return r(this,void 0,void 0,(function*(){return i.PublicKey.findProgramAddress([t.toBuffer()],e)}))},e.getGlobalFarmAddress=function(t,e,n,o,s){return r(this,void 0,void 0,(function*(){return i.PublicKey.findProgramAddress([t.toBuffer(),e.toBuffer(),n.toBuffer(),o.toBuffer()],s)}))}},64097:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getUserFarmAddress=void 0;const i=n(52454);e.default=class{constructor(t){this.publicKey=t.publicKey,this.isInitialized=t.isInitialized,this.owner=t.owner,this.baseTokensConverted=t.baseTokensConverted,this.cumulativeEmissionsCheckpoint=t.cumulativeEmissionsCheckpoint}toString(){return JSON.stringify({publicKey:this.publicKey.toBase58(),isInitialized:this.isInitialized,owner:this.owner.toBase58(),baseTokensConverted:this.baseTokensConverted.toString(),cumulativeEmissionsCheckpoint:this.cumulativeEmissionsCheckpoint.toString()},null,2)}},e.getUserFarmAddress=function(t,e,n,o){return r(this,void 0,void 0,(function*(){return i.PublicKey.findProgramAddress([t.toBuffer(),e.toBuffer(),n.toBuffer()],o)}))}},87990:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},u=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.fetchUserFarms=e.fetchGlobalFarms=e.fetchBatchedAccountInfos=void 0;const c=s(n(20880)),d=n(61401),l=u(n(64097)),h=n(64097),f=n(86664);function p(t,e){return a(this,void 0,void 0,(function*(){const n=e.map((e=>({methodName:"getAccountInfo",args:t._buildArgs([e.toBase58()],"singleGossip","jsonParsed")})));return(yield t._rpcBatchRequest(n)).map((t=>t.result.value?Object.assign({},t.result.value,{data:r.from(t.result.value.data[0],"base64")}):null))}))}e.fetchBatchedAccountInfos=p,e.fetchGlobalFarms=function(t,e,n){return a(this,void 0,void 0,(function*(){const r=yield p(t,e);return Promise.all(r.map(((t,r)=>a(this,void 0,void 0,(function*(){if(!t)throw new Error("GlobalFarm not found");const i=d.decodeGlobalFarmBuffer(t),o=e[r],s=(yield c.getAuthorityAndNonce(o,n))[0];return new c.default(Object.assign(Object.assign({},i),{publicKey:o,authority:s}))})))))}))},e.fetchUserFarms=function(t,e,n,r){return a(this,void 0,void 0,(function*(){const i=yield Promise.all(n.map((t=>a(this,void 0,void 0,(function*(){return(yield h.getUserFarmAddress(t,e,f.TOKEN_PROGRAM_ID,r))[0]})))));return(yield p(t,i)).map(((t,e)=>{if(!t)return null;const n=d.decodeUserFarmBuffer(t);return new l.default(Object.assign(Object.assign({},n),{publicKey:i[e]}))}))}))}},61401:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.INIT_USER_FARM_DATA_LAYOUT=e.USER_FARM_DATA_LAYOUT=e.decodeUserFarmBuffer=e.INIT_GLOBAL_FARM_DATA_LAYOUT=e.GLOBAL_FARM_DATA_LAYOUT=e.decodeGlobalFarmBuffer=e.generateBufferData=e.u64ToBuffer=e.uint256ToDecimal=e.uint256ToString=e.uint8ToU64=e.uint8ToNumber=e.uint8ToPubkey=e.uint256=e.uint64=e.publicKey=void 0;const o=n(52454),s=n(86664),a=i(n(20698)),u=i(n(13550)),c=i(n(93776));function d(t){return new o.PublicKey(t)}function l(t){return new s.u64(t,10,"le")}function h(t){return new c.default(new u.default(t,10,"le").toString()).dividedBy("1_000_000_000_000")}e.publicKey=(t="publicKey")=>a.default.blob(32,t),e.uint64=(t="uint64")=>a.default.blob(8,t),e.uint256=(t="uint256")=>a.default.blob(32,t),e.uint8ToPubkey=d,e.uint8ToNumber=function(t){return new u.default(t,10,"le").toNumber()},e.uint8ToU64=l,e.uint256ToString=function(t){return new u.default(t,10,"le").toString()},e.uint256ToDecimal=h,e.u64ToBuffer=function(t){return t.toBuffer("le",8)},e.generateBufferData=function(t,e){let n=r.alloc(t.span);{const r=t.encode(e,n);n=n.slice(0,r)}return n},e.decodeGlobalFarmBuffer=function(t){const n=e.GLOBAL_FARM_DATA_LAYOUT.decode(t.data);return{isInitialized:!!n.isInitialized,accountType:n.accountType,nonce:n.nonce,tokenProgramId:d(n.tokenProgramId),emissionsAuthority:d(n.emissionsAuthority),removeRewardsAuthority:d(n.removeRewardsAuthority),baseTokenMint:d(n.baseTokenMint),baseTokenVault:d(n.baseTokenVault),rewardTokenVault:d(n.rewardTokenVault),farmTokenMint:d(n.farmTokenMint),emissionsPerSecondNumerator:l(n.emissionsPerSecondNumerator),emissionsPerSecondDenominator:l(n.emissionsPerSecondDenominator),lastUpdatedTimestamp:l(n.lastUpdatedTimestamp),cumulativeEmissionsPerFarmToken:h(n.cumulativeEmissionsPerFarmToken)}},e.GLOBAL_FARM_DATA_LAYOUT=a.default.struct([a.default.u8("isInitialized"),a.default.u8("accountType"),a.default.u8("nonce"),e.publicKey("tokenProgramId"),e.publicKey("emissionsAuthority"),e.publicKey("removeRewardsAuthority"),e.publicKey("baseTokenMint"),e.publicKey("baseTokenVault"),e.publicKey("rewardTokenVault"),e.publicKey("farmTokenMint"),e.uint64("emissionsPerSecondNumerator"),e.uint64("emissionsPerSecondDenominator"),e.uint64("lastUpdatedTimestamp"),e.uint256("cumulativeEmissionsPerFarmToken")]),e.INIT_GLOBAL_FARM_DATA_LAYOUT=a.default.struct([a.default.u8("instruction"),a.default.u8("nonce"),e.publicKey("tokenProgramId"),e.publicKey("emissionsAuthority"),e.publicKey("removeRewardsAuthority"),e.uint64("emissionsPerSecondNumerator"),e.uint64("emissionsPerSecondDenominator")]),e.decodeUserFarmBuffer=function(t){const n=e.USER_FARM_DATA_LAYOUT.decode(t.data);return{isInitialized:!!n.isInitialized,accountType:n.accountType,globalFarm:d(n.globalFarm),owner:d(n.owner),baseTokensConverted:l(n.baseTokensConverted),cumulativeEmissionsCheckpoint:h(n.cumulativeEmissionsCheckpoint)}},e.USER_FARM_DATA_LAYOUT=a.default.struct([a.default.u8("isInitialized"),a.default.u8("accountType"),e.publicKey("globalFarm"),e.publicKey("owner"),e.uint64("baseTokensConverted"),e.uint256("cumulativeEmissionsCheckpoint")]),e.INIT_USER_FARM_DATA_LAYOUT=a.default.struct([a.default.u8("instruction")])},82657:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ZERO=e.toU64WithDecimals=e.toBNWithDecimals=void 0;const r=n(86664);function i(t,e=9){const n=new r.u64(10).pow(new r.u64(e)),i=Math.floor(t),o=t%1,s=new r.u64(i).mul(n);if(!o)return s;const a=new r.u64(o.toString().substring(0,e).padEnd(e,"0"));return s.add(a)}e.toBNWithDecimals=i,e.toU64WithDecimals=function(t,e=9){const n=i(t,e);return new r.u64(n)},e.ZERO=new r.u64(0)},86664:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ASSOCIATED_TOKEN_PROGRAM_ID:()=>Kt,AccountLayout:()=>ee,MintLayout:()=>te,NATIVE_MINT:()=>Qt,TOKEN_PROGRAM_ID:()=>Ht,Token:()=>re,u64:()=>Zt});for(var r=n(64572),i=n(13550),o=n.n(i),s=n(52454),a={},u={byteLength:function(t){var e=p(t),n=e[0],r=e[1];return 3*(n+r)/4-r},toByteArray:function(t){var e,n,r=p(t),i=r[0],o=r[1],s=new l(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=d[t.charCodeAt(n)]<<2|d[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=d[t.charCodeAt(n)]<<10|d[t.charCodeAt(n+1)]<<4|d[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;sa?a:s+o));return 1===r?(e=t[n-1],i.push(c[e>>2]+c[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(c[e>>10]+c[e>>4&63]+c[e<<2&63]+"=")),i.join("")}},c=[],d=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0;f<64;++f)c[f]=h[f],d[h.charCodeAt(f)]=f;function p(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function m(t,e,n){for(var r,i,o=[],s=e;s>18&63]+c[i>>12&63]+c[i>>6&63]+c[63&i]);return o.join("")}d["-".charCodeAt(0)]=62,d["_".charCodeAt(0)]=63;var g={read:function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,d=-7,l=n?i-1:0,h=n?-1:1,f=t[e+l];for(l+=h,o=f&(1<<-d)-1,f>>=-d,d+=a;d>0;o=256*o+t[e+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+t[e+l],l+=h,d-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,d=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;t[n+f]=255&s,f+=p,s/=256,c-=8);t[n+f-p]|=128*m}};!function(t){const e=u,n=g,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return d(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|p(t,e);let r=o(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return h(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);const i=function(t){if(s.isBuffer(t)){const e=0|f(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?o(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function d(t){return c(t),o(t<0?0:0|f(t))}function l(t){const e=t.length<0?0:0|f(t.length),n=o(e);for(let r=0;r=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(i)return r?-1:K(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return T(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function I(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=x)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(e+=" ... "),""},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,i){if(G(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0);const u=Math.min(o,a),c=this.slice(r,i),d=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return k(this,t,e,n);case"base64":return M(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function $(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){Y(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function O(t,e,n,r,i){Y(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function C(t,e,r,i,o){return e=+e,r>>>=0,o||D(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function N(t,e,r,i,o){return e=+e,r>>>=0,o||D(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=J((function(t){F(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=J((function(t){F(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||L(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||$(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||$(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=J((function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=J((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);$(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);$(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=J((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=J((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return C(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return C(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return N(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function Y(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function F(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw F(t,n),new z.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=j(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function K(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}}(a);var y=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},b="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t};function w(t,e){var n={seen:[],stylize:v};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),S(e)?n.showHidden=e:e&&function(t,e){if(!e||!P(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]]}(n,e),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=_),k(n,t,n.depth)}function _(t,e){var n=w.styles[e];return n?"["+w.colors[n][0]+"m"+t+"["+w.colors[n][1]+"m":t}function v(t,e){return t}function k(t,e,n){if(t.customInspect&&e&&$(e.inspect)&&e.inspect!==w&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return x(r)||(r=k(t,r,n)),r}var i=function(t,e){if(E(e))return t.stylize("undefined","undefined");if(x(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return"number"==typeof e?t.stylize(""+e,"number"):S(e)?t.stylize(""+e,"boolean"):I(e)?t.stylize("null","null"):void 0}(t,e);if(i)return i;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),L(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return M(e);if(0===o.length){if($(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(T(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(B(e))return t.stylize(Date.prototype.toString.call(e),"date");if(L(e))return M(e)}var u,c,d="",l=!1,h=["{","}"];return u=e,Array.isArray(u)&&(l=!0,h=["[","]"]),$(e)&&(d=" [Function"+(e.name?": "+e.name:"")+"]"),T(e)&&(d=" "+RegExp.prototype.toString.call(e)),B(e)&&(d=" "+Date.prototype.toUTCString.call(e)),L(e)&&(d=" "+M(e)),0!==o.length||l&&0!=e.length?n<0?T(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=l?function(t,e,n,r,i){for(var o=[],s=0,a=e.length;s60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(c,d,h)):h[0]+d+h[1]}function M(t){return"["+Error.prototype.toString.call(t)+"]"}function A(t,e,n,r,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),D(r,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=I(n)?k(t,u.value,null):k(t,u.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function S(t){return"boolean"==typeof t}function I(t){return null===t}function x(t){return"string"==typeof t}function E(t){return void 0===t}function T(t){return P(t)&&"[object RegExp]"===O(t)}function P(t){return"object"==typeof t&&null!==t}function B(t){return P(t)&&"[object Date]"===O(t)}function L(t){return P(t)&&("[object Error]"===O(t)||t instanceof Error)}function $(t){return"function"==typeof t}function R(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function O(t){return Object.prototype.toString.call(t)}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function C(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}}function G(t,e){return"string"==typeof t?t.length=0;a--)if(u[a]!==c[a])return!1;for(a=u.length-1;a>=0;a--)if(!Q(t[s=u[a]],e[s],n,r))return!1;return!0}(t,e,n,r))}return n?t===e:t==e}function tt(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function et(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function nt(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&X(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!t&&i&&!n;if((!t&&L(i)&&o&&et(i,n)||s)&&X(i,n,"Got unwanted exception"+r),t&&i&&n&&!et(i,n)||!t&&i)throw i}H.AssertionError=V,b(V,Error),H.fail=X,H.ok=J,H.equal=function t(e,n,r){e!=n&&X(e,n,r,"==",t)},H.notEqual=function t(e,n,r){e==n&&X(e,n,r,"!=",t)},H.deepEqual=function t(e,n,r){Q(e,n,!1)||X(e,n,r,"deepEqual",t)},H.deepStrictEqual=function t(e,n,r){Q(e,n,!0)||X(e,n,r,"deepStrictEqual",t)},H.notDeepEqual=function t(e,n,r){Q(e,n,!1)&&X(e,n,r,"notDeepEqual",t)},H.notDeepStrictEqual=function t(e,n,r){Q(e,n,!0)&&X(e,n,r,"notDeepStrictEqual",t)},H.strictEqual=function t(e,n,r){e!==n&&X(e,n,r,"===",t)},H.notStrictEqual=function t(e,n,r){e===n&&X(e,n,r,"!==",t)},H.throws=function(t,e,n){nt(!0,t,e,n)},H.doesNotThrow=function(t,e,n){nt(!1,t,e,n)},H.ifError=function(t){if(t)throw t};var rt={};class it{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function ot(t,e){return e.property?t+"["+e.property+"]":t}rt.Layout=it,rt.nameWithProperty=ot,rt.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof it))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class st extends it{isCount(){throw new Error("ExternalLayout is abstract")}}class at extends st{constructor(t,e){if(void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class ut extends st{constructor(t,e,n){if(!(t instanceof it))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof ct||this.layout instanceof dt}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class ct extends it{constructor(t,e){if(super(t,e),6t+r.encode(i,e,n+t)),0);return this.count instanceof st&&this.count.encode(t.length,e,n),i}}class St extends it{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof it),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class It{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class xt extends It{constructor(t,e){if(!(t instanceof st&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class Et extends it{constructor(t,e,n){const r=t instanceof ct||t instanceof dt;if(r)t=new xt(new ut(t));else if(t instanceof st&&t.isCount())t=new xt(t);else if(!(t instanceof It))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof it))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new Tt(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return a.Buffer.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Tt extends it{constructor(t,e,n,r){if(!(t instanceof Et))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof it))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Pt(t){return 0>t&&(t+=4294967296),t}class Bt extends it{constructor(t,e,n){if(!(t instanceof ct||t instanceof dt))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Pt(t&this.valueMask))throw new TypeError(ot("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Pt(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof st&&(r=t.length),!a.Buffer.isBuffer(t)||r!==t.length)throw new TypeError(ot("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof st&&this.length.encode(r,e,n),r}}class Ot extends it{constructor(t){super(-1,t)}getSpan(t,e){if(!a.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}class Dt extends it{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!a.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}class Ct extends it{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}rt.ExternalLayout=st,rt.GreedyCount=at,rt.OffsetLayout=ut,rt.UInt=ct,rt.UIntBE=dt,rt.Int=lt,rt.IntBE=ht,rt.Float=_t,rt.FloatBE=vt,rt.Double=kt,rt.DoubleBE=Mt,rt.Sequence=At,rt.Structure=St,rt.UnionDiscriminator=It,rt.UnionLayoutDiscriminator=xt,rt.Union=Et,rt.VariantLayout=Tt,rt.BitStructure=Bt,rt.BitField=Lt,rt.Boolean=$t,rt.Blob=Rt,rt.CString=Ot,rt.UTF8=Dt,rt.Constant=Ct,rt.greedy=(t,e)=>new at(t,e),rt.offset=(t,e,n)=>new ut(t,e,n);var Nt=rt.u8=t=>new ct(1,t);rt.u16=t=>new ct(2,t),rt.u24=t=>new ct(3,t);var zt=rt.u32=t=>new ct(4,t);rt.u40=t=>new ct(5,t),rt.u48=t=>new ct(6,t),rt.nu64=t=>new gt(t),rt.u16be=t=>new dt(2,t),rt.u24be=t=>new dt(3,t),rt.u32be=t=>new dt(4,t),rt.u40be=t=>new dt(5,t),rt.u48be=t=>new dt(6,t),rt.nu64be=t=>new yt(t),rt.s8=t=>new lt(1,t),rt.s16=t=>new lt(2,t),rt.s24=t=>new lt(3,t),rt.s32=t=>new lt(4,t),rt.s40=t=>new lt(5,t),rt.s48=t=>new lt(6,t),rt.ns64=t=>new bt(t),rt.s16be=t=>new ht(2,t),rt.s24be=t=>new ht(3,t),rt.s32be=t=>new ht(4,t),rt.s40be=t=>new ht(5,t),rt.s48be=t=>new ht(6,t),rt.ns64be=t=>new wt(t),rt.f32=t=>new _t(t),rt.f32be=t=>new vt(t),rt.f64=t=>new kt(t),rt.f64be=t=>new Mt(t);var Ut=rt.struct=(t,e,n)=>new St(t,e,n);rt.bits=(t,e,n)=>new Bt(t,e,n),rt.seq=(t,e,n)=>new At(t,e,n),rt.union=(t,e,n)=>new Et(t,e,n),rt.unionLayoutDiscriminator=(t,e)=>new xt(t,e);var jt=rt.blob=(t,e)=>new Rt(t,e);rt.cstr=t=>new Ot(t),rt.utf8=(t,e)=>new Dt(t,e),rt.const=(t,e)=>new Ct(t,e);const Yt=(t="publicKey")=>jt(32,t),Ft=(t="uint64")=>jt(8,t);function Wt(t,e,n,...r){return(0,s.sendAndConfirmTransaction)(e,n,r,{skipPreflight:!1})}const Ht=new s.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Kt=new s.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),qt="Failed to find account",Vt="Invalid account owner";function Gt(t){return a.Buffer.from(t.toBuffer())}class Zt extends(o()){toBuffer(){const t=super.toArray().reverse(),e=a.Buffer.from(t);if(8===e.length)return e;H(e.length<8,"u64 too large");const n=a.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){return H(8===t.length,`Invalid buffer length: ${t.length}`),new Zt([...t].reverse().map((t=>`00${t.toString(16)}`.slice(-2))).join(""),16)}}function Xt(t){return"publicKey"in t}const Jt={MintTokens:0,FreezeAccount:1,AccountOwner:2,CloseAccount:3},Qt=new s.PublicKey("So11111111111111111111111111111111111111112"),te=Ut([zt("mintAuthorityOption"),Yt("mintAuthority"),Ft("supply"),Nt("decimals"),Nt("isInitialized"),zt("freezeAuthorityOption"),Yt("freezeAuthority")]),ee=Ut([Yt("mint"),Yt("owner"),Ft("amount"),zt("delegateOption"),Yt("delegate"),Nt("state"),zt("isNativeOption"),Ft("isNative"),Ft("delegatedAmount"),zt("closeAuthorityOption"),Yt("closeAuthority")]),ne=Ut([Nt("m"),Nt("n"),Nt("is_initialized"),Yt("signer1"),Yt("signer2"),Yt("signer3"),Yt("signer4"),Yt("signer5"),Yt("signer6"),Yt("signer7"),Yt("signer8"),Yt("signer9"),Yt("signer10"),Yt("signer11")]);class re{constructor(t,e,n,i){(0,r.Z)(this,"connection",void 0),(0,r.Z)(this,"publicKey",void 0),(0,r.Z)(this,"programId",void 0),(0,r.Z)(this,"associatedProgramId",void 0),(0,r.Z)(this,"payer",void 0),Object.assign(this,{connection:t,publicKey:e,programId:n,payer:i,associatedProgramId:Kt})}static async getMinBalanceRentForExemptMint(t){return await t.getMinimumBalanceForRentExemption(te.span)}static async getMinBalanceRentForExemptAccount(t){return await t.getMinimumBalanceForRentExemption(ee.span)}static async getMinBalanceRentForExemptMultisig(t){return await t.getMinimumBalanceForRentExemption(ne.span)}static async createMint(t,e,n,r,i,o){const a=s.Keypair.generate(),u=new re(t,a.publicKey,o,e),c=await re.getMinBalanceRentForExemptMint(t),d=new s.Transaction;return d.add(s.SystemProgram.createAccount({fromPubkey:e.publicKey,newAccountPubkey:a.publicKey,lamports:c,space:te.span,programId:o})),d.add(re.createInitMintInstruction(o,a.publicKey,i,n,r)),await Wt(0,t,d,e,a),u}async createAccount(t){const e=await re.getMinBalanceRentForExemptAccount(this.connection),n=s.Keypair.generate(),r=new s.Transaction;r.add(s.SystemProgram.createAccount({fromPubkey:this.payer.publicKey,newAccountPubkey:n.publicKey,lamports:e,space:ee.span,programId:this.programId}));const i=this.publicKey;return r.add(re.createInitAccountInstruction(this.programId,i,n.publicKey,t)),await Wt(0,this.connection,r,this.payer,n),n.publicKey}async createAssociatedTokenAccount(t){const e=await re.getAssociatedTokenAddress(this.associatedProgramId,this.programId,this.publicKey,t);return this.createAssociatedTokenAccountInternal(t,e)}async createAssociatedTokenAccountInternal(t,e){return await Wt(0,this.connection,(new s.Transaction).add(re.createAssociatedTokenAccountInstruction(this.associatedProgramId,this.programId,this.publicKey,e,t,this.payer.publicKey)),this.payer),e}async getOrCreateAssociatedAccountInfo(t){const e=await re.getAssociatedTokenAddress(this.associatedProgramId,this.programId,this.publicKey,t);try{return await this.getAccountInfo(e)}catch(n){if(n.message===qt||n.message===Vt){try{await this.createAssociatedTokenAccountInternal(t,e)}catch(t){}return await this.getAccountInfo(e)}throw n}}static async createWrappedNativeAccount(t,e,n,r,i){const o=await re.getMinBalanceRentForExemptAccount(t),a=s.Keypair.generate(),u=new s.Transaction;return u.add(s.SystemProgram.createAccount({fromPubkey:r.publicKey,newAccountPubkey:a.publicKey,lamports:o,space:ee.span,programId:e})),u.add(s.SystemProgram.transfer({fromPubkey:r.publicKey,toPubkey:a.publicKey,lamports:i})),u.add(re.createInitAccountInstruction(e,Qt,a.publicKey,n)),await Wt(0,t,u,r,a),a.publicKey}async createMultisig(t,e){const n=s.Keypair.generate(),r=await re.getMinBalanceRentForExemptMultisig(this.connection),i=new s.Transaction;i.add(s.SystemProgram.createAccount({fromPubkey:this.payer.publicKey,newAccountPubkey:n.publicKey,lamports:r,space:ne.span,programId:this.programId}));let o=[{pubkey:n.publicKey,isSigner:!1,isWritable:!0},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];e.forEach((t=>o.push({pubkey:t,isSigner:!1,isWritable:!1})));const u=Ut([Nt("instruction"),Nt("m")]),c=a.Buffer.alloc(u.span);return u.encode({instruction:2,m:t},c),i.add({keys:o,programId:this.programId,data:c}),await Wt(0,this.connection,i,this.payer,n),n.publicKey}async getMintInfo(){const t=await this.connection.getAccountInfo(this.publicKey);if(null===t)throw new Error("Failed to find mint account");if(!t.owner.equals(this.programId))throw new Error(`Invalid mint owner: ${JSON.stringify(t.owner)}`);if(t.data.length!=te.span)throw new Error("Invalid mint size");const e=a.Buffer.from(t.data),n=te.decode(e);return 0===n.mintAuthorityOption?n.mintAuthority=null:n.mintAuthority=new s.PublicKey(n.mintAuthority),n.supply=Zt.fromBuffer(n.supply),n.isInitialized=0!=n.isInitialized,0===n.freezeAuthorityOption?n.freezeAuthority=null:n.freezeAuthority=new s.PublicKey(n.freezeAuthority),n}async getAccountInfo(t,e){const n=await this.connection.getAccountInfo(t,e);if(null===n)throw new Error(qt);if(!n.owner.equals(this.programId))throw new Error(Vt);if(n.data.length!=ee.span)throw new Error("Invalid account size");const r=a.Buffer.from(n.data),i=ee.decode(r);if(i.address=t,i.mint=new s.PublicKey(i.mint),i.owner=new s.PublicKey(i.owner),i.amount=Zt.fromBuffer(i.amount),0===i.delegateOption?(i.delegate=null,i.delegatedAmount=new Zt):(i.delegate=new s.PublicKey(i.delegate),i.delegatedAmount=Zt.fromBuffer(i.delegatedAmount)),i.isInitialized=0!==i.state,i.isFrozen=2===i.state,1===i.isNativeOption?(i.rentExemptReserve=Zt.fromBuffer(i.isNative),i.isNative=!0):(i.rentExemptReserve=null,i.isNative=!1),0===i.closeAuthorityOption?i.closeAuthority=null:i.closeAuthority=new s.PublicKey(i.closeAuthority),!i.mint.equals(this.publicKey))throw new Error(`Invalid account mint: ${JSON.stringify(i.mint)} !== ${JSON.stringify(this.publicKey)}`);return i}async getMultisigInfo(t){const e=await this.connection.getAccountInfo(t);if(null===e)throw new Error("Failed to find multisig");if(!e.owner.equals(this.programId))throw new Error("Invalid multisig owner");if(e.data.length!=ne.span)throw new Error("Invalid multisig size");const n=a.Buffer.from(e.data),r=ne.decode(n);return r.signer1=new s.PublicKey(r.signer1),r.signer2=new s.PublicKey(r.signer2),r.signer3=new s.PublicKey(r.signer3),r.signer4=new s.PublicKey(r.signer4),r.signer5=new s.PublicKey(r.signer5),r.signer6=new s.PublicKey(r.signer6),r.signer7=new s.PublicKey(r.signer7),r.signer8=new s.PublicKey(r.signer8),r.signer9=new s.PublicKey(r.signer9),r.signer10=new s.PublicKey(r.signer10),r.signer11=new s.PublicKey(r.signer11),r}async transfer(t,e,n,r,i){let o,a;return Xt(n)?(o=n.publicKey,a=[n]):(o=n,a=r),await Wt("Transfer",this.connection,(new s.Transaction).add(re.createTransferInstruction(this.programId,t,e,o,r,i)),this.payer,...a)}async approve(t,e,n,r,i){let o,a;Xt(n)?(o=n.publicKey,a=[n]):(o=n,a=r),await Wt("Approve",this.connection,(new s.Transaction).add(re.createApproveInstruction(this.programId,t,e,o,r,i)),this.payer,...a)}async revoke(t,e,n){let r,i;Xt(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await Wt("Revoke",this.connection,(new s.Transaction).add(re.createRevokeInstruction(this.programId,t,r,n)),this.payer,...i)}async setAuthority(t,e,n,r,i){let o,a;Xt(r)?(o=r.publicKey,a=[r]):(o=r,a=i),await Wt("SetAuthority",this.connection,(new s.Transaction).add(re.createSetAuthorityInstruction(this.programId,t,e,n,o,i)),this.payer,...a)}async mintTo(t,e,n,r){let i,o;Xt(e)?(i=e.publicKey,o=[e]):(i=e,o=n),await Wt("MintTo",this.connection,(new s.Transaction).add(re.createMintToInstruction(this.programId,this.publicKey,t,i,n,r)),this.payer,...o)}async burn(t,e,n,r){let i,o;Xt(e)?(i=e.publicKey,o=[e]):(i=e,o=n),await Wt("Burn",this.connection,(new s.Transaction).add(re.createBurnInstruction(this.programId,this.publicKey,t,i,n,r)),this.payer,...o)}async closeAccount(t,e,n,r){let i,o;Xt(n)?(i=n.publicKey,o=[n]):(i=n,o=r),await Wt("CloseAccount",this.connection,(new s.Transaction).add(re.createCloseAccountInstruction(this.programId,t,e,i,r)),this.payer,...o)}async freezeAccount(t,e,n){let r,i;Xt(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await Wt("FreezeAccount",this.connection,(new s.Transaction).add(re.createFreezeAccountInstruction(this.programId,t,this.publicKey,r,n)),this.payer,...i)}async thawAccount(t,e,n){let r,i;Xt(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await Wt("ThawAccount",this.connection,(new s.Transaction).add(re.createThawAccountInstruction(this.programId,t,this.publicKey,r,n)),this.payer,...i)}async transferChecked(t,e,n,r,i,o){let a,u;return Xt(n)?(a=n.publicKey,u=[n]):(a=n,u=r),await Wt("TransferChecked",this.connection,(new s.Transaction).add(re.createTransferCheckedInstruction(this.programId,t,this.publicKey,e,a,r,i,o)),this.payer,...u)}async approveChecked(t,e,n,r,i,o){let a,u;Xt(n)?(a=n.publicKey,u=[n]):(a=n,u=r),await Wt("ApproveChecked",this.connection,(new s.Transaction).add(re.createApproveCheckedInstruction(this.programId,t,this.publicKey,e,a,r,i,o)),this.payer,...u)}async mintToChecked(t,e,n,r,i){let o,a;Xt(e)?(o=e.publicKey,a=[e]):(o=e,a=n),await Wt("MintToChecked",this.connection,(new s.Transaction).add(re.createMintToCheckedInstruction(this.programId,this.publicKey,t,o,n,r,i)),this.payer,...a)}async burnChecked(t,e,n,r,i){let o,a;Xt(e)?(o=e.publicKey,a=[e]):(o=e,a=n),await Wt("BurnChecked",this.connection,(new s.Transaction).add(re.createBurnCheckedInstruction(this.programId,this.publicKey,t,o,n,r,i)),this.payer,...a)}async syncNative(t){await Wt(0,this.connection,(new s.Transaction).add(re.createSyncNativeInstruction(this.programId,t)),this.payer)}static createInitMintInstruction(t,e,n,r,i){let o=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];const u=Ut([Nt("instruction"),Nt("decimals"),Yt("mintAuthority"),Nt("option"),Yt("freezeAuthority")]);let c=a.Buffer.alloc(1024);{const t=u.encode({instruction:0,decimals:n,mintAuthority:Gt(r),option:null===i?0:1,freezeAuthority:Gt(i||new s.PublicKey(0))},c);c=c.slice(0,t)}return new s.TransactionInstruction({keys:o,programId:t,data:c})}static createInitAccountInstruction(t,e,n,r){const i=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],o=Ut([Nt("instruction")]),u=a.Buffer.alloc(o.span);return o.encode({instruction:1},u),new s.TransactionInstruction({keys:i,programId:t,data:u})}static createTransferInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Ft("amount")]),c=a.Buffer.alloc(u.span);u.encode({instruction:3,amount:new Zt(o).toBuffer()},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?d.push({pubkey:r,isSigner:!0,isWritable:!1}):(d.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createApproveInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Ft("amount")]),c=a.Buffer.alloc(u.span);u.encode({instruction:4,amount:new Zt(o).toBuffer()},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?d.push({pubkey:r,isSigner:!0,isWritable:!1}):(d.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createRevokeInstruction(t,e,n,r){const i=Ut([Nt("instruction")]),o=a.Buffer.alloc(i.span);i.encode({instruction:5},o);let u=[{pubkey:e,isSigner:!1,isWritable:!0}];return 0===r.length?u.push({pubkey:n,isSigner:!0,isWritable:!1}):(u.push({pubkey:n,isSigner:!1,isWritable:!1}),r.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:u,programId:t,data:o})}static createSetAuthorityInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Nt("authorityType"),Nt("option"),Yt("newAuthority")]);let c=a.Buffer.alloc(1024);{const t=u.encode({instruction:6,authorityType:Jt[r],option:null===n?0:1,newAuthority:Gt(n||new s.PublicKey(0))},c);c=c.slice(0,t)}let d=[{pubkey:e,isSigner:!1,isWritable:!0}];return 0===o.length?d.push({pubkey:i,isSigner:!0,isWritable:!1}):(d.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createMintToInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Ft("amount")]),c=a.Buffer.alloc(u.span);u.encode({instruction:7,amount:new Zt(o).toBuffer()},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?d.push({pubkey:r,isSigner:!0,isWritable:!1}):(d.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createBurnInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Ft("amount")]),c=a.Buffer.alloc(u.span);u.encode({instruction:8,amount:new Zt(o).toBuffer()},c);let d=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}];return 0===i.length?d.push({pubkey:r,isSigner:!0,isWritable:!1}):(d.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createCloseAccountInstruction(t,e,n,r,i){const o=Ut([Nt("instruction")]),u=a.Buffer.alloc(o.span);o.encode({instruction:9},u);let c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:c,programId:t,data:u})}static createFreezeAccountInstruction(t,e,n,r,i){const o=Ut([Nt("instruction")]),u=a.Buffer.alloc(o.span);o.encode({instruction:10},u);let c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:c,programId:t,data:u})}static createThawAccountInstruction(t,e,n,r,i){const o=Ut([Nt("instruction")]),u=a.Buffer.alloc(o.span);o.encode({instruction:11},u);let c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:c,programId:t,data:u})}static createTransferCheckedInstruction(t,e,n,r,i,o,u,c){const d=Ut([Nt("instruction"),Ft("amount"),Nt("decimals")]),l=a.Buffer.alloc(d.span);d.encode({instruction:12,amount:new Zt(u).toBuffer(),decimals:c},l);let h=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!0}];return 0===o.length?h.push({pubkey:i,isSigner:!0,isWritable:!1}):(h.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>h.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:h,programId:t,data:l})}static createApproveCheckedInstruction(t,e,n,r,i,o,u,c){const d=Ut([Nt("instruction"),Ft("amount"),Nt("decimals")]),l=a.Buffer.alloc(d.span);d.encode({instruction:13,amount:new Zt(u).toBuffer(),decimals:c},l);let h=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1}];return 0===o.length?h.push({pubkey:i,isSigner:!0,isWritable:!1}):(h.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>h.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:h,programId:t,data:l})}static createMintToCheckedInstruction(t,e,n,r,i,o,u){const c=Ut([Nt("instruction"),Ft("amount"),Nt("decimals")]),d=a.Buffer.alloc(c.span);c.encode({instruction:14,amount:new Zt(o).toBuffer(),decimals:u},d);let l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?l.push({pubkey:r,isSigner:!0,isWritable:!1}):(l.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>l.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:l,programId:t,data:d})}static createBurnCheckedInstruction(t,e,n,r,i,o,u){const c=Ut([Nt("instruction"),Ft("amount"),Nt("decimals")]),d=a.Buffer.alloc(c.span);c.encode({instruction:15,amount:new Zt(o).toBuffer(),decimals:u},d);let l=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}];return 0===i.length?l.push({pubkey:r,isSigner:!0,isWritable:!1}):(l.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>l.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:l,programId:t,data:d})}static createSyncNativeInstruction(t,e){const n=Ut([Nt("instruction")]),r=a.Buffer.alloc(n.span);n.encode({instruction:17},r);let i=[{pubkey:e,isSigner:!1,isWritable:!0}];return new s.TransactionInstruction({keys:i,programId:t,data:r})}static async getAssociatedTokenAddress(t,e,n,r,i=!1){if(!i&&!s.PublicKey.isOnCurve(r.toBuffer()))throw new Error(`Owner cannot sign: ${r.toString()}`);return(await s.PublicKey.findProgramAddress([r.toBuffer(),e.toBuffer(),n.toBuffer()],t))[0]}static createAssociatedTokenAccountInstruction(t,e,n,r,i,o){const u=a.Buffer.alloc(0);let c=[{pubkey:o,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:s.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];return new s.TransactionInstruction({keys:c,programId:t,data:u})}}},52454:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Account:()=>Qe,AddressLookupTableAccount:()=>cr,AddressLookupTableInstruction:()=>so,AddressLookupTableProgram:()=>ao,Authorized:()=>wo,BLOCKHASH_CACHE_TIMEOUT_MS:()=>mr,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>tn,BPF_LOADER_PROGRAM_ID:()=>Gn,BpfLoader:()=>Zn,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>co,ComputeBudgetInstruction:()=>uo,ComputeBudgetProgram:()=>lo,Connection:()=>ro,Ed25519Program:()=>fo,Enum:()=>He,EpochSchedule:()=>rr,FeeCalculatorLayout:()=>zn,Keypair:()=>io,LAMPORTS_PER_SOL:()=>Yo,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>oo,Loader:()=>Vn,Lockup:()=>_o,MAX_SEED_LENGTH:()=>Ge,Message:()=>yn,MessageAccountKeys:()=>un,MessageV0:()=>bn,NONCE_ACCOUNT_LENGTH:()=>jn,NonceAccount:()=>Yn,PACKET_DATA_SIZE:()=>en,PUBLIC_KEY_LENGTH:()=>Ze,PublicKey:()=>Je,SIGNATURE_LENGTH_IN_BYTES:()=>rn,SOLANA_SCHEMA:()=>Ke,STAKE_CONFIG_ID:()=>bo,STAKE_INSTRUCTION_LAYOUTS:()=>ko,SYSTEM_INSTRUCTION_LAYOUTS:()=>Hn,SYSVAR_CLOCK_PUBKEY:()=>In,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>xn,SYSVAR_INSTRUCTIONS_PUBKEY:()=>En,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>Tn,SYSVAR_RENT_PUBKEY:()=>Pn,SYSVAR_REWARDS_PUBKEY:()=>Bn,SYSVAR_SLOT_HASHES_PUBKEY:()=>Ln,SYSVAR_SLOT_HISTORY_PUBKEY:()=>$n,SYSVAR_STAKE_HISTORY_PUBKEY:()=>Rn,Secp256k1Program:()=>go,SendTransactionError:()=>ir,SolanaJSONRPCError:()=>sr,SolanaJSONRPCErrorCode:()=>or,StakeAuthorizationLayout:()=>Mo,StakeInstruction:()=>vo,StakeProgram:()=>Ao,Struct:()=>We,SystemInstruction:()=>Wn,SystemProgram:()=>Kn,Transaction:()=>Mn,TransactionExpiredBlockheightExceededError:()=>on,TransactionExpiredNonceInvalidError:()=>an,TransactionExpiredTimeoutError:()=>sn,TransactionInstruction:()=>kn,TransactionMessage:()=>An,TransactionStatus:()=>_n,VALIDATOR_INFO_KEY:()=>Po,VERSION_PREFIX_MASK:()=>nn,VOTE_PROGRAM_ID:()=>$o,ValidatorInfo:()=>Lo,VersionedMessage:()=>wn,VersionedTransaction:()=>Sn,VoteAccount:()=>Oo,VoteAuthorizationLayout:()=>Eo,VoteInit:()=>So,VoteInstruction:()=>Io,VoteProgram:()=>To,clusterApiUrl:()=>Uo,sendAndConfirmRawTransaction:()=>jo,sendAndConfirmTransaction:()=>On});var r={};n.r(r),n.d(r,{dQ:()=>Z,ci:()=>z,bytesToNumberBE:()=>W,ty:()=>H,eV:()=>G,n$:()=>Q,ql:()=>V,hexToBytes:()=>F,_t:()=>C,tL:()=>K,S5:()=>q,FF:()=>et});var i=n(48764);function o(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function s(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){s(t);const n=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),h=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function f(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function p(t){if("string"==typeof t&&(t=f(t)),!d(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function m(...t){let e=0;for(let n=0;nt().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function b(t=32){if(c&&"function"==typeof c.getRandomValues)return c.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class w extends g{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=l(this.buffer)}update(t){a(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=p(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=l(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t>v&_)}:{h:0|Number(t>>v&_),l:0|Number(t&_)}}function M(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it<>>32-n,S=(t,e,n)=>e<>>32-n,I=(t,e,n)=>e<>>64-n,x=(t,e,n)=>t<>>64-n,E={fromBig:k,split:M,toBig:(t,e)=>BigInt(t>>>0)<>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:A,rotlSL:S,rotlBH:I,rotlBL:x,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[T,P]=(()=>E.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),B=new Uint32Array(80),L=new Uint32Array(80);class $ extends w{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)B[n]=t.getUint32(e),L[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|B[t-15],n=0|L[t-15],r=E.rotrSH(e,n,1)^E.rotrSH(e,n,8)^E.shrSH(e,n,7),i=E.rotrSL(e,n,1)^E.rotrSL(e,n,8)^E.shrSL(e,n,7),o=0|B[t-2],s=0|L[t-2],a=E.rotrSH(o,s,19)^E.rotrBH(o,s,61)^E.shrSH(o,s,6),u=E.rotrSL(o,s,19)^E.rotrBL(o,s,61)^E.shrSL(o,s,6),c=E.add4L(i,u,L[t-7],L[t-16]),d=E.add4H(c,r,a,B[t-7],B[t-16]);B[t]=0|d,L[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=E.rotrSH(d,l,14)^E.rotrSH(d,l,18)^E.rotrBH(d,l,41),b=E.rotrSL(d,l,14)^E.rotrSL(d,l,18)^E.rotrBL(d,l,41),w=d&h^~d&p,_=l&f^~l&m,v=E.add5L(y,b,_,P[t],L[t]),k=E.add5H(v,g,e,w,T[t],B[t]),M=0|v,A=E.rotrSH(n,r,28)^E.rotrBH(n,r,34)^E.rotrBH(n,r,39),S=E.rotrSL(n,r,28)^E.rotrBL(n,r,34)^E.rotrBL(n,r,39),I=n&i^n&s^i&s,x=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|d,f=0|l,({h:d,l}=E.add(0|u,0|c,0|k,0|M)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const $=E.add3L(M,S,x);n=E.add3H($,k,A,I),r=0|$}({h:n,l:r}=E.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=E.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=E.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=E.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=E.add(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=E.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=E.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=E.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y)}roundClean(){B.fill(0),L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const R=y((()=>new $)),O=(BigInt(0),BigInt(1)),D=BigInt(2);function C(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const N=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function z(t){if(!C(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n=j._0&&t<=j._9?t-j._0:t>=j._A&&t<=j._F?t-(j._A-10):t>=j._a&&t<=j._f?t-(j._a-10):void 0}function F(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(D<new Uint8Array(t),J=t=>Uint8Array.from(t);function Q(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=X(t),i=X(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=X())=>{i=a(J([0]),t),r=a(),0!==t.length&&(i=a(J([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const tt={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||C(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function et(t,e,n={}){const r=(e,n,r)=>{const i=tt[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const nt=BigInt(0),rt=BigInt(1),it=BigInt(2),ot=BigInt(3),st=BigInt(4),at=BigInt(5),ut=BigInt(8);function ct(t,e){const n=t%e;return n>=nt?n:e+n}function dt(t,e,n){if(n<=nt||e 0");if(n===rt)return nt;let r=rt;for(;e>nt;)e&rt&&(r=r*t%n),t=t*t%n,e>>=rt;return r}function lt(t,e,n){let r=t;for(;e-- >nt;)r*=r,r%=n;return r}function ht(t,e){if(t===nt||e<=nt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=ct(t,e),r=e,i=nt,o=rt,s=rt,a=nt;for(;n!==nt;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==rt)throw new Error("invert: does not exist");return ct(i,e)}BigInt(9),BigInt(16);const ft=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function mt(t,e,n=!1,r={}){if(t<=nt)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=pt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%st===ot){const e=(t+rt)/st;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%ut===at){const e=(t-at)/ut;return function(t,n){const r=t.mul(n,it),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,it),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-rt)/it;let n,r,i;for(n=t-rt,r=0;n%it===nt;n/=it,r++);for(i=it;ict(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return nt<=e&&et===nt,isOdd:t=>(t&rt)===rt,neg:e=>ct(-e,t),eql:(t,e)=>t===e,sqr:e=>ct(e*e,t),add:(e,n)=>ct(e+n,t),sub:(e,n)=>ct(e-n,t),mul:(e,n)=>ct(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===nt)return t.ONE;if(n===rt)return e;let r=t.ONE,i=e;for(;n>nt;)n&rt&&(r=t.mul(r,i)),i=t.sqr(i),n>>=rt;return r}(a,t,e),div:(e,n)=>ct(e*ht(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>ht(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?q(t,o):K(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?H(t):W(t)}});return Object.freeze(a)}function gt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function yt(t){const e=gt(t);return e+Math.ceil(e/2)}const bt=BigInt(0),wt=BigInt(1);function _t(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>bt;)n&wt&&(r=r.add(i)),i=i.double(),n>>=wt;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=wt);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function vt(t){return et(t.Fp,ft.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),et(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const kt=BigInt(0),Mt=BigInt(1),At=BigInt(2),St=BigInt(8),It={zip215:!0};function xt(t){const e=function(t){const e=vt(t);return et(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=At<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:kt}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&ktp(t)&&p(e)&&tt===kt||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===kt?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,Mt,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(At*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===kt)return this.double();const r=d(s*At*h),f=d(a*At*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===kt?M:this.equals(M)||e===Mt?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?St:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:kt,y:Mt};if(u!==Mt)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===Mt?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=V("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=H(a);h===kt||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-Mt),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&Mt)===Mt,_=0!=(128&u);if(!r&&b===kt&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return x(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=q(e,n.BYTES);return r[r.length-1]|=t&Mt?128:0,r}toHex(){return z(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,Mt,d(e.Gx*e.Gy)),v.ZERO=new v(kt,Mt,Mt,kt);const{BASE:k,ZERO:M}=v,A=_t(v,8*a);function S(t){return ct(t,r)}function I(t){return S(H(t))}function x(t){const e=a;t=V("private key",t,e);const n=V("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function E(t=new Uint8Array,...e){const n=G(...e);return I(o(f(n,V("context",t),!!i)))}const T=It;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return x(t).pointBytes},sign:function(t,e,r={}){t=V("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=x(e),c=E(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+E(r.context,d,u,t)*s);return b(l),V("result",G(d,q(l,n.BYTES)),2*a)},verify:function(t,e,r,o=T){const{context:s,zip215:a}=o,u=n.BYTES;t=V("signature",t,2*u),e=V("message",e),i&&(e=i(e));const c=H(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=E(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const Et=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Tt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Pt=(BigInt(0),BigInt(1)),Bt=BigInt(2),Lt=BigInt(5),$t=BigInt(10),Rt=BigInt(20),Ot=BigInt(40),Dt=BigInt(80);const Ct=mt(Et,void 0,!0),Nt={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ct,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:R,randomBytes:b,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=Et,r=ct(e*e*e,n),i=ct(r*r*e,n);let o=ct(t*r*function(t){const e=Et,n=t*t%e*t%e,r=lt(n,Bt,e)*n%e,i=lt(r,Pt,e)*t%e,o=lt(i,Lt,e)*i%e,s=lt(o,$t,e)*o%e,a=lt(s,Rt,e)*s%e,u=lt(a,Ot,e)*a%e,c=lt(u,Dt,e)*u%e,d=lt(c,Dt,e)*u%e,l=lt(d,$t,e)*o%e;return{pow_p_5_8:lt(l,Bt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=ct(e*o*o,n),a=o,u=ct(o*Tt,n),c=s===t,d=s===ct(-t,n),l=s===ct(-t*Tt,n);return c&&(o=a),(d||l)&&(o=u),(ct(o,n)&rt)===rt&&(o=ct(-o,n)),{isValid:c||d,value:o}}},zt=xt(Nt);const Ut=(Ct.ORDER+BigInt(3))/BigInt(8);Ct.pow(Bt,Ut),Ct.sqrt(Ct.neg(Ct.ONE)),Ct.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(Ct,Ct.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var jt=n(13550),Yt=n.n(jt),Ft=n(77191),Wt=n.n(Ft);const Ht=(t,e,n)=>t&e^t&n^e&n,Kt=new Uint32Array([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]),qt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Vt=new Uint32Array(64);class Gt extends w{constructor(){super(64,32,8,!1),this.A=0|qt[0],this.B=0|qt[1],this.C=0|qt[2],this.D=0|qt[3],this.E=0|qt[4],this.F=0|qt[5],this.G=0|qt[6],this.H=0|qt[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Vt[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Vt[t-15],n=Vt[t-2],r=h(e,7)^h(e,18)^e>>>3,i=h(n,17)^h(n,19)^n>>>10;Vt[t]=i+Vt[t-7]+r+Vt[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(h(s,6)^h(s,11)^h(s,25))+((d=s)&a^~d&u)+Kt[t]+Vt[t]|0,l=(h(n,2)^h(n,13)^h(n,22))+Ht(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){Vt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Zt=y((()=>new Gt));var Xt=n(25532),Jt=n(39386),Qt=n(40475),te=n(53471),ee=n(31198),ne=n.n(ee),re=n(64906),ie=n(55852);const[oe,se,ae]=[[],[],[]],ue=BigInt(0),ce=BigInt(1),de=BigInt(2),le=BigInt(7),he=BigInt(256),fe=BigInt(113);for(let t=0,e=ce,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],oe.push(2*(5*r+n)),se.push((t+1)*(t+2)/2%64);let i=ue;for(let t=0;t<7;t++)e=(e<>le)*fe)%he,e&de&&(i^=ce<<(ce<n>32?I(t,e,n):A(t,e,n),ye=(t,e,n)=>n>32?x(t,e,n):S(t,e,n);class be extends g{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,o(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=ge(o,s,1)^n[r],u=ye(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=se[n],o=ge(e,i,r),s=ye(e,i,r),a=oe[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=pe[r],t[1]^=me[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){a(this);const{blockLen:e,state:n}=this,r=(t=p(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return o(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(u(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new be(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const we=((t,e,n)=>y((()=>new be(e,t,n))))(1,136,32);class _e extends g{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(t.outputLen),o(t.blockLen)}(t);const n=p(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew _e(t,e).update(n).digest();ve.create=(t,e)=>new _e(t,e);const{bytesToNumberBE:ke,hexToBytes:Me}=r,Ae={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=Ae;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:ke(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Ae,n="string"==typeof t?Me(t):t;if(!C(n))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=Ae._parseInt(n.subarray(2)),{d:s,l:a}=Ae._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},Se=BigInt(0),Ie=BigInt(1),xe=(BigInt(2),BigInt(3));function Ee(t){const e=function(t){const e=vt(t);return et(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return ct(t,r)}function a(t){return ht(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=vt(t);et(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return G(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&Sen.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(V("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,xe),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,xe);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===Se)return r;if(a(t),t===Ie)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>Se||c>Se;)s&Ie&&(d=d.add(p)),c&Ie&&(h=h.add(p)),p=p.double(),s>>=Ie,c>>=Ie;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==Se&&e!==Ie&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Ie)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Ie?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return z(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=_t(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=G;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=W(s);if(!(Se<(a=t)&&az(K(t,e.nByteLength));function f(t){return t>r>>Ie}const p=(t,e,n)=>W(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=V("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=Ae.toSig(V("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(V("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return F(this.toDERHex())}toDERHex(){return Ae.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return F(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=yt(e.n);return function(t,e,n=!1){const r=t.length,i=gt(e),o=yt(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=ct(n?W(t):H(t),e-rt)+rt;return n?q(s,i):K(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=C(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=W(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=Z(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(Se<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return K(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=V("msgHash",t),p&&(t=V("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g){const t=!0===g?d(n.BYTES):g;M.push(V("extraEntropy",t))}const A=G(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===Se)return;const o=s(n*s(S+i*_));if(o===Se)return;let c=(r.x===i?0:2)|Number(r.y&Ie),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return Q(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=V("msgHash",n),r=V("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||C(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof Ae.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function Te(t){return{hash:t,hmac:(e,...n)=>ve(t,e,m(...n)),randomBytes:b}}BigInt(4);const Pe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Be=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Le=BigInt(1),$e=BigInt(2),Re=(t,e)=>(t+e/$e)/e;const Oe=mt(Pe,void 0,void 0,{sqrt:function(t){const e=Pe,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=lt(d,n,e)*d%e,h=lt(l,n,e)*d%e,f=lt(h,$e,e)*c%e,p=lt(f,i,e)*f%e,m=lt(p,o,e)*p%e,g=lt(m,a,e)*m%e,y=lt(g,u,e)*g%e,b=lt(y,a,e)*m%e,w=lt(b,n,e)*d%e,_=lt(w,s,e)*p%e,v=lt(_,r,e)*c%e,k=lt(v,$e,e);if(!Oe.eql(Oe.sqr(k),t))throw new Error("Cannot find square root");return k}}),De=function(t,e){const n=e=>Ee({...t,...Te(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Oe,n:Be,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Be,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Le*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=Re(o*t,e),u=Re(-r*t,e);let c=ct(t-a*n-u*i,e),d=ct(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},Zt);BigInt(0),De.ProjectivePoint;const Ce=zt.utils.randomPrivateKey,Ne=()=>{const t=zt.utils.randomPrivateKey(),e=ze(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},ze=zt.getPublicKey;function Ue(t){try{return zt.ExtendedPoint.fromHex(t),!0}catch{return!1}}const je=(t,e)=>zt.sign(t,e.slice(0,32)),Ye=zt.verify,Fe=t=>i.Buffer.isBuffer(t)?t:t instanceof Uint8Array?i.Buffer.from(t.buffer,t.byteOffset,t.byteLength):i.Buffer.from(t);class We{constructor(t){Object.assign(this,t)}encode(){return i.Buffer.from((0,Xt.serialize)(Ke,this))}static decode(t){return(0,Xt.deserialize)(Ke,this,t)}static decodeUnchecked(t){return(0,Xt.deserializeUnchecked)(Ke,this,t)}}class He extends We{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}}const Ke=new Map;var qe;let Ve;const Ge=32,Ze=32;let Xe=1;Ve=Symbol.toStringTag;class Je extends We{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Wt().decode(t);if(e.length!=Ze)throw new Error("Invalid public key input");this._bn=new(Yt())(e)}else this._bn=new(Yt())(t);if(this._bn.byteLength()>Ze)throw new Error("Invalid public key input")}}static unique(){const t=new Je(Xe);return Xe+=1,new Je(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Wt().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(i.Buffer);if(t.length===Ze)return t;const e=i.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Ve](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=i.Buffer.concat([t.toBuffer(),i.Buffer.from(e),n.toBuffer()]),o=Zt(r);return new Je(o)}static createProgramAddressSync(t,e){let n=i.Buffer.alloc(0);t.forEach((function(t){if(t.length>Ge)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Fe(t)])})),n=i.Buffer.concat([n,e.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=Zt(n);if(Ue(r))throw new Error("Invalid seeds, address must fall off the curve");return new Je(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const o=t.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return Ue(new Je(t).toBytes())}}qe=Je,Je.default=new qe("11111111111111111111111111111111"),Ke.set(Je,{kind:"struct",fields:[["_bn","u256"]]});class Qe{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=Fe(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Fe(Ce()),this._publicKey=Fe(ze(this._secretKey))}get publicKey(){return new Je(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const tn=new Je("BPFLoader1111111111111111111111111111111111"),en=1232,nn=127,rn=64;class on extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(on.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class sn extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(sn.prototype,"name",{value:"TransactionExpiredTimeoutError"});class an extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(an.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class un{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const cn=(t="publicKey")=>Jt.blob(32,t),dn=(t="signature")=>Jt.blob(64,t),ln=(t="string")=>{const e=Jt.struct([Jt.u32("length"),Jt.u32("lengthPadding"),Jt.blob(Jt.offset(Jt.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),o=e;return o.decode=(t,e)=>n(t,e).chars.toString(),o.encode=(t,e,n)=>{const o={chars:i.Buffer.from(t,"utf8")};return r(o,e,n)},o.alloc=t=>Jt.u32().span+Jt.u32().span+i.Buffer.from(t,"utf8").length,o};function hn(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return hn({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function fn(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function pn(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function mn(t,e){if(!t)throw new Error(e||"Assertion failed")}class gn{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new gn(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];mn(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{mn(e.length>0,"Expected at least one writable signer key");const[t]=e[0];mn(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Je(t))),...n.map((([t])=>new Je(t))),...r.map((([t])=>new Je(t))),...i.map((([t])=>new Je(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Je(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(mn(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}class yn{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Je(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Wt().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new un(this.staticAccountKeys)}static compile(t){const e=gn.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new un(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Wt().encode(t.data)})));return new yn({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];pn(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Wt().decode(t.data));let o=[];pn(o,e.length);let s=[];return pn(s,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:e,dataLength:i.Buffer.from(s),data:r}}));let r=[];pn(r,n.length);let o=i.Buffer.alloc(en);i.Buffer.from(r).copy(o);let s=r.length;n.forEach((t=>{const e=Jt.struct([Jt.u8("programIdIndex"),Jt.blob(t.keyIndicesCount.length,"keyIndicesCount"),Jt.seq(Jt.u8("keyIndex"),t.keyIndices.length,"keyIndices"),Jt.blob(t.dataLength.length,"dataLength"),Jt.seq(Jt.u8("userdatum"),t.data.length,"data")]).encode(t,o,s);s+=e})),o=o.slice(0,s);const a=Jt.struct([Jt.blob(1,"numRequiredSignatures"),Jt.blob(1,"numReadonlySignedAccounts"),Jt.blob(1,"numReadonlyUnsignedAccounts"),Jt.blob(e.length,"keyCount"),Jt.seq(cn("key"),t,"keys"),cn("recentBlockhash")]),u={numRequiredSignatures:i.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:i.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:i.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:i.Buffer.from(e),keys:this.accountKeys.map((t=>Fe(t.toBytes()))),recentBlockhash:Wt().decode(this.recentBlockhash)};let c=i.Buffer.alloc(2048);const d=a.encode(u,c);return o.copy(c,d),c.slice(0,d+o.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&nn))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=e.shift(),o=e.shift(),s=fn(e);let a=[];for(let t=0;t0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new un(this.staticAccountKeys,e)}isAccountSigner(t){return t=n?t-nt+e.writableIndexes.length),0):t>=this.header.numRequiredSignatures?t-et.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const t of n.writableIndexes){if(!(tt.toBytes())),recentBlockhash:Wt().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let t=0;const e=new Uint8Array(en);for(const n of this.compiledInstructions){const r=Array();pn(r,n.accountKeyIndexes.length);const i=Array();pn(i,n.data.length),t+=Jt.struct([Jt.u8("programIdIndex"),Jt.blob(r.length,"encodedAccountKeyIndexesLength"),Jt.seq(Jt.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),Jt.blob(i.length,"encodedDataLength"),Jt.blob(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(en);for(const n of this.addressTableLookups){const r=Array();pn(r,n.writableIndexes.length);const i=Array();pn(i,n.readonlyIndexes.length),t+=Jt.struct([cn("accountKey"),Jt.blob(r.length,"encodedWritableIndexesLength"),Jt.seq(Jt.u8(),n.writableIndexes.length,"writableIndexes"),Jt.blob(i.length,"encodedReadonlyIndexesLength"),Jt.seq(Jt.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),r=n&nn;mn(n!==r,"Expected versioned message but received legacy message"),mn(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},o=[],s=fn(e);for(let t=0;t{const e=wn.deserializeMessageVersion(t);if("legacy"===e)return yn.from(t);if(0===e)return bn.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let _n=function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t}({});const vn=i.Buffer.alloc(rn).fill(0);class kn{constructor(t){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class Mn{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new kn(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Je(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Wt().encode(e)}}));return f.forEach((t=>{mn(t.programIdIndex>=0),t.accounts.forEach((t=>mn(t>=0)))})),new yn({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=je(n,t.secretKey);this._addSignature(t.publicKey,Fe(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){mn(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=i.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):Ye(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];pn(n,e.length);const r=n.length+64*e.length+t.length,o=i.Buffer.alloc(r);return mn(e.length<256),i.Buffer.from(n).copy(o,0),e.forEach((({signature:t},e)=>{null!==t&&(mn(64===t.length,"signature has invalid length"),i.Buffer.from(t).copy(o,n.length+64*e))})),t.copy(o,n.length+64*e.length),mn(o.length<=en,`Transaction too large: ${o.length} > ${en}`),o}get keys(){return mn(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return mn(1===this.instructions.length),this.instructions[0].programId}get data(){return mn(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=fn(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Wt().encode(vn)?null:Wt().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new kn({keys:r,programId:t.accountKeys[e.programIdIndex],data:Wt().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}class An{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:r,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;mn(u>0,"Message header is invalid");const c=t.staticAccountKeys.length-o-a;mn(c>=0,"Message header is invalid");const d=t.getAccountKeys(e),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const t of r){const e=[];for(const r of t.accountKeyIndexes){const t=d.get(r);if(void 0===t)throw new Error(`Failed to find key for account key index ${r}`);let i;i=rt.equals(r.publicKey)));mn(t>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[t]=je(e,r.secretKey)}}addSignature(t,e){mn(64===e.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((e=>e.equals(t)));mn(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const In=new Je("SysvarC1ock11111111111111111111111111111111"),xn=new Je("SysvarEpochSchedu1e111111111111111111111111"),En=new Je("Sysvar1nstructions1111111111111111111111111"),Tn=new Je("SysvarRecentB1ockHashes11111111111111111111"),Pn=new Je("SysvarRent111111111111111111111111111111111"),Bn=new Je("SysvarRewards111111111111111111111111111111"),Ln=new Je("SysvarS1otHashes111111111111111111111111111"),$n=new Je("SysvarS1otHistory11111111111111111111111111"),Rn=new Je("SysvarStakeHistory1111111111111111111111111");async function On(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function Dn(t){return new Promise((e=>setTimeout(e,t)))}function Cn(t,e){const n=t.layout.span>=0?t.layout.span:hn(t,e),r=i.Buffer.alloc(n),o=Object.assign({instruction:t.index},e);return t.layout.encode(o,r),r}function Nn(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const zn=Jt.nu64("lamportsPerSignature"),Un=Jt.struct([Jt.u32("version"),Jt.u32("state"),cn("authorizedPubkey"),cn("nonce"),Jt.struct([zn],"feeCalculator")]),jn=Un.span;class Yn{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=Un.decode(Fe(t),0);return new Yn({authorizedPubkey:new Je(e.authorizedPubkey),nonce:new Je(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const Fn=(8,t=>{const e=(0,Jt.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return(0,Qt.toBigIntLE)(i.Buffer.from(n))},o.encode=(t,e,r)=>{const i=(0,Qt.toBufferLE)(t,8);return n(i,e,r)},o});class Wn{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Hn))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=Nn(Hn.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new Je(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=Nn(Hn.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=Nn(Hn.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new Je(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=Nn(Hn.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=Nn(Hn.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Je(e),seed:n,space:r,programId:new Je(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=Nn(Hn.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new Je(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=Nn(Hn.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Je(e),seed:n,programId:new Je(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=Nn(Hn.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new Je(e),seed:n,lamports:r,space:i,programId:new Je(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=Nn(Hn.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new Je(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(Hn.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Nn(Hn.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=Nn(Hn.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new Je(e)}}static checkProgramId(t){if(!t.equals(Kn.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length0?i:1,space:o.length,programId:r}));null!==a&&await On(t,a,[e,n],{commitment:"confirmed"})}const s=Jt.struct([Jt.u32("instruction"),Jt.u32("offset"),Jt.u32("bytesLength"),Jt.u32("bytesLengthPadding"),Jt.seq(Jt.u8("byte"),Jt.offset(Jt.u32(),-8),"bytes")]),a=Vn.chunkSize;let u=0,c=o,d=[];for(;c.length>0;){const o=c.slice(0,a),l=i.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:o,bytesLength:0,bytesLengthPadding:0},l);const h=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push(On(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await Dn(1e3/t)}u+=a,c=c.slice(a)}await Promise.all(d);{const o=Jt.struct([Jt.u32("instruction")]),s=i.Buffer.alloc(o.span);o.encode({instruction:1},s);const a=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1}],programId:r,data:s}),u="processed",c=await t.sendTransaction(a,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}Vn.chunkSize=qn;const Gn=new Je("BPFLoader2111111111111111111111111111111111");class Zn{static getMinNumSignatures(t){return Vn.getMinNumSignatures(t)}static load(t,e,n,r,i){return Vn.load(t,e,n,i,r)}}function Xn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jn=Object.prototype.toString,Qn=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function tr(t,e){var n,r,i,o,s,a,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return tr(t.toJSON(),e);if("[object Array]"===(u=Jn.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=tr(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Qn(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}class rr{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32)))-nr(32)-1;return[n,t-(this.getSlotsInEpoch(n)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}var e}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const n=(0,ie.Z)(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in n?n.socket:n,n}),t,e,n),this.underlyingSocket=void 0}call(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class cr{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${t.index}`);return n}(dr,t),n=t.length-56;mn(n>=0,"lookup table is invalid"),mn(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=Jt.struct([Jt.seq(cn(),r,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new Je(e.authority[0]):void 0,addresses:i.map((t=>new Je(t)))}}}const dr={index:1,layout:Jt.struct([Jt.u32("typeIndex"),Fn("deactivationSlot"),Jt.nu64("lastExtendedSlot"),Jt.u8("lastExtendedStartIndex"),Jt.u8(),Jt.seq(cn(),Jt.offset(Jt.u8(),-1),"authority")])},lr=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,hr=(0,te.oQ)((0,te.eE)(Je),(0,te.Z_)(),(t=>new Je(t))),fr=(0,te.bc)([(0,te.Z_)(),(0,te.i0)("base64")]),pr=(0,te.oQ)((0,te.eE)(i.Buffer),fr,(t=>i.Buffer.from(t[0],"base64"))),mr=3e4;function gr(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function yr(t){return(0,te.G0)([(0,te.dt)({jsonrpc:(0,te.i0)("2.0"),id:(0,te.Z_)(),result:t}),(0,te.dt)({jsonrpc:(0,te.i0)("2.0"),id:(0,te.Z_)(),error:(0,te.dt)({code:(0,te._4)(),message:(0,te.Z_)(),data:(0,te.jt)((0,te.Yj)())})})])}const br=yr((0,te._4)());function wr(t){return(0,te.oQ)(yr(t),br,(e=>"error"in e?e:{...e,result:(0,te.Ue)(e.result,t)}))}function _r(t){return wr((0,te.dt)({context:(0,te.dt)({slot:(0,te.Rx)()}),value:t}))}function vr(t){return(0,te.dt)({context:(0,te.dt)({slot:(0,te.Rx)()}),value:t})}function kr(t,e){return 0===t?new bn({header:e.header,staticAccountKeys:e.accountKeys.map((t=>new Je(t))),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Wt().decode(t.data)}))),addressTableLookups:e.addressTableLookups}):new yn(e)}const Mr=(0,te.dt)({foundation:(0,te.Rx)(),foundationTerm:(0,te.Rx)(),initial:(0,te.Rx)(),taper:(0,te.Rx)(),terminal:(0,te.Rx)()}),Ar=wr((0,te.IX)((0,te.AG)((0,te.dt)({epoch:(0,te.Rx)(),effectiveSlot:(0,te.Rx)(),amount:(0,te.Rx)(),postBalance:(0,te.Rx)(),commission:(0,te.jt)((0,te.AG)((0,te.Rx)()))})))),Sr=(0,te.IX)((0,te.dt)({slot:(0,te.Rx)(),prioritizationFee:(0,te.Rx)()})),Ir=(0,te.dt)({total:(0,te.Rx)(),validator:(0,te.Rx)(),foundation:(0,te.Rx)(),epoch:(0,te.Rx)()}),xr=(0,te.dt)({epoch:(0,te.Rx)(),slotIndex:(0,te.Rx)(),slotsInEpoch:(0,te.Rx)(),absoluteSlot:(0,te.Rx)(),blockHeight:(0,te.jt)((0,te.Rx)()),transactionCount:(0,te.jt)((0,te.Rx)())}),Er=(0,te.dt)({slotsPerEpoch:(0,te.Rx)(),leaderScheduleSlotOffset:(0,te.Rx)(),warmup:(0,te.O7)(),firstNormalEpoch:(0,te.Rx)(),firstNormalSlot:(0,te.Rx)()}),Tr=(0,te.IM)((0,te.Z_)(),(0,te.IX)((0,te.Rx)())),Pr=(0,te.AG)((0,te.G0)([(0,te.dt)({}),(0,te.Z_)()])),Br=(0,te.dt)({err:Pr}),Lr=(0,te.i0)("receivedSignature"),$r=(0,te.dt)({"solana-core":(0,te.Z_)(),"feature-set":(0,te.jt)((0,te.Rx)())}),Rr=_r((0,te.dt)({err:(0,te.AG)((0,te.G0)([(0,te.dt)({}),(0,te.Z_)()])),logs:(0,te.AG)((0,te.IX)((0,te.Z_)())),accounts:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.AG)((0,te.dt)({executable:(0,te.O7)(),owner:(0,te.Z_)(),lamports:(0,te.Rx)(),data:(0,te.IX)((0,te.Z_)()),rentEpoch:(0,te.jt)((0,te.Rx)())}))))),unitsConsumed:(0,te.jt)((0,te.Rx)()),returnData:(0,te.jt)((0,te.AG)((0,te.dt)({programId:(0,te.Z_)(),data:(0,te.bc)([(0,te.Z_)(),(0,te.i0)("base64")])})))})),Or=_r((0,te.dt)({byIdentity:(0,te.IM)((0,te.Z_)(),(0,te.IX)((0,te.Rx)())),range:(0,te.dt)({firstSlot:(0,te.Rx)(),lastSlot:(0,te.Rx)()})})),Dr=wr(Mr),Cr=wr(Ir),Nr=wr(Sr),zr=wr(xr),Ur=wr(Er),jr=wr(Tr),Yr=wr((0,te.Rx)()),Fr=_r((0,te.dt)({total:(0,te.Rx)(),circulating:(0,te.Rx)(),nonCirculating:(0,te.Rx)(),nonCirculatingAccounts:(0,te.IX)(hr)})),Wr=(0,te.dt)({amount:(0,te.Z_)(),uiAmount:(0,te.AG)((0,te.Rx)()),decimals:(0,te.Rx)(),uiAmountString:(0,te.jt)((0,te.Z_)())}),Hr=_r((0,te.IX)((0,te.dt)({address:hr,amount:(0,te.Z_)(),uiAmount:(0,te.AG)((0,te.Rx)()),decimals:(0,te.Rx)(),uiAmountString:(0,te.jt)((0,te.Z_)())}))),Kr=_r((0,te.IX)((0,te.dt)({pubkey:hr,account:(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:pr,rentEpoch:(0,te.Rx)()})}))),qr=(0,te.dt)({program:(0,te.Z_)(),parsed:(0,te._4)(),space:(0,te.Rx)()}),Vr=_r((0,te.IX)((0,te.dt)({pubkey:hr,account:(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:qr,rentEpoch:(0,te.Rx)()})}))),Gr=_r((0,te.IX)((0,te.dt)({lamports:(0,te.Rx)(),address:hr}))),Zr=(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:pr,rentEpoch:(0,te.Rx)()}),Xr=(0,te.dt)({pubkey:hr,account:Zr}),Jr=(0,te.oQ)((0,te.G0)([(0,te.eE)(i.Buffer),qr]),(0,te.G0)([fr,qr]),(t=>Array.isArray(t)?(0,te.Ue)(t,pr):t)),Qr=(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:Jr,rentEpoch:(0,te.Rx)()}),ti=(0,te.dt)({pubkey:hr,account:Qr}),ei=(0,te.dt)({state:(0,te.G0)([(0,te.i0)("active"),(0,te.i0)("inactive"),(0,te.i0)("activating"),(0,te.i0)("deactivating")]),active:(0,te.Rx)(),inactive:(0,te.Rx)()}),ni=wr((0,te.IX)((0,te.dt)({signature:(0,te.Z_)(),slot:(0,te.Rx)(),err:Pr,memo:(0,te.AG)((0,te.Z_)()),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)()))}))),ri=wr((0,te.IX)((0,te.dt)({signature:(0,te.Z_)(),slot:(0,te.Rx)(),err:Pr,memo:(0,te.AG)((0,te.Z_)()),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)()))}))),ii=(0,te.dt)({subscription:(0,te.Rx)(),result:vr(Zr)}),oi=(0,te.dt)({pubkey:hr,account:Zr}),si=(0,te.dt)({subscription:(0,te.Rx)(),result:vr(oi)}),ai=(0,te.dt)({parent:(0,te.Rx)(),slot:(0,te.Rx)(),root:(0,te.Rx)()}),ui=(0,te.dt)({subscription:(0,te.Rx)(),result:ai}),ci=(0,te.G0)([(0,te.dt)({type:(0,te.G0)([(0,te.i0)("firstShredReceived"),(0,te.i0)("completed"),(0,te.i0)("optimisticConfirmation"),(0,te.i0)("root")]),slot:(0,te.Rx)(),timestamp:(0,te.Rx)()}),(0,te.dt)({type:(0,te.i0)("createdBank"),parent:(0,te.Rx)(),slot:(0,te.Rx)(),timestamp:(0,te.Rx)()}),(0,te.dt)({type:(0,te.i0)("frozen"),slot:(0,te.Rx)(),timestamp:(0,te.Rx)(),stats:(0,te.dt)({numTransactionEntries:(0,te.Rx)(),numSuccessfulTransactions:(0,te.Rx)(),numFailedTransactions:(0,te.Rx)(),maxTransactionsPerEntry:(0,te.Rx)()})}),(0,te.dt)({type:(0,te.i0)("dead"),slot:(0,te.Rx)(),timestamp:(0,te.Rx)(),err:(0,te.Z_)()})]),di=(0,te.dt)({subscription:(0,te.Rx)(),result:ci}),li=(0,te.dt)({subscription:(0,te.Rx)(),result:vr((0,te.G0)([Br,Lr]))}),hi=(0,te.dt)({subscription:(0,te.Rx)(),result:(0,te.Rx)()}),fi=(0,te.dt)({pubkey:(0,te.Z_)(),gossip:(0,te.AG)((0,te.Z_)()),tpu:(0,te.AG)((0,te.Z_)()),rpc:(0,te.AG)((0,te.Z_)()),version:(0,te.AG)((0,te.Z_)())}),pi=(0,te.dt)({votePubkey:(0,te.Z_)(),nodePubkey:(0,te.Z_)(),activatedStake:(0,te.Rx)(),epochVoteAccount:(0,te.O7)(),epochCredits:(0,te.IX)((0,te.bc)([(0,te.Rx)(),(0,te.Rx)(),(0,te.Rx)()])),commission:(0,te.Rx)(),lastVote:(0,te.Rx)(),rootSlot:(0,te.AG)((0,te.Rx)())}),mi=wr((0,te.dt)({current:(0,te.IX)(pi),delinquent:(0,te.IX)(pi)})),gi=(0,te.G0)([(0,te.i0)("processed"),(0,te.i0)("confirmed"),(0,te.i0)("finalized")]),yi=(0,te.dt)({slot:(0,te.Rx)(),confirmations:(0,te.AG)((0,te.Rx)()),err:Pr,confirmationStatus:(0,te.jt)(gi)}),bi=_r((0,te.IX)((0,te.AG)(yi))),wi=wr((0,te.Rx)()),_i=(0,te.dt)({accountKey:hr,writableIndexes:(0,te.IX)((0,te.Rx)()),readonlyIndexes:(0,te.IX)((0,te.Rx)())}),vi=(0,te.dt)({signatures:(0,te.IX)((0,te.Z_)()),message:(0,te.dt)({accountKeys:(0,te.IX)((0,te.Z_)()),header:(0,te.dt)({numRequiredSignatures:(0,te.Rx)(),numReadonlySignedAccounts:(0,te.Rx)(),numReadonlyUnsignedAccounts:(0,te.Rx)()}),instructions:(0,te.IX)((0,te.dt)({accounts:(0,te.IX)((0,te.Rx)()),data:(0,te.Z_)(),programIdIndex:(0,te.Rx)()})),recentBlockhash:(0,te.Z_)(),addressTableLookups:(0,te.jt)((0,te.IX)(_i))})}),ki=(0,te.dt)({pubkey:hr,signer:(0,te.O7)(),writable:(0,te.O7)(),source:(0,te.jt)((0,te.G0)([(0,te.i0)("transaction"),(0,te.i0)("lookupTable")]))}),Mi=(0,te.dt)({accountKeys:(0,te.IX)(ki),signatures:(0,te.IX)((0,te.Z_)())}),Ai=(0,te.dt)({parsed:(0,te._4)(),program:(0,te.Z_)(),programId:hr}),Si=(0,te.dt)({accounts:(0,te.IX)(hr),data:(0,te.Z_)(),programId:hr}),Ii=(0,te.G0)([Si,Ai]),xi=(0,te.G0)([(0,te.dt)({parsed:(0,te._4)(),program:(0,te.Z_)(),programId:(0,te.Z_)()}),(0,te.dt)({accounts:(0,te.IX)((0,te.Z_)()),data:(0,te.Z_)(),programId:(0,te.Z_)()})]),Ei=(0,te.oQ)(Ii,xi,(t=>"accounts"in t?(0,te.Ue)(t,Si):(0,te.Ue)(t,Ai))),Ti=(0,te.dt)({signatures:(0,te.IX)((0,te.Z_)()),message:(0,te.dt)({accountKeys:(0,te.IX)(ki),instructions:(0,te.IX)(Ei),recentBlockhash:(0,te.Z_)(),addressTableLookups:(0,te.jt)((0,te.AG)((0,te.IX)(_i)))})}),Pi=(0,te.dt)({accountIndex:(0,te.Rx)(),mint:(0,te.Z_)(),owner:(0,te.jt)((0,te.Z_)()),uiTokenAmount:Wr}),Bi=(0,te.dt)({writable:(0,te.IX)(hr),readonly:(0,te.IX)(hr)}),Li=(0,te.dt)({err:Pr,fee:(0,te.Rx)(),innerInstructions:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.dt)({index:(0,te.Rx)(),instructions:(0,te.IX)((0,te.dt)({accounts:(0,te.IX)((0,te.Rx)()),data:(0,te.Z_)(),programIdIndex:(0,te.Rx)()}))})))),preBalances:(0,te.IX)((0,te.Rx)()),postBalances:(0,te.IX)((0,te.Rx)()),logMessages:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.Z_)()))),preTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),postTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),loadedAddresses:(0,te.jt)(Bi),computeUnitsConsumed:(0,te.jt)((0,te.Rx)())}),$i=(0,te.dt)({err:Pr,fee:(0,te.Rx)(),innerInstructions:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.dt)({index:(0,te.Rx)(),instructions:(0,te.IX)(Ei)})))),preBalances:(0,te.IX)((0,te.Rx)()),postBalances:(0,te.IX)((0,te.Rx)()),logMessages:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.Z_)()))),preTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),postTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),loadedAddresses:(0,te.jt)(Bi),computeUnitsConsumed:(0,te.jt)((0,te.Rx)())}),Ri=(0,te.G0)([(0,te.i0)(0),(0,te.i0)("legacy")]),Oi=(0,te.dt)({pubkey:(0,te.Z_)(),lamports:(0,te.Rx)(),postBalance:(0,te.AG)((0,te.Rx)()),rewardType:(0,te.AG)((0,te.Z_)()),commission:(0,te.jt)((0,te.AG)((0,te.Rx)()))}),Di=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:vi,meta:(0,te.AG)(Li),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ci=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ni=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Mi,meta:(0,te.AG)(Li),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),zi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Ti,meta:(0,te.AG)($i),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ui=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Mi,meta:(0,te.AG)($i),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),ji=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Yi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:vi,meta:(0,te.AG)(Li)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)())}))),Fi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),signatures:(0,te.IX)((0,te.Z_)()),blockTime:(0,te.AG)((0,te.Rx)())}))),Wi=wr((0,te.AG)((0,te.dt)({slot:(0,te.Rx)(),meta:(0,te.AG)(Li),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)())),transaction:vi,version:(0,te.jt)(Ri)}))),Hi=wr((0,te.AG)((0,te.dt)({slot:(0,te.Rx)(),transaction:Ti,meta:(0,te.AG)($i),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)())),version:(0,te.jt)(Ri)}))),Ki=_r((0,te.dt)({blockhash:(0,te.Z_)(),feeCalculator:(0,te.dt)({lamportsPerSignature:(0,te.Rx)()})})),qi=_r((0,te.dt)({blockhash:(0,te.Z_)(),lastValidBlockHeight:(0,te.Rx)()})),Vi=_r((0,te.O7)()),Gi=(0,te.dt)({slot:(0,te.Rx)(),numTransactions:(0,te.Rx)(),numSlots:(0,te.Rx)(),samplePeriodSecs:(0,te.Rx)()}),Zi=wr((0,te.IX)(Gi)),Xi=_r((0,te.AG)((0,te.dt)({feeCalculator:(0,te.dt)({lamportsPerSignature:(0,te.Rx)()})}))),Ji=wr((0,te.Z_)()),Qi=wr((0,te.Z_)()),to=(0,te.dt)({err:Pr,logs:(0,te.IX)((0,te.Z_)()),signature:(0,te.Z_)()}),eo=(0,te.dt)({result:vr(to),subscription:(0,te.Rx)()}),no={"solana-client":"js/0.0.0-development"};class ro{constructor(t,e){let n,r,i,o,s,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const t={};return async e=>{const{commitment:n,config:r}=gr(e),i=this._buildArgs([],n,void 0,r),o=er(i);return t[o]=t[o]??(async()=>{try{const t=await this._rpcRequest("getBlockHeight",i),e=(0,te.Ue)(t,wr((0,te.Rx)()));if("error"in e)throw new sr(e.error,"failed to get block height information");return e.result}finally{delete t[o]}})(),await t[o]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,n=e.wsEndpoint,r=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=n||function(t){const e=t.match(lr);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);const[n,r,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(t),this._rpcClient=function(t,e,n,r,i,o){const s=n||ar;let a;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(t,e)=>{const n=await new Promise(((n,i)=>{try{r(t,e,((t,e)=>n([t,e])))}catch(t){i(t)}}));return await s(...n)}),new(ne())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},no)};try{let e,n=5,u=500;for(;e=a?await a(t,o):await s(t,o),429===e.status&&!0!==i&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await Dn(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{})}(t,r,i,o,s,a),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new ur(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=await this._rpcRequest("getBalance",i),s=(0,te.Ue)(o,_r((0,te.Rx)()));if("error"in s)throw new sr(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=await this._rpcRequest("getBlockTime",[t]),n=(0,te.Ue)(e,wr((0,te.AG)((0,te.Rx)())));if("error"in n)throw new sr(n.error,`failed to get block time for slot ${t}`);return n.result}async getMinimumLedgerSlot(){const t=await this._rpcRequest("minimumLedgerSlot",[]),e=(0,te.Ue)(t,wr((0,te.Rx)()));if("error"in e)throw new sr(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const t=await this._rpcRequest("getFirstAvailableBlock",[]),e=(0,te.Ue)(t,Yr);if("error"in e)throw new sr(e.error,"failed to get first available block");return e.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=await this._rpcRequest("getSupply",[e]),r=(0,te.Ue)(n,Fr);if("error"in r)throw new sr(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenSupply",n),i=(0,te.Ue)(r,_r(Wr));if("error"in i)throw new sr(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenAccountBalance",n),i=(0,te.Ue)(r,_r(Wr));if("error"in i)throw new sr(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=gr(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=await this._rpcRequest("getTokenAccountsByOwner",s),u=(0,te.Ue)(a,Kr);if("error"in u)throw new sr(u.error,`failed to get token accounts owned by account ${t.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",i),s=(0,te.Ue)(o,Vr);if("error"in s)throw new sr(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=await this._rpcRequest("getLargestAccounts",n),i=(0,te.Ue)(r,Gr);if("error"in i)throw new sr(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenLargestAccounts",n),i=(0,te.Ue)(r,Hr);if("error"in i)throw new sr(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,te.Ue)(o,_r((0,te.AG)(Zr)));if("error"in s)throw new sr(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,te.Ue)(o,_r((0,te.AG)(Qr)));if("error"in s)throw new sr(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,te.Ue)(s,_r((0,te.IX)((0,te.AG)(Qr))));if("error"in a)throw new sr(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,te.Ue)(s,_r((0,te.IX)((0,te.AG)(Zr))));if("error"in a)throw new sr(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=gr(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),s=await this._rpcRequest("getStakeActivation",o),a=(0,te.Ue)(s,wr(ei));if("error"in a)throw new sr(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=gr(e),{encoding:i,...o}=r||{},s=this._buildArgs([t.toBase58()],n,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=(0,te.IX)(Xr),c=!0===o.withContext?(0,te.Ue)(a,_r(u)):(0,te.Ue)(a,wr(u));if("error"in c)throw new sr(c.error,`failed to get accounts owned by program ${t.toBase58()}`);return c.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getProgramAccounts",i),s=(0,te.Ue)(o,wr((0,te.IX)(ti)));if("error"in s)throw new sr(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{const e=t;if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);n=e.signature}try{r=Wt().decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}return mn(64===r.length,"signature has invalid length"),"string"==typeof t?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise(((e,n)=>{null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(()=>{n(t.reason)})))}))}getTransactionConfirmationPromise({commitment:t,signature:e}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,s)=>{try{n=this.onSignature(e,((t,e)=>{n=void 0;const r={context:e,value:t};o({__type:_n.PROCESSED,response:r})}),t);const a=new Promise((t=>{null==n?t():r=this._onSubscriptionStateChange(n,(e=>{"subscribed"===e&&t()}))}));(async()=>{if(await a,i)return;const n=await this.getSignatureStatus(e);if(i)return;if(null==n)return;const{context:r,value:u}=n;if(null!=u)if(u?.err)s(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,o({__type:_n.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((e=>{const r=async()=>{try{return await this.getBlockHeight(t)}catch(t){return-1}};(async()=>{let t=await r();if(!i){for(;t<=n;){if(await Dn(1e3),i)return;if(t=await r(),i)return}e({__type:_n.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:t,signature:r}),u=this.getCancellationPromise(e);let c;try{const t=await Promise.race([u,a,o]);if(t.__type!==_n.PROCESSED)throw new on(r);c=t.response}finally{i=!0,s()}return c}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let s=!1;const a=new Promise((e=>{let o=i,a=null;const u=async()=>{try{const{context:e,value:i}=await this.getNonceAndContext(r,{commitment:t,minContextSlot:n});return a=e.slot,i?.nonce}catch(t){return o}};(async()=>{if(o=await u(),!s)for(;;){if(i!==o)return void e({__type:_n.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await Dn(2e3),s)return;if(o=await u(),s)return}})()})),{abortConfirmation:u,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(e);let l;try{const e=await Promise.race([d,c,a]);if(e.__type===_n.PROCESSED)l=e.response;else{let r;for(;;){const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(e.slotInWhichNonceDidAdvance??n))){r=t;break}await Dn(400)}if(!r?.value)throw new an(o);{const e=t||"finalized",{confirmationStatus:n}=r.value;switch(e){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new an(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new an(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new an(o)}l={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,u()}return l}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let n;const r=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>e({__type:_n.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});let s;try{const t=await Promise.race([o,r]);if(t.__type!==_n.PROCESSED)throw new sn(e,t.timeoutMs/1e3);s=t.response}finally{clearTimeout(n),i()}return s}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),e=(0,te.Ue)(t,wr((0,te.IX)(fi)));if("error"in e)throw new sr(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getVoteAccounts",e),r=(0,te.Ue)(n,mi);if("error"in r)throw new sr(r.error,"failed to get vote accounts");return r.result}async getSlot(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlot",r),o=(0,te.Ue)(i,wr((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get slot");return o.result}async getSlotLeader(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlotLeader",r),o=(0,te.Ue)(i,wr((0,te.Z_)()));if("error"in o)throw new sr(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(t,e){const n=[t,e],r=await this._rpcRequest("getSlotLeaders",n),i=(0,te.Ue)(r,wr((0,te.IX)(hr)));if("error"in i)throw new sr(i.error,"failed to get slot leaders");return i.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);return mn(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=await this._rpcRequest("getSignatureStatuses",n),i=(0,te.Ue)(r,bi);if("error"in i)throw new sr(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getTransactionCount",r),o=(0,te.Ue)(i,wr((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get transaction count");return o.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getInflationGovernor",e),r=(0,te.Ue)(n,Dr);if("error"in r)throw new sr(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=gr(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:i?.epoch}),s=await this._rpcRequest("getInflationReward",o),a=(0,te.Ue)(s,Ar);if("error"in a)throw new sr(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){const t=await this._rpcRequest("getInflationRate",[]),e=(0,te.Ue)(t,Cr);if("error"in e)throw new sr(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getEpochInfo",r),o=(0,te.Ue)(i,zr);if("error"in o)throw new sr(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){const t=await this._rpcRequest("getEpochSchedule",[]),e=(0,te.Ue)(t,Ur);if("error"in e)throw new sr(e.error,"failed to get epoch schedule");const n=e.result;return new rr(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),e=(0,te.Ue)(t,jr);if("error"in e)throw new sr(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getMinimumBalanceForRentExemption",n),i=(0,te.Ue)(r,wi);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getRecentBlockhash",e),r=(0,te.Ue)(n,Ki);if("error"in r)throw new sr(r.error,"failed to get recent blockhash");return r.result}async getRecentPerformanceSamples(t){const e=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),n=(0,te.Ue)(e,Zi);if("error"in n)throw new sr(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getFeeCalculatorForBlockhash",n),i=(0,te.Ue)(r,Xi);if("error"in i)throw new sr(i.error,"failed to get fee calculator");const{context:o,value:s}=i.result;return{context:o,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){const n=Fe(t.serialize()).toString("base64"),r=this._buildArgs([n],e),i=await this._rpcRequest("getFeeForMessage",r),o=(0,te.Ue)(i,_r((0,te.AG)((0,te.Rx)())));if("error"in o)throw new sr(o.error,"failed to get fee for message");if(null===o.result)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(t){const e=t?.lockedWritableAccounts?.map((t=>t.toBase58())),n=e?.length?[e]:[],r=await this._rpcRequest("getRecentPrioritizationFees",n),i=(0,te.Ue)(r,Nr);if("error"in i)throw new sr(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getLatestBlockhash",r),o=(0,te.Ue)(i,qi);if("error"in o)throw new sr(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t],n,void 0,r),o=await this._rpcRequest("isBlockhashValid",i),s=(0,te.Ue)(o,Vi);if("error"in s)throw new sr(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){const t=await this._rpcRequest("getVersion",[]),e=(0,te.Ue)(t,wr($r));if("error"in e)throw new sr(e.error,"failed to get version");return e.result}async getGenesisHash(){const t=await this._rpcRequest("getGenesisHash",[]),e=(0,te.Ue)(t,wr((0,te.Z_)()));if("error"in e)throw new sr(e.error,"failed to get genesis hash");return e.result}async getBlock(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,te.Ue)(o,Ni);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,te.Ue)(o,Ci);if("error"in t)throw t.error;return t.result}default:{const t=(0,te.Ue)(o,Di);if("error"in t)throw t.error;const{result:e}=t;return e?{...e,transactions:e.transactions.map((({transaction:t,meta:e,version:n})=>({meta:e,transaction:{...t,message:kr(n,t.message)},version:n})))}:null}}}catch(t){throw new sr(t,"failed to get confirmed block")}}async getParsedBlock(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,te.Ue)(o,Ui);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,te.Ue)(o,ji);if("error"in t)throw t.error;return t.result}default:{const t=(0,te.Ue)(o,zi);if("error"in t)throw t.error;return t.result}}}catch(t){throw new sr(t,"failed to get block")}}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=await this._rpcRequest("getBlockProduction",r),o=(0,te.Ue)(i,Or);if("error"in o)throw new sr(o.error,"failed to get block production information");return o.result}async getTransaction(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getTransaction",i),s=(0,te.Ue)(o,Wi);if("error"in s)throw new sr(s.error,"failed to get transaction");const a=s.result;return a?{...a,transaction:{...a.transaction,message:kr(a.version,a.transaction.message)}}:a}async getParsedTransaction(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getTransaction",i),s=(0,te.Ue)(o,Hi);if("error"in s)throw new sr(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,te.Ue)(t,Hi);if("error"in e)throw new sr(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,te.Ue)(t,Wi);if("error"in e)throw new sr(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:kr(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,te.Ue)(r,Yi);if("error"in i)throw new sr(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");const s={...o,transactions:o.transactions.map((({transaction:t,meta:e})=>{const n=new yn(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...s,transactions:s.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:Mn.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=await this._rpcRequest("getBlocks",r),o=(0,te.Ue)(i,wr((0,te.IX)((0,te.Rx)())));if("error"in o)throw new sr(o.error,"failed to get blocks");return o.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),i=(0,te.Ue)(r,Fi);if("error"in i)throw new sr(i.error,"failed to get block");const o=i.result;if(!o)throw new Error("Block "+t+" not found");return o}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,te.Ue)(r,Fi);if("error"in i)throw new sr(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");return o}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,te.Ue)(r,Wi);if("error"in i)throw new sr(i.error,"failed to get transaction");const o=i.result;if(!o)return o;const s=new yn(o.transaction.message),a=o.transaction.signatures;return{...o,transaction:Mn.populate(s,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,te.Ue)(r,Hi);if("error"in i)throw new sr(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=(0,te.Ue)(t,Hi);if("error"in e)throw new sr(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getConfirmedSignaturesForAddress2",r),o=(0,te.Ue)(i,ni);if("error"in o)throw new sr(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getSignaturesForAddress",r),o=(0,te.Ue)(i,ri);if("error"in o)throw new sr(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=new cr({key:t,state:cr.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=Yn.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),r=(0,te.Ue)(n,Ji);if("error"in r)throw new sr(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await Dn(100);const t=Date.now()-this._blockhashInfo.lastFetch>=mr;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await Dn(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,"base64",n),i=await this._rpcRequest("getStakeMinimumDelegation",r),o=(0,te.Ue)(i,_r((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(t,e,n){if("message"in t){const r=t.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(e)||void 0!==n)throw new Error("Invalid arguments");const s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment);const a=[o,s],u=await this._rpcRequest("simulateTransaction",a),c=(0,te.Ue)(u,Rr);if("error"in c)throw new Error("failed to simulate transaction: "+c.error.message);return c.result}let r;if(t instanceof Mn){let e=t;r=new Mn,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=Mn.populate(t),r._message=r._json=void 0;if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid arguments");const o=e;if(r.nonceInfo&&o)r.sign(...o);else{let t=this._disableBlockhashCaching;for(;;){const e=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=e.lastValidBlockHeight,r.recentBlockhash=e.blockhash,!o)break;if(r.sign(...o),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}t=!0}}const s=r._compile(),a=s.serialize(),u=r._serialize(a).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:s.nonProgramIds()).map((t=>t.toBase58()));c.accounts={encoding:"base64",addresses:t}}o&&(c.sigVerify=!0);const d=[u,c],l=await this._rpcRequest("simulateTransaction",d),h=(0,te.Ue)(l,Rr);if("error"in h){let t;if("data"in h.error&&(t=h.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(h.error.message,n)}throw new ir("failed to simulate transaction: "+h.error.message,t)}return h.result}async sendTransaction(t,e,n){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const n=t.serialize();return await this.sendRawTransaction(n,e)}if(void 0===e||!Array.isArray(e))throw new Error("Invalid arguments");const r=e;if(t.nonceInfo)t.sign(...r);else{let e=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(e);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...r),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}e=!0}}const i=t.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(t,e){const n=Fe(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],s=await this._rpcRequest("sendTransaction",o),a=(0,te.Ue)(s,Qi);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new ir("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(t,e){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,n!==e.state){const n=this._subscriptionStateChangeCallbacksByHash[t];n&&n.forEach((t=>{try{t(e.state)}catch{}}))}}_onSubscriptionStateChange(t,e){const n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(e),()=>{r.delete(e),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const e=await this._rpcWebSocket.call(i,r);this._setSubscription(t,{...n,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,ii);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=er([t.method,e],!0),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];mn(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,si);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,eo);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,ui);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,di);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,li);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),s=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,hi);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class io{constructor(t){this._keypair=void 0,this._keypair=t??Ne()}static generate(){return new io(Ne())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=ze(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new io({publicKey:n,secretKey:t})}static fromSeed(t){const e=ze(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new io({publicKey:e,secretKey:n})}get publicKey(){return new Je(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const oo=Object.freeze({CreateLookupTable:{index:0,layout:Jt.struct([Jt.u32("instruction"),Fn("recentSlot"),Jt.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Jt.struct([Jt.u32("instruction")])},ExtendLookupTable:{index:2,layout:Jt.struct([Jt.u32("instruction"),Fn(),Jt.seq(cn(),Jt.offset(Jt.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Jt.struct([Jt.u32("instruction")])},CloseLookupTable:{index:4,layout:Jt.struct([Jt.u32("instruction")])}});class so{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(oo))if(r.index==e){n=t;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);const{recentSlot:e}=Nn(oo.CreateLookupTable,t.data);return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error(`invalid instruction; found ${t.keys.length} keys, expected at least 2`);const{addresses:e}=Nn(oo.ExtendLookupTable,t.data);return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((t=>new Je(t)))}}static decodeCloseLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}static decodeFreezeLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static decodeDeactivateLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(ao.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(t,e){if(t.lengtht.toBytes()))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Kn.programId,isSigner:!1,isWritable:!1}),new kn({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=Cn(oo.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new kn({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=Cn(oo.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new kn({programId:this.programId,keys:n,data:e})}}ao.programId=new Je("AddressLookupTab1e1111111111111111111111111");class uo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u8("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(co))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=Nn(co.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=Nn(co.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=Nn(co.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=Nn(co.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(lo.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const co=Object.freeze({RequestUnits:{index:0,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("units"),Jt.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("units")])},SetComputeUnitPrice:{index:3,layout:Jt.struct([Jt.u8("instruction"),Fn("microLamports")])}});class lo{constructor(){}static requestUnits(t){const e=Cn(co.RequestUnits,t);return new kn({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=Cn(co.RequestHeapFrame,t);return new kn({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=Cn(co.SetComputeUnitLimit,t);return new kn({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=Cn(co.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new kn({keys:[],programId:this.programId,data:e})}}lo.programId=new Je("ComputeBudget111111111111111111111111111111");const ho=Jt.struct([Jt.u8("numSignatures"),Jt.u8("padding"),Jt.u16("signatureOffset"),Jt.u16("signatureInstructionIndex"),Jt.u16("publicKeyOffset"),Jt.u16("publicKeyInstructionIndex"),Jt.u16("messageDataOffset"),Jt.u16("messageDataSize"),Jt.u16("messageInstructionIndex")]);class fo{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:o}=t;mn(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),mn(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const s=ho.span,a=s+e.length,u=a+r.length,c=i.Buffer.alloc(u+n.length),d=null==o?65535:o;return ho.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,s),c.fill(r,a),c.fill(n,u),new kn({keys:[],programId:fo.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;mn(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=io.fromSecretKey(e),i=t.publicKey.toBytes(),o=je(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}fo.programId=new Je("Ed25519SigVerify111111111111111111111111111"),De.utils.isValidPrivateKey;const po=De.getPublicKey,mo=Jt.struct([Jt.u8("numSignatures"),Jt.u16("signatureOffset"),Jt.u8("signatureInstructionIndex"),Jt.u16("ethAddressOffset"),Jt.u8("ethAddressInstructionIndex"),Jt.u16("messageDataOffset"),Jt.u16("messageDataSize"),Jt.u8("messageInstructionIndex"),Jt.blob(20,"ethAddress"),Jt.blob(64,"signature"),Jt.u8("recoveryId")]);class go{constructor(){}static publicKeyToEthAddress(t){mn(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return i.Buffer.from(we(Fe(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return go.createInstructionWithEthAddress({ethAddress:go.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:o,instructionIndex:s=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?i.Buffer.from(e.substr(2),"hex"):i.Buffer.from(e,"hex"):e,mn(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,c=u+r.length+1,d=i.Buffer.alloc(mo.span+n.length);return mo.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:s,signature:Fe(r),ethAddress:Fe(a),recoveryId:o},d),d.fill(Fe(n),mo.span),new kn({keys:[],programId:go.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;mn(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=Fe(e),o=po(t,!1).slice(1),s=i.Buffer.from(we(Fe(n))),[a,u]=((t,e)=>{const n=De.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(s,t);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var yo;go.programId=new Je("KeccakSecp256k11111111111111111111111111111");const bo=new Je("StakeConfig11111111111111111111111111111111");class wo{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class _o{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}yo=_o,_o.default=new yo(0,0,Je.default);class vo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ko))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=Nn(ko.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new wo(new Je(e.staker),new Je(e.withdrawer)),lockup:new _o(n.unixTimestamp,n.epoch,new Je(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),Nn(ko.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=Nn(ko.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Je(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Nn(ko.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new Je(i),newAuthorizedPubkey:new Je(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Nn(ko.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(ko.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Nn(ko.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(ko.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(Ao.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.lengthJt.struct([cn("staker"),cn("withdrawer")],t))(),((t="lockup")=>Jt.struct([Jt.ns64("unixTimestamp"),Jt.ns64("epoch"),cn("custodian")],t))()])},Authorize:{index:1,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:Jt.struct([Jt.u32("instruction")])},Split:{index:3,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},Withdraw:{index:4,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},Deactivate:{index:5,layout:Jt.struct([Jt.u32("instruction")])},Merge:{index:7,layout:Jt.struct([Jt.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("stakeAuthorizationType"),ln("authoritySeed"),cn("authorityOwner")])}}),Mo=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Ao{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||_o.default,o=Cn(ko.Initialize,{authorized:{staker:Fe(n.staker.toBuffer()),withdrawer:Fe(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Fe(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new kn(s)}static createAccountWithSeed(t){const e=new Mn;e.add(Kn.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new Mn;e.add(Kn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=Cn(ko.Delegate);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:bo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=Cn(ko.Authorize,{newAuthorized:Fe(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=Cn(ko.AuthorizeWithSeed,{newAuthorized:Fe(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:Fe(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new Mn).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=Cn(ko.Split,{lamports:i});return new kn({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new Mn;return e.add(Kn.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:s}=t,a=new Mn;return a.add(Kn.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),a.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:s}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=Cn(ko.Merge);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=Cn(ko.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=Cn(ko.Deactivate);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}Ao.programId=new Je("Stake11111111111111111111111111111111111111"),Ao.space=200;class So{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}class Io{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(xo))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=Nn(xo.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new So(new Je(e.nodePubkey),new Je(e.authorizedVoter),new Je(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=Nn(xo.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Je(e),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:e,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Nn(xo.AuthorizeWithSeed,t.data);return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new Je(e),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new Je(r),voteAuthorizationType:{index:i},votePubkey:t.keys[0].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Nn(xo.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(To.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.lengthJt.struct([cn("nodePubkey"),cn("authorizedVoter"),cn("authorizedWithdrawer"),Jt.u8("commission")],t))()])},Authorize:{index:1,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},AuthorizeWithSeed:{index:10,layout:Jt.struct([Jt.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>Jt.struct([Jt.u32("voteAuthorizationType"),cn("currentAuthorityDerivedKeyOwnerPubkey"),ln("currentAuthorityDerivedKeySeed"),cn("newAuthorized")],t))()])}}),Eo=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class To{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=Cn(xo.InitializeAccount,{voteInit:{nodePubkey:Fe(r.nodePubkey.toBuffer()),authorizedVoter:Fe(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Fe(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new kn(o)}static createAccount(t){const e=new Mn;return e.add(Kn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=Cn(xo.Authorize,{newAuthorized:Fe(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=Cn(xo.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Fe(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Fe(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=Cn(xo.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return To.withdraw(t)}}To.programId=new Je("Vote111111111111111111111111111111111111111"),To.space=3731;const Po=new Je("Va1idator1nfo111111111111111111111111111111"),Bo=(0,te.dt)({name:(0,te.Z_)(),website:(0,te.jt)((0,te.Z_)()),details:(0,te.jt)((0,te.Z_)()),keybaseUsername:(0,te.jt)((0,te.Z_)())});class Lo{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==fn(e))return null;const n=[];for(let t=0;t<2;t++){const t=new Je(e.slice(0,Ze));e=e.slice(Ze);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(Po)&&n[1].isSigner){const t=ln().decode(i.Buffer.from(e)),r=JSON.parse(t);return(0,te.hu)(r,Bo),new Lo(n[1].publicKey,r)}return null}}const $o=new Je("Vote111111111111111111111111111111111111111"),Ro=Jt.struct([cn("nodePubkey"),cn("authorizedWithdrawer"),Jt.u8("commission"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("slot"),Jt.u32("confirmationCount")]),Jt.offset(Jt.u32(),-8),"votes"),Jt.u8("rootSlotValid"),Jt.nu64("rootSlot"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("epoch"),cn("authorizedVoter")]),Jt.offset(Jt.u32(),-8),"authorizedVoters"),Jt.struct([Jt.seq(Jt.struct([cn("authorizedPubkey"),Jt.nu64("epochOfLastAuthorizedSwitch"),Jt.nu64("targetEpoch")]),32,"buf"),Jt.nu64("idx"),Jt.u8("isEmpty")],"priorVoters"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("epoch"),Jt.nu64("credits"),Jt.nu64("prevCredits")]),Jt.offset(Jt.u32(),-8),"epochCredits"),Jt.struct([Jt.nu64("slot"),Jt.nu64("timestamp")],"lastTimestamp")]);class Oo{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=Ro.decode(Fe(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Oo({nodePubkey:new Je(e.nodePubkey),authorizedWithdrawer:new Je(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(Do),priorVoters:No(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function Do({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new Je(t)}}function Co({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new Je(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function No({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(Co),...t.slice(0,e).map(Co)]}const zo={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Uo(t,e){const n=!1===e?"http":"https";if(!t)return zo[n].devnet;const r=zo[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r}async function jo(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await t.sendRawTransaction(e,s),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(a,u),d=(await c).value;if(d.err)throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`);return a}const Yo=1e9},64906:(t,e,n)=>{"use strict";var r=n(48764).Buffer,i=n(64836);e.Z=void 0;var o=i(n(64687)),s=i(n(17156)),a=i(n(18698)),u=i(n(56690)),c=i(n(89728)),d=i(n(61655)),l=i(n(94993)),h=i(n(73808)),f=n(26729),p=n(63925);var m=function(t){(0,d.default)(b,t);var e,n,i,f,m,g,y=(m=b,g=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=(0,h.default)(m);if(g){var n=(0,h.default)(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return(0,l.default)(this,t)});function b(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;(0,u.default)(this,b);var s=r.autoconnect,a=void 0===s||s,c=r.reconnect,d=void 0===c||c,l=r.reconnect_interval,h=void 0===l?1e3:l,f=r.max_reconnects,m=void 0===f?5:f,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);in.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),b}(f.EventEmitter);e.Z=m},55852:(t,e,n)=>{"use strict";var r=n(64836);e.Z=function(t,e){return new c(t,e)};var i=r(n(56690)),o=r(n(89728)),s=r(n(61655)),a=r(n(94993)),u=r(n(73808));var c=function(t){(0,s.default)(c,t);var e,n,r=(e=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=(0,u.default)(e);if(n){var i=(0,u.default)(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return(0,a.default)(this,t)});function c(t,e,n){var o;return(0,i.default)(this,c),(o=r.call(this)).socket=new window.WebSocket(t,n),o.socket.onopen=function(){return o.emit("open")},o.socket.onmessage=function(t){return o.emit("message",t.data)},o.socket.onerror=function(t){return o.emit("error",t)},o.socket.onclose=function(t){o.emit("close",t.code,t.reason)},o}return(0,o.default)(c,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),c}(n(26729).EventEmitter)},63925:(t,e,n)=>{"use strict";var r=n(64836);Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDataPack=void 0,e.createError=function(t,e){var n={code:t,message:s.get(t)||"Internal Server Error"};return e&&(n.data=e),n};var i=r(n(56690)),o=r(n(89728)),s=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),a=function(){function t(){(0,i.default)(this,t)}return(0,o.default)(t,[{key:"encode",value:function(t){return JSON.stringify(t)}},{key:"decode",value:function(t){return JSON.parse(t)}}]),t}();e.DefaultDataPack=a},66259:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(14319),e),i(n(51084),e)},46494:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.DecimalUtil=void 0;const i=r(n(13550)),o=r(n(93776));e.DecimalUtil=class{static adjustDecimals(t,e=0){return t.div(o.default.pow(10,e))}static fromBN(t,e=0){return new o.default(t.toString()).div(new o.default(10).pow(e))}static fromNumber(t,e=0){return new o.default(t).div(new o.default(10).pow(e))}static toBN(t,e=0){if(t.isNeg())throw new Error("Negative decimal value ${input} cannot be converted to BN.");const n=t.mul(new o.default(10).pow(e)).trunc();return new i.default(n.toString())}}},14319:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(46494),e),i(n(44667),e),i(n(67399),e)},44667:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MathUtil=e.U64_MAX=e.U128=e.TWO=e.ONE=e.ZERO=void 0;const i=r(n(13550)),o=r(n(93776));e.ZERO=new i.default(0),e.ONE=new i.default(1),e.TWO=new i.default(2),e.U128=e.TWO.pow(new i.default(128)),e.U64_MAX=e.TWO.pow(new i.default(64)).sub(e.ONE),e.MathUtil=class{static toX64_BN(t){return t.mul(new i.default(2).pow(new i.default(64)))}static toX64_Decimal(t){return t.mul(o.default.pow(2,64))}static toX64(t){return new i.default(t.mul(o.default.pow(2,64)).floor().toFixed())}static fromX64(t){return new o.default(t.toString()).mul(o.default.pow(2,-64))}static fromX64_Decimal(t){return t.mul(o.default.pow(2,-64))}static fromX64_BN(t){return t.div(new i.default(2).pow(new i.default(64)))}static shiftRightRoundUp(t){let n=t.shrn(64);return t.mod(e.U64_MAX).gt(e.ZERO)&&(n=n.add(e.ONE)),n}static divRoundUp(t,n){return t.mod(n).eq(e.ZERO)?t.div(n):t.div(n).add(new i.default(1))}static subUnderflowU128(t,n){return t.add(e.U128).sub(n).mod(e.U128)}}},67399:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Percentage=void 0;const i=r(n(13550)),o=r(n(93776));class s{constructor(t,e){this.toString=()=>`${this.numerator.toString()}/${this.denominator.toString()}`,this.numerator=t,this.denominator=e}static fromDecimal(t){return s.fromFraction(t.toDecimalPlaces(1).mul(10).toNumber(),1e3)}static fromFraction(t,e){const n="number"==typeof t?new i.default(t.toString()):t,r="number"==typeof e?new i.default(e.toString()):e;return new s(n,r)}toDecimal(){return this.denominator.eq(new i.default(0))?new o.default(0):new o.default(this.numerator.toString()).div(new o.default(this.denominator.toString()))}add(t){const e=this.denominator.gcd(t.denominator),n=this.denominator.div(e).mul(t.denominator),r=n.div(this.denominator),o=n.div(t.denominator),a=this.numerator.mul(r),u=t.numerator.mul(o),c=a.add(u);return new s(new i.default(c.toString()),new i.default(n.toString()))}}e.Percentage=s},7623:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddressUtil=void 0;const r=n(18245);class i{static toPubKey(t){return t instanceof r.PublicKey?t:new r.PublicKey(t)}static toPubKeys(t){return t.map((t=>i.toPubKey(t)))}static toString(t){return"string"==typeof t?t:i.toPubKey(t).toBase58()}static toStrings(t){return t.map((t=>i.toString(t)))}static findProgramAddress(t,e){const[n,i]=r.PublicKey.findProgramAddressSync(t,e);return{publicKey:n,bump:i}}}e.AddressUtil=i},36208:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolveOrCreateATAs=e.resolveOrCreateATA=void 0;const r=n(29955),i=n(14319),o=n(64911),s=n(67209),a=n(97864);async function u(t,e,n,u,c=e,d=!1,l=!1,h="keypair"){const f=n.filter((({tokenMint:t})=>!t.equals(r.NATIVE_MINT))),p=n.filter((({tokenMint:t})=>t.equals(r.NATIVE_MINT))),m=n.filter((({tokenMint:t})=>t.equals(r.NATIVE_MINT_2022)));if(p.length>1)throw new Error("Cannot resolve multiple WSolAccounts");if(m.length>0)throw new Error("NATIVE_MINT_2022 is not supported");let g={};if(f.length>0){const n=await(0,o.getMultipleParsedAccounts)(t,f.map((t=>t.tokenMint)),o.ParsableMintInfo),i=f.map((({tokenMint:t},i)=>(0,r.getAssociatedTokenAddressSync)(t,e,l,n[i].tokenProgram)));(await(0,o.getMultipleParsedAccounts)(t,i,o.ParsableTokenAccountInfo)).forEach(((t,o)=>{const s=i[o];let u;if(t){if(!t.owner.equals(e))throw new Error(`ATA with change of ownership detected: ${s.toBase58()}`);u={address:s,tokenProgram:t.tokenProgram,...a.EMPTY_INSTRUCTION}}else{const t=d?(0,r.createAssociatedTokenAccountIdempotentInstruction)(c,s,e,f[o].tokenMint,n[o].tokenProgram):(0,r.createAssociatedTokenAccountInstruction)(c,s,e,f[o].tokenMint,n[o].tokenProgram);u={address:s,tokenProgram:n[o].tokenProgram,instructions:[t],cleanupInstructions:[],signers:[]}}g[f[o].tokenMint.toBase58()]=u}))}if(p.length>0){const t=await u(),n=p[0]?.wrappedSolAmountIn||i.ZERO;g[r.NATIVE_MINT.toBase58()]=s.TokenUtil.createWrappedNativeAccountInstruction(e,n,t,c,void 0,h)}return n.map((({tokenMint:t})=>g[t.toBase58()]))}e.resolveOrCreateATA=async function(t,e,n,r,o=i.ZERO,s=e,a=!1,c=!1,d="keypair"){return(await u(t,e,[{tokenMint:n,wrappedSolAmountIn:o}],r,s,a,c,d))[0]},e.resolveOrCreateATAs=u},51084:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(7623),e),i(n(36208),e),i(n(63687),e),i(n(64911),e),i(n(92888),e),i(n(67209),e),i(n(36493),e),i(n(44425),e)},63687:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},59431:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getMultipleAccounts=e.getMultipleAccountsInMap=e.getMultipleParsedAccounts=e.getParsedAccount=void 0;const i=r(n(26018)),o=n(7623);async function s(t,e,n=10,r=100){if(0===e.length)return[];const s=[],a=Math.ceil(e.length/r),u=new Array(a);for(let n=0;n{const r=(await t.getMultipleAccountsInfo(a)).map(((t,e)=>[a[e],t]));u[n]=r,e()}));s.push(c)}var c;await Promise.race([Promise.all(s),(c=n,"connection.getMultipleAccountsInfo timeout",new Promise(((t,e)=>{setTimeout((()=>{e(new Error("connection.getMultipleAccountsInfo timeout"))}),1e3*c)})))]);const d=u.flat();return(0,i.default)(d.length===e.length,"getMultipleAccounts not enough results"),d}e.getParsedAccount=async function(t,e,n){const r=await t.getAccountInfo(o.AddressUtil.toPubKey(e)),i=o.AddressUtil.toPubKey(e);return n.parse(i,r)},e.getMultipleParsedAccounts=async function(t,e,n,r=100){if(0===e.length)return[];const a=(await s(t,o.AddressUtil.toPubKeys(e),10,r)).map((t=>null===t[1]?null:n.parse(t[0],t[1])));return(0,i.default)(a.length===e.length,"not enough results fetched"),a},e.getMultipleAccountsInMap=async function(t,e,n=10,r=100){return(await s(t,e,n,r)).reduce(((t,[e,n])=>(t.set(e.toBase58(),n),t)),new Map)},e.getMultipleAccounts=s},12568:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(26514),e)},26514:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SimpleAccountFetcher=void 0;const r=n(7623),i=n(59431);e.SimpleAccountFetcher=class{constructor(t,e){this.connection=t,this.retentionPolicy=e,this.cache=new Map,this.cache=new Map}async getAccount(t,e,n,i=Date.now()){const o=r.AddressUtil.toPubKey(t),s=r.AddressUtil.toString(t),a=this.cache.get(s),u=this.getMaxAge(this.retentionPolicy.get(e),n),c=a?i-(a?.fetchedAt??0):Number.NEGATIVE_INFINITY;if(a&&!(c>u))return a.value;try{const t=await this.connection.getAccountInfo(o),n=e.parse(o,t);return this.cache.set(s,{parser:e,value:n,fetchedAt:i}),n}catch(t){return this.cache.set(s,{parser:e,value:null,fetchedAt:i}),null}}getMaxAge(t,e){return void 0!==e?.maxAge?e.maxAge:void 0===t?Number.POSITIVE_INFINITY:t}async getAccounts(t,e,n,i=Date.now()){const o=r.AddressUtil.toStrings(t);await this.fetchAndPopulateCache(o,e,n,i);const s=new Map;return o.forEach((t=>{const e=this.cache.get(t),n=e?.value;s.set(t,n)})),s}async getAccountsAsArray(t,e,n,i=Date.now()){const o=r.AddressUtil.toStrings(t);await this.fetchAndPopulateCache(o,e,n,i);const s=new Array;return o.forEach((t=>{const e=this.cache.get(t),n=e?.value;s.push(n)})),s}populateAccounts(t,e,n){Array.from(t.entries()).forEach((([t,r])=>{this.cache.set(t,{parser:e,value:r,fetchedAt:n})}))}async refreshAll(t=Date.now()){const e=Array.from(this.cache.keys()),n=await(0,i.getMultipleAccountsInMap)(this.connection,e);for(const[e,i]of this.cache.entries()){const o=i.parser,s=n.get(e),a=o.parse(r.AddressUtil.toPubKey(e),s);this.cache.set(e,{parser:o,value:a,fetchedAt:t})}}async fetchAndPopulateCache(t,e,n,o=Date.now()){const s=r.AddressUtil.toStrings(t),a=this.getMaxAge(this.retentionPolicy.get(e),n),u=s.filter((t=>{const e=this.cache.get(t),n=e?o-(e?.fetchedAt??0):Number.NEGATIVE_INFINITY;return!e||n>a}));if(u.length>0){const t=await(0,i.getMultipleAccountsInMap)(this.connection,u);u.forEach((n=>{const i=t.get(n),s=e.parse(r.AddressUtil.toPubKey(n),i);this.cache.set(n,{parser:e,value:s,fetchedAt:o})}))}}}},64911:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(59431),e),i(n(12568),e),i(n(52388),e),i(n(21598),e)},52388:function(t,e,n){"use strict";var r=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};Object.defineProperty(e,"__esModule",{value:!0}),e.staticImplements=e.ParsableMintInfo=e.ParsableTokenAccountInfo=void 0;const i=n(29955);let o=class{constructor(){}static parse(t,e){if(!e)return null;try{return{...(0,i.unpackAccount)(t,e,e.owner),tokenProgram:e.owner}}catch(e){return console.error(`error while parsing TokenAccount ${t.toBase58()}: ${e}`),null}}};e.ParsableTokenAccountInfo=o,e.ParsableTokenAccountInfo=o=r([t=>{}],o);let s=class{constructor(){}static parse(t,e){if(!e)return null;try{return{...(0,i.unpackMint)(t,e,e.owner),tokenProgram:e.owner}}catch(e){return console.error(`error while parsing Mint ${t.toBase58()}: ${e}`),null}}};e.ParsableMintInfo=s,e.ParsableMintInfo=s=r([t=>{}],s),e.staticImplements=function(){return t=>{}}},21598:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},92888:(t,e)=>{"use strict";function n(t,e){const n=t.toBytes(),r=e.toBytes();if(n.byteLength!==r.byteLength)return n.byteLength-r.byteLength;for(let t=0;t{const e=t,n=o.TOKEN_PROGRAM_ID,i=r.concat([e.toBuffer(),r.from(c),n.toBuffer()]),u=(0,a.sha256)(i);return new s.PublicKey(u)})(),l=s.SystemProgram.createAccountWithSeed({fromPubkey:i,basePubkey:t,seed:c,newAccountPubkey:d,lamports:e.toNumber()+n,space:o.AccountLayout.span,programId:o.TOKEN_PROGRAM_ID}),h=(0,o.createInitializeAccountInstruction)(d,o.NATIVE_MINT,t),f=(0,o.createCloseAccountInstruction)(d,u,t);return{address:d,tokenProgram:o.TOKEN_PROGRAM_ID,instructions:[l,h],cleanupInstructions:[f],signers:[]}}(t,e,n,l,h);default:throw new Error(`Invalid createAccountMethod: ${d}`)}}static async createSendTokensToWalletInstruction(t,e,n,r,i,a,l,h,f=!1){if((0,u.default)(!a.eq(c.ZERO),"SendToken transaction must send more than 0 tokens."),(0,u.default)(!r.equals(o.NATIVE_MINT_2022),"NATIVE_MINT_2022 is not supported."),r.equals(o.NATIVE_MINT))return{instructions:[s.SystemProgram.transfer({fromPubkey:e,toPubkey:n,lamports:BigInt(a.toString())})],cleanupInstructions:[],signers:[]};const p=await t.getAccountInfo(r);if(null===p)throw Error("Cannot fetch tokenMint.");const m=p.owner,g=(0,o.getAssociatedTokenAddressSync)(r,e,f,m),{address:y,...b}=await(0,d.resolveOrCreateATA)(t,n,r,l,a,h,void 0,!0),w=await(0,o.createTransferCheckedWithTransferHookInstruction)(t,g,r,y,e,BigInt(a.toString()),i,void 0,void 0,m);return{instructions:b.instructions.concat(w),cleanupInstructions:b.cleanupInstructions,signers:b.signers}}}},62313:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getLockWritableAccounts=e.getPriorityFeeInLamports=e.estimateComputeBudgetLimit=e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT=e.DEFAULT_MAX_PRIORITY_FEE_LAMPORTS=e.DEFAULT_PRIORITY_FEE_PERCENTILE=e.MICROLAMPORTS_PER_LAMPORT=void 0;const r=n(18245);e.MICROLAMPORTS_PER_LAMPORT=1e6,e.DEFAULT_PRIORITY_FEE_PERCENTILE=.9,e.DEFAULT_MAX_PRIORITY_FEE_LAMPORTS=1e6,e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT=14e5,e.estimateComputeBudgetLimit=async function(t,n,i,o,s){try{const a=n.flatMap((t=>t.instructions)),u=n.flatMap((t=>t.cleanupInstructions)),c=new r.TransactionMessage({recentBlockhash:r.PublicKey.default.toBase58(),payerKey:o,instructions:[...a,...u]}).compileToV0Message(i),d=new r.VersionedTransaction(c),l=await t.simulateTransaction(d,{sigVerify:!1,replaceRecentBlockhash:!0});if(!l.value.unitsConsumed)return e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT;const h=Math.max(1e5,s*l.value.unitsConsumed),f=Math.ceil(l.value.unitsConsumed+h);return Math.min(e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT,f)}catch{return e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT}},e.getPriorityFeeInLamports=async function(t,n,r,i=e.DEFAULT_PRIORITY_FEE_PERCENTILE){return function(t,e){const n=t.sort(((t,e)=>t.prioritizationFee-e.prioritizationFee));return n[Math.min(Math.max(Math.floor(n.length*e),0),n.length-1)].prioritizationFee}(await t.getRecentPrioritizationFees({lockedWritableAccounts:r}),i)*n/e.MICROLAMPORTS_PER_LAMPORT},e.getLockWritableAccounts=function(t){return t.flatMap((t=>[...t.instructions,...t.cleanupInstructions])).flatMap((t=>t.keys)).filter((t=>t.isWritable)).map((t=>t.pubkey))}},18917:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MEASUREMENT_BLOCKHASH=e.TX_BASE64_ENCODED_SIZE_LIMIT=e.TX_SIZE_LIMIT=void 0;const r=n(18245);e.TX_SIZE_LIMIT=r.PACKET_DATA_SIZE,e.TX_BASE64_ENCODED_SIZE_LIMIT=4*Math.ceil(e.TX_SIZE_LIMIT/3),e.MEASUREMENT_BLOCKHASH={blockhash:"65FJ2gp6jC2x87bycfdZpxDyjiodcAoymxR6PMZzfavY",lastValidBlockHeight:160381350}},36493:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(62313),e),i(n(18917),e),i(n(38801),e),i(n(785),e),i(n(97864),e)},38801:(t,e,n)=>{"use strict";n(48764).Buffer,Object.defineProperty(e,"__esModule",{value:!0}),e.isVersionedTransaction=e.TransactionBuilder=e.defaultTransactionBuilderOptions=void 0;const r=n(18245),i=n(62313),o=n(18917);e.defaultTransactionBuilderOptions={defaultBuildOption:{maxSupportedTransactionVersion:0,blockhashCommitment:"confirmed"},defaultSendOption:{skipPreflight:!1,preflightCommitment:"confirmed",maxRetries:3},defaultConfirmationCommitment:"confirmed"},e.TransactionBuilder=class{constructor(t,n,r){this.connection=t,this.wallet=n,this.instructions=[],this.signers=[],this.opts=r??e.defaultTransactionBuilderOptions}addInstruction(t){return this.instructions.push(t),this}addInstructions(t){return this.instructions=this.instructions.concat(t),this}prependInstruction(t){return this.instructions.unshift(t),this}prependInstructions(t){return this.instructions=t.concat(this.instructions),this}addSigner(t){return this.signers.push(t),this}isEmpty(){return 0==this.instructions.length}compressIx(t){let e=[],n=[],r=[];return this.instructions.forEach((t=>{e=e.concat(t.instructions),n=t.cleanupInstructions.concat(n),r=r.concat(t.signers)})),t&&(e=e.concat(n),n=[]),{instructions:[...e],cleanupInstructions:[...n],signers:r}}txnSize(t){const n={...this.opts.defaultBuildOption,...t,latestBlockhash:o.MEASUREMENT_BLOCKHASH,computeBudgetOption:this.opts.defaultBuildOption.computeBudgetOption??{type:"none"}};if(this.isEmpty())return 0;const i=this.buildSync(n).transaction;return(0,e.isVersionedTransaction)(i)?function(t){let e;try{e=t.serialize()}catch(t){throw new Error("Unable to measure transaction size. Unable to serialize transaction.")}if(e.length>r.PACKET_DATA_SIZE)throw new Error("Unable to measure transaction size. Transaction too large.");return e.length}(i):function(t){const e=new Set;for(const n of t.instructions){for(const t of n.keys)e.add(t.pubkey.toBase58());e.add(n.programId.toBase58())}if(e.size>35)throw new Error("Unable to measure transaction size. Too many unique keys in transaction.");try{return t.serialize({requireAllSignatures:!1}).length}catch(t){throw new Error("Unable to measure transaction size. Unable to serialize transaction.")}}(i)}buildSync(t){const{latestBlockhash:e,maxSupportedTransactionVersion:n,computeBudgetOption:o}=t,s=this.compressIx(!0);let a=[];if("fixed"===o.type){const t=o.computeBudgetLimit??i.DEFAULT_MAX_COMPUTE_UNIT_LIMIT,e=Math.floor(o.priorityFeeLamports*i.MICROLAMPORTS_PER_LAMPORT/t);a=[r.ComputeBudgetProgram.setComputeUnitLimit({units:t}),r.ComputeBudgetProgram.setComputeUnitPrice({microLamports:e})]}"auto"===o.type&&(a=[r.ComputeBudgetProgram.setComputeUnitLimit({units:i.DEFAULT_MAX_COMPUTE_UNIT_LIMIT}),r.ComputeBudgetProgram.setComputeUnitPrice({microLamports:0})]);const u=s.signers.concat(this.signers),c=e;if("legacy"===n){const t=new r.Transaction({...c,feePayer:this.wallet.publicKey});return a.length>0&&t.add(...a),t.add(...s.instructions),t.feePayer=this.wallet.publicKey,{transaction:t,signers:u,recentBlockhash:c}}const d=new r.TransactionMessage({recentBlockhash:c.blockhash,payerKey:this.wallet.publicKey,instructions:[...a,...s.instructions]}),{lookupTableAccounts:l}=t,h=d.compileToV0Message(l);return{transaction:new r.VersionedTransaction(h),signers:u,recentBlockhash:c}}async build(t){const e={...this.opts.defaultBuildOption,...t},{latestBlockhash:n,blockhashCommitment:r,computeBudgetOption:o}=e;let s=n;s||(s=await this.connection.getLatestBlockhash(r));let a=o??{type:"none"};if("auto"===a.type){const t=a.computeLimitMargin??.1,n="legacy"===e.maxSupportedTransactionVersion?void 0:e.lookupTableAccounts,r=await(0,i.estimateComputeBudgetLimit)(this.connection,this.instructions,n,this.wallet.publicKey,t),o=a.computePricePercentile??i.DEFAULT_PRIORITY_FEE_PERCENTILE,s=await(0,i.getPriorityFeeInLamports)(this.connection,r,(0,i.getLockWritableAccounts)(this.instructions),o),u=a.maxPriorityFeeLamports??i.DEFAULT_MAX_PRIORITY_FEE_LAMPORTS;a={type:"fixed",priorityFeeLamports:Math.min(s,u),computeBudgetLimit:r}}return this.buildSync({...e,latestBlockhash:s,computeBudgetOption:a})}async buildAndExecute(t,n,r){const i={...this.opts.defaultSendOption,...n},o=await this.build(t),s=o.transaction,a=r??this.opts.defaultConfirmationCommitment;let u;if((0,e.isVersionedTransaction)(s)){const t=await this.wallet.signTransaction(s);t.sign(o.signers),u=await this.connection.sendTransaction(t,i)}else{const t=await this.wallet.signTransaction(s);o.signers.filter((t=>void 0!==t)).forEach((e=>t.partialSign(e))),u=await this.connection.sendRawTransaction(t.serialize(),i)}const c=(await this.connection.confirmTransaction({signature:u,...o.recentBlockhash},a)).value.err;if(c)throw new Error(c.toString());return u}},e.isVersionedTransaction=t=>"version"in t},785:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionProcessor=void 0;const r=n(38801);e.TransactionProcessor=class{constructor(t,e,n="confirmed"){this.connection=t,this.wallet=e,this.commitment=n}async signTransaction(t){const{transactions:e,lastValidBlockHeight:n,blockhash:r}=await this.signTransactions([t]);return{transaction:e[0],lastValidBlockHeight:n,blockhash:r}}async signTransactions(t){const{blockhash:e,lastValidBlockHeight:n}=await this.connection.getLatestBlockhash(this.commitment),i=this.wallet.publicKey,o=t.map((t=>function(t,e,n){if((0,r.isVersionedTransaction)(t.transaction)){let e=t.transaction;return t.signers&&e.sign(t.signers??[]),e}{let r=t.transaction,i=t.signers??[];return r.feePayer=e,r.recentBlockhash=n,i.forEach((t=>{r.partialSign(t)})),r}}(t,i,e)));return{transactions:await this.wallet.signAllTransactions(o),lastValidBlockHeight:n,blockhash:e}}async sendTransaction(t,e,n){const r=this.constructSendTransactions([t],e,n),i=(await r())[0];if("fulfilled"===i.status)return i.value;throw i.reason}constructSendTransactions(t,e,n,r=!0){const i=async t=>{const e=t.serialize();return this.connection.sendRawTransaction(e,{preflightCommitment:this.commitment})},o=async t=>{const r=await this.connection.confirmTransaction({signature:t,lastValidBlockHeight:e,blockhash:n},this.commitment);if(r.value.err)throw new Error(`Transaction failed: ${JSON.stringify(r.value)}`)};return async()=>{if(r){const e=t.map((async t=>{const e=await i(t);return await o(e),e}));return Promise.allSettled(e)}{const e=[];for(const n of t){const t=await i(n);await o(t),e.push(t)}return Promise.allSettled(e)}}}async signAndConstructTransaction(t){const{transaction:e,lastValidBlockHeight:n,blockhash:r}=await this.signTransaction(t);return{signedTx:e,execute:async()=>this.sendTransaction(e,n,r)}}async signAndConstructTransactions(t,e=!0){const{transactions:n,lastValidBlockHeight:r,blockhash:i}=await this.signTransactions(t);return{signedTxs:n,execute:this.constructSendTransactions(n,r,i,e)}}}},97864:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_INSTRUCTION=void 0,e.EMPTY_INSTRUCTION={instructions:[],cleanupInstructions:[],signers:[]}},44425:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ReadOnlyWallet=void 0;const r=n(18245);e.ReadOnlyWallet=class{constructor(t=r.PublicKey.default){this.publicKey=t}signTransaction(t){throw new Error("Read only wallet cannot sign transaction.")}signAllTransactions(t){throw new Error("Read only wallet cannot sign transactions.")}}},68795:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCubicRoots=void 0;var r=n(93776),i=new r.Decimal(-1),o=new r.Decimal(0),s=new r.Decimal(1),a=new r.Decimal(2),u=new r.Decimal(3),c=a.pow(-52),d=function(t,e){this.real=t,this.imag=e};function l(t){return t.gt(o)?s:t.lt(o)?i:o}function h(t){var e=r.Decimal.floor(t),n=r.Decimal.ceil(t),i=t.sub(e).abs(),o=t.sub(n).abs();return i.gt(o)?o:i}function f(t,e,n,r,i){var o=e.mul(t),s=o.add(n),a=s.mul(t).add(r);return{Q:a.mul(t).add(i),dQ:o.add(s).mul(t).add(a),B1:s,C2:a}}e.getCubicRoots=function(t,e,n,i){var p,m,g,y,b=[];if(t.eq(o))m=e,g=n,y=i;else if(i.eq(o))p=o,m=t,g=e,y=n,b.push(new d(p,o));else{m=t;var w=f(p=e.div(t).div(u).neg(),t,e,n,i),_=w.Q,v=w.dQ;g=w.B1,y=w.C2;var k=_.div(t),M=k.abs().cubeRoot(),A=l(k);(k=v.div(t).neg()).gt(o)&&(M=new r.Decimal("1.324717957244746").mul(r.Decimal.max(M,k.sqrt())));var S=p.sub(A.mul(M));if(!S.eq(p)){var I=c.mul(100).add(s);do{_=(w=f(p=S,t,e,n,i)).Q,v=w.dQ,g=w.B1,y=w.C2,S=v.eq(o)?p:p.sub(_.div(v).div(I))}while(A.mul(S).gt(A.mul(p)));t.abs().mul(p).mul(p).gt(i.div(p).abs())&&(g=(y=i.div(p).neg()).sub(n).div(p))}b.push(new d(p,o))}var x=function(t,e,n){var i=e.div(a).neg(),s=function(t,e,n){var i=t,s=e,a=n;if(r.Decimal.floor(t).sub(t).abs().eq(o)&&r.Decimal.floor(s).sub(s).abs().eq(o)&&r.Decimal.floor(n).sub(n).abs().eq(o)){i.mul(a).gt(o)&&(i=t.abs(),a=n.abs());var u=!1;do{if(u=!1,i{"use strict";e.Ek=void 0;var r=n(91113),i=(n(93776),n(68795),new r.u64(0)),o=new r.u64(1),s=new r.u64(2),a=(new r.u64(3),new r.u64(4),new r.u64(8),new r.u64(16),s),u=new r.u64(4);function c(t,e,n,r){var i=e.mul(n),s=r.mul(a),u=i.add(s).mul(t),c=t.mul(e.sub(o)),d=r.mul(a.add(o)),l=c.add(d);return u.div(l)}e.Ek=function(t,e,n,d){var l=d.mul(a),h=function(t,e,n){for(var r,i=n.pow(a.add(o)).div(e.mul(u).mul(t)),c=e.add(n.div(t)),d=n,l=0;l<32&&(r=d,!(d=d.sqr().add(i).div(d.mul(s).add(c).sub(n))).eq(r));l++);return d}(l,t.add(e),function(t,e,n){var r,s=e.mul(a).add(o),u=n.mul(a).add(o),d=e.add(n);if(d.eq(i))return i;for(var l=d,h=0;h<32&&(r=l,!(l=c(l,t,d,l.mul(l).div(s).mul(l).div(u))).eq(r));h++);return l}(l,e,n)),f=n.sub(h);return new r.u64(f.toString())}},91113:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ASSOCIATED_TOKEN_PROGRAM_ID:()=>fo,AccountLayout:()=>ko,MintLayout:()=>vo,NATIVE_MINT:()=>_o,TOKEN_PROGRAM_ID:()=>ho,Token:()=>Ao,u64:()=>yo});var r={};n.r(r),n.d(r,{dQ:()=>Q,ci:()=>Y,bytesToNumberBE:()=>q,ty:()=>V,eV:()=>J,n$:()=>nt,ql:()=>X,hexToBytes:()=>K,_t:()=>U,tL:()=>G,S5:()=>Z,FF:()=>it});var i=n(64572),o=n(13550),s=n.n(o),a=n(48764);function u(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function c(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function d(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function l(t,e){c(t);const n=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),m=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function g(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function y(t){if("string"==typeof t&&(t=g(t)),!f(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function b(...t){let e=0;for(let n=0;nt().update(y(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function v(t=32){if(h&&"function"==typeof h.getRandomValues)return h.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class k extends w{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=p(this.buffer)}update(t){d(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=y(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=p(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t>A&M)}:{h:0|Number(t>>A&M),l:0|Number(t&M)}}function I(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it<>>32-n,E=(t,e,n)=>e<>>32-n,T=(t,e,n)=>e<>>64-n,P=(t,e,n)=>t<>>64-n,B={fromBig:S,split:I,toBig:(t,e)=>BigInt(t>>>0)<>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:x,rotlSL:E,rotlBH:T,rotlBL:P,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[L,$]=(()=>B.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),R=new Uint32Array(80),O=new Uint32Array(80);class D extends k{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)R[n]=t.getUint32(e),O[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|R[t-15],n=0|O[t-15],r=B.rotrSH(e,n,1)^B.rotrSH(e,n,8)^B.shrSH(e,n,7),i=B.rotrSL(e,n,1)^B.rotrSL(e,n,8)^B.shrSL(e,n,7),o=0|R[t-2],s=0|O[t-2],a=B.rotrSH(o,s,19)^B.rotrBH(o,s,61)^B.shrSH(o,s,6),u=B.rotrSL(o,s,19)^B.rotrBL(o,s,61)^B.shrSL(o,s,6),c=B.add4L(i,u,O[t-7],O[t-16]),d=B.add4H(c,r,a,R[t-7],R[t-16]);R[t]=0|d,O[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=B.rotrSH(d,l,14)^B.rotrSH(d,l,18)^B.rotrBH(d,l,41),b=B.rotrSL(d,l,14)^B.rotrSL(d,l,18)^B.rotrBL(d,l,41),w=d&h^~d&p,_=l&f^~l&m,v=B.add5L(y,b,_,$[t],O[t]),k=B.add5H(v,g,e,w,L[t],R[t]),M=0|v,A=B.rotrSH(n,r,28)^B.rotrBH(n,r,34)^B.rotrBH(n,r,39),S=B.rotrSL(n,r,28)^B.rotrBL(n,r,34)^B.rotrBL(n,r,39),I=n&i^n&s^i&s,x=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|d,f=0|l,({h:d,l}=B.add(0|u,0|c,0|k,0|M)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const E=B.add3L(M,S,x);n=B.add3H(E,k,A,I),r=0|E}({h:n,l:r}=B.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=B.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=B.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=B.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=B.add(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=B.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=B.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=B.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y)}roundClean(){R.fill(0),O.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const C=_((()=>new D)),N=(BigInt(0),BigInt(1)),z=BigInt(2);function U(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const j=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Y(t){if(!U(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n=W._0&&t<=W._9?t-W._0:t>=W._A&&t<=W._F?t-(W._A-10):t>=W._a&&t<=W._f?t-(W._a-10):void 0}function K(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(z<new Uint8Array(t),et=t=>Uint8Array.from(t);function nt(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=tt(t),i=tt(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=tt())=>{i=a(et([0]),t),r=a(),0!==t.length&&(i=a(et([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const rt={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||U(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function it(t,e,n={}){const r=(e,n,r)=>{const i=rt[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const ot=BigInt(0),st=BigInt(1),at=BigInt(2),ut=BigInt(3),ct=BigInt(4),dt=BigInt(5),lt=BigInt(8);function ht(t,e){const n=t%e;return n>=ot?n:e+n}function ft(t,e,n){if(n<=ot||e 0");if(n===st)return ot;let r=st;for(;e>ot;)e&st&&(r=r*t%n),t=t*t%n,e>>=st;return r}function pt(t,e,n){let r=t;for(;e-- >ot;)r*=r,r%=n;return r}function mt(t,e){if(t===ot||e<=ot)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=ht(t,e),r=e,i=ot,o=st,s=st,a=ot;for(;n!==ot;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==st)throw new Error("invert: does not exist");return ht(i,e)}BigInt(9),BigInt(16);const gt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function yt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function bt(t,e,n=!1,r={}){if(t<=ot)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=yt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%ct===ut){const e=(t+st)/ct;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%lt===dt){const e=(t-dt)/lt;return function(t,n){const r=t.mul(n,at),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,at),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-st)/at;let n,r,i;for(n=t-st,r=0;n%at===ot;n/=at,r++);for(i=at;iht(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return ot<=e&&et===ot,isOdd:t=>(t&st)===st,neg:e=>ht(-e,t),eql:(t,e)=>t===e,sqr:e=>ht(e*e,t),add:(e,n)=>ht(e+n,t),sub:(e,n)=>ht(e-n,t),mul:(e,n)=>ht(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===ot)return t.ONE;if(n===st)return e;let r=t.ONE,i=e;for(;n>ot;)n&st&&(r=t.mul(r,i)),i=t.sqr(i),n>>=st;return r}(a,t,e),div:(e,n)=>ht(e*mt(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>mt(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?Z(t,o):G(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?V(t):q(t)}});return Object.freeze(a)}function wt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function _t(t){const e=wt(t);return e+Math.ceil(e/2)}const vt=BigInt(0),kt=BigInt(1);function Mt(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>vt;)n&kt&&(r=r.add(i)),i=i.double(),n>>=kt;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=kt);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function At(t){return it(t.Fp,gt.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),it(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...yt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const St=BigInt(0),It=BigInt(1),xt=BigInt(2),Et=BigInt(8),Tt={zip215:!0};function Pt(t){const e=function(t){const e=At(t);return it(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=xt<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:St}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&Stp(t)&&p(e)&&tt===St||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===St?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,It,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(xt*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===St)return this.double();const r=d(s*xt*h),f=d(a*xt*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===St?M:this.equals(M)||e===It?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?Et:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:St,y:It};if(u!==It)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===It?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=X("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=V(a);h===St||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-It),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&It)===It,_=0!=(128&u);if(!r&&b===St&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return x(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=Z(e,n.BYTES);return r[r.length-1]|=t&It?128:0,r}toHex(){return Y(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,It,d(e.Gx*e.Gy)),v.ZERO=new v(St,It,It,St);const{BASE:k,ZERO:M}=v,A=Mt(v,8*a);function S(t){return ht(t,r)}function I(t){return S(V(t))}function x(t){const e=a;t=X("private key",t,e);const n=X("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function E(t=new Uint8Array,...e){const n=J(...e);return I(o(f(n,X("context",t),!!i)))}const T=Tt;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return x(t).pointBytes},sign:function(t,e,r={}){t=X("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=x(e),c=E(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+E(r.context,d,u,t)*s);return b(l),X("result",J(d,Z(l,n.BYTES)),2*a)},verify:function(t,e,r,o=T){const{context:s,zip215:a}=o,u=n.BYTES;t=X("signature",t,2*u),e=X("message",e),i&&(e=i(e));const c=V(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=E(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const Bt=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Lt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),$t=(BigInt(0),BigInt(1)),Rt=BigInt(2),Ot=BigInt(5),Dt=BigInt(10),Ct=BigInt(20),Nt=BigInt(40),zt=BigInt(80);const Ut=bt(Bt,void 0,!0),jt={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ut,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:C,randomBytes:v,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=Bt,r=ht(e*e*e,n),i=ht(r*r*e,n);let o=ht(t*r*function(t){const e=Bt,n=t*t%e*t%e,r=pt(n,Rt,e)*n%e,i=pt(r,$t,e)*t%e,o=pt(i,Ot,e)*i%e,s=pt(o,Dt,e)*o%e,a=pt(s,Ct,e)*s%e,u=pt(a,Nt,e)*a%e,c=pt(u,zt,e)*u%e,d=pt(c,zt,e)*u%e,l=pt(d,Dt,e)*o%e;return{pow_p_5_8:pt(l,Rt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=ht(e*o*o,n),a=o,u=ht(o*Lt,n),c=s===t,d=s===ht(-t,n),l=s===ht(-t*Lt,n);return c&&(o=a),(d||l)&&(o=u),(ht(o,n)&st)===st&&(o=ht(-o,n)),{isValid:c||d,value:o}}},Yt=Pt(jt);const Ft=(Ut.ORDER+BigInt(3))/BigInt(8);Ut.pow(Rt,Ft),Ut.sqrt(Ut.neg(Ut.ONE)),Ut.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(Ut,Ut.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Wt=n(77191),Ht=n.n(Wt);const Kt=(t,e,n)=>t&e^t&n^e&n,qt=new Uint32Array([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]),Vt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Gt=new Uint32Array(64);class Zt extends k{constructor(){super(64,32,8,!1),this.A=0|Vt[0],this.B=0|Vt[1],this.C=0|Vt[2],this.D=0|Vt[3],this.E=0|Vt[4],this.F=0|Vt[5],this.G=0|Vt[6],this.H=0|Vt[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Gt[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Gt[t-15],n=Gt[t-2],r=m(e,7)^m(e,18)^e>>>3,i=m(n,17)^m(n,19)^n>>>10;Gt[t]=i+Gt[t-7]+r+Gt[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(m(s,6)^m(s,11)^m(s,25))+((d=s)&a^~d&u)+qt[t]+Gt[t]|0,l=(m(n,2)^m(n,13)^m(n,22))+Kt(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){Gt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Xt=_((()=>new Zt));var Jt=n(25532),Qt=n(39386),te=n(40475),ee=n(53471);n(31198),n(48990),n(46299);const[ne,re,ie]=[[],[],[]],oe=BigInt(0),se=BigInt(1),ae=BigInt(2),ue=BigInt(7),ce=BigInt(256),de=BigInt(113);for(let t=0,e=se,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],ne.push(2*(5*r+n)),re.push((t+1)*(t+2)/2%64);let i=oe;for(let t=0;t<7;t++)e=(e<>ue)*de)%ce,e&ae&&(i^=se<<(se<n>32?T(t,e,n):x(t,e,n),pe=(t,e,n)=>n>32?P(t,e,n):E(t,e,n);class me extends w{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,u(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=fe(o,s,1)^n[r],u=pe(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=re[n],o=fe(e,i,r),s=pe(e,i,r),a=ne[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=le[r],t[1]^=he[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){d(this);const{blockLen:e,state:n}=this,r=(t=y(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return u(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(l(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new me(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const ge=((t,e,n)=>_((()=>new me(e,t,n))))(1,136,32);class ye extends w{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");u(t.outputLen),u(t.blockLen)}(t);const n=y(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew ye(t,e).update(n).digest();be.create=(t,e)=>new ye(t,e);const{bytesToNumberBE:we,hexToBytes:_e}=r,ve={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=ve;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:we(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=ve,n="string"==typeof t?_e(t):t;if(!U(n))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=ve._parseInt(n.subarray(2)),{d:s,l:a}=ve._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},ke=BigInt(0),Me=BigInt(1),Ae=(BigInt(2),BigInt(3));function Se(t){const e=function(t){const e=At(t);return it(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return ht(t,r)}function a(t){return mt(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=At(t);it(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return J(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&ken.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(X("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,Ae),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,Ae);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===ke)return r;if(a(t),t===Me)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>ke||c>ke;)s&Me&&(d=d.add(p)),c&Me&&(h=h.add(p)),p=p.double(),s>>=Me,c>>=Me;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==ke&&e!==Me&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Me)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Me?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return Y(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=Mt(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=J;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=q(s);if(!(ke<(a=t)&&aY(G(t,e.nByteLength));function f(t){return t>r>>Me}const p=(t,e,n)=>q(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=X("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=ve.toSig(X("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(X("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return K(this.toDERHex())}toDERHex(){return ve.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return K(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=_t(e.n);return function(t,e,n=!1){const r=t.length,i=wt(e),o=_t(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=ht(n?q(t):V(t),e-st)+st;return n?Z(s,i):G(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=U(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=q(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=Q(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(ke<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return G(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=X("msgHash",t),p&&(t=X("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g){const t=!0===g?d(n.BYTES):g;M.push(X("extraEntropy",t))}const A=J(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===ke)return;const o=s(n*s(S+i*_));if(o===ke)return;let c=(r.x===i?0:2)|Number(r.y&Me),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return nt(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=X("msgHash",n),r=X("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||U(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof ve.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function Ie(t){return{hash:t,hmac:(e,...n)=>be(t,e,b(...n)),randomBytes:v}}BigInt(4);const xe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ee=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Te=BigInt(1),Pe=BigInt(2),Be=(t,e)=>(t+e/Pe)/e;const Le=bt(xe,void 0,void 0,{sqrt:function(t){const e=xe,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=pt(d,n,e)*d%e,h=pt(l,n,e)*d%e,f=pt(h,Pe,e)*c%e,p=pt(f,i,e)*f%e,m=pt(p,o,e)*p%e,g=pt(m,a,e)*m%e,y=pt(g,u,e)*g%e,b=pt(y,a,e)*m%e,w=pt(b,n,e)*d%e,_=pt(w,s,e)*p%e,v=pt(_,r,e)*c%e,k=pt(v,Pe,e);if(!Le.eql(Le.sqr(k),t))throw new Error("Cannot find square root");return k}}),$e=function(t,e){const n=e=>Se({...t,...Ie(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Le,n:Ee,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Ee,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Te*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=Be(o*t,e),u=Be(-r*t,e);let c=ht(t-a*n-u*i,e),d=ht(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},Xt);BigInt(0),$e.ProjectivePoint,Yt.utils.randomPrivateKey;const Re=()=>{const t=Yt.utils.randomPrivateKey(),e=Oe(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},Oe=Yt.getPublicKey;function De(t){try{return Yt.ExtendedPoint.fromHex(t),!0}catch{return!1}}const Ce=(t,e)=>Yt.sign(t,e.slice(0,32)),Ne=Yt.verify,ze=t=>a.Buffer.isBuffer(t)?t:t instanceof Uint8Array?a.Buffer.from(t.buffer,t.byteOffset,t.byteLength):a.Buffer.from(t);class Ue{constructor(t){Object.assign(this,t)}encode(){return a.Buffer.from((0,Jt.serialize)(je,this))}static decode(t){return(0,Jt.deserialize)(je,this,t)}static decodeUnchecked(t){return(0,Jt.deserializeUnchecked)(je,this,t)}}const je=new Map;var Ye;let Fe;const We=32;let He=1;Fe=Symbol.toStringTag;class Ke extends Ue{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Ht().decode(t);if(e.length!=We)throw new Error("Invalid public key input");this._bn=new(s())(e)}else this._bn=new(s())(t);if(this._bn.byteLength()>We)throw new Error("Invalid public key input")}}static unique(){const t=new Ke(He);return He+=1,new Ke(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Ht().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(a.Buffer);if(t.length===We)return t;const e=a.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Fe](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=a.Buffer.concat([t.toBuffer(),a.Buffer.from(e),n.toBuffer()]),i=Xt(r);return new Ke(i)}static createProgramAddressSync(t,e){let n=a.Buffer.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=a.Buffer.concat([n,ze(t)])})),n=a.Buffer.concat([n,e.toBuffer(),a.Buffer.from("ProgramDerivedAddress")]);const r=Xt(n);if(De(r))throw new Error("Invalid seeds, address must fall off the curve");return new Ke(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const i=t.concat(a.Buffer.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return De(new Ke(t).toBytes())}}Ye=Ke,Ke.default=new Ye("11111111111111111111111111111111"),je.set(Ke,{kind:"struct",fields:[["_bn","u256"]]}),new Ke("BPFLoader1111111111111111111111111111111111");class qe extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(qe.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class Ve extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Ve.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Ge extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Ge.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class Ze{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const Xe=(t="publicKey")=>Qt.blob(32,t),Je=(t="string")=>{const e=Qt.struct([Qt.u32("length"),Qt.u32("lengthPadding"),Qt.blob(Qt.offset(Qt.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=(t,e)=>n(t,e).chars.toString(),i.encode=(t,e,n)=>{const i={chars:a.Buffer.from(t,"utf8")};return r(i,e,n)},i.alloc=t=>Qt.u32().span+Qt.u32().span+a.Buffer.from(t,"utf8").length,i};function Qe(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return Qe({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function tn(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function en(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function nn(t,e){if(!t)throw new Error(e||"Assertion failed")}class rn{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new rn(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];nn(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{nn(e.length>0,"Expected at least one writable signer key");const[t]=e[0];nn(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Ke(t))),...n.map((([t])=>new Ke(t))),...r.map((([t])=>new Ke(t))),...i.map((([t])=>new Ke(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Ke(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(nn(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}class on{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Ke(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Ht().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new Ze(this.staticAccountKeys)}static compile(t){const e=rn.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new Ze(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Ht().encode(t.data)})));return new on({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];en(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Ht().decode(t.data));let i=[];en(i,e.length);let o=[];return en(o,r.length),{programIdIndex:n,keyIndicesCount:a.Buffer.from(i),keyIndices:e,dataLength:a.Buffer.from(o),data:r}}));let r=[];en(r,n.length);let i=a.Buffer.alloc(1232);a.Buffer.from(r).copy(i);let o=r.length;n.forEach((t=>{const e=Qt.struct([Qt.u8("programIdIndex"),Qt.blob(t.keyIndicesCount.length,"keyIndicesCount"),Qt.seq(Qt.u8("keyIndex"),t.keyIndices.length,"keyIndices"),Qt.blob(t.dataLength.length,"dataLength"),Qt.seq(Qt.u8("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);const s=Qt.struct([Qt.blob(1,"numRequiredSignatures"),Qt.blob(1,"numReadonlySignedAccounts"),Qt.blob(1,"numReadonlyUnsignedAccounts"),Qt.blob(e.length,"keyCount"),Qt.seq(Xe("key"),t,"keys"),Xe("recentBlockhash")]),u={numRequiredSignatures:a.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:a.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:a.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:a.Buffer.from(e),keys:this.accountKeys.map((t=>ze(t.toBytes()))),recentBlockhash:Ht().decode(this.recentBlockhash)};let c=a.Buffer.alloc(2048);const d=s.encode(u,c);return i.copy(c,d),c.slice(0,d+i.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(127&n))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=e.shift(),i=e.shift(),o=tn(e);let s=[];for(let t=0;t({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class un{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new an(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Ke(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Ht().encode(e)}}));return f.forEach((t=>{nn(t.programIdIndex>=0),t.accounts.forEach((t=>nn(t>=0)))})),new on({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=Ce(n,t.secretKey);this._addSignature(t.publicKey,ze(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){nn(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=a.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):Ne(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];en(n,e.length);const r=n.length+64*e.length+t.length,i=a.Buffer.alloc(r);return nn(e.length<256),a.Buffer.from(n).copy(i,0),e.forEach((({signature:t},e)=>{null!==t&&(nn(64===t.length,"signature has invalid length"),a.Buffer.from(t).copy(i,n.length+64*e))})),t.copy(i,n.length+64*e.length),nn(i.length<=1232,`Transaction too large: ${i.length} > 1232`),i}get keys(){return nn(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return nn(1===this.instructions.length),this.instructions[0].programId}get data(){return nn(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=tn(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Ht().encode(sn)?null:Ht().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new an({keys:r,programId:t.accountKeys[e.programIdIndex],data:Ht().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}const cn=new Ke("SysvarC1ock11111111111111111111111111111111"),dn=(new Ke("SysvarEpochSchedu1e111111111111111111111111"),new Ke("Sysvar1nstructions1111111111111111111111111"),new Ke("SysvarRecentB1ockHashes11111111111111111111")),ln=new Ke("SysvarRent111111111111111111111111111111111"),hn=(new Ke("SysvarRewards111111111111111111111111111111"),new Ke("SysvarS1otHashes111111111111111111111111111"),new Ke("SysvarS1otHistory11111111111111111111111111"),new Ke("SysvarStakeHistory1111111111111111111111111"));async function fn(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function pn(t){return new Promise((e=>setTimeout(e,t)))}function mn(t,e){const n=t.layout.span>=0?t.layout.span:Qe(t,e),r=a.Buffer.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}const gn=Qt.nu64("lamportsPerSignature"),yn=Qt.struct([Qt.u32("version"),Qt.u32("state"),Xe("authorizedPubkey"),Xe("nonce"),Qt.struct([gn],"feeCalculator")]).span,bn=(8,t=>{const e=(0,Qt.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),i=e;return i.decode=(t,e)=>{const n=r(t,e);return(0,te.toBigIntLE)(a.Buffer.from(n))},i.encode=(t,e,r)=>{const i=(0,te.toBufferLE)(t,8);return n(i,e,r)},i});const wn=Object.freeze({Create:{index:0,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports"),Qt.ns64("space"),Xe("programId")])},Assign:{index:1,layout:Qt.struct([Qt.u32("instruction"),Xe("programId")])},Transfer:{index:2,layout:Qt.struct([Qt.u32("instruction"),bn("lamports")])},CreateWithSeed:{index:3,layout:Qt.struct([Qt.u32("instruction"),Xe("base"),Je("seed"),Qt.ns64("lamports"),Qt.ns64("space"),Xe("programId")])},AdvanceNonceAccount:{index:4,layout:Qt.struct([Qt.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:Qt.struct([Qt.u32("instruction"),Xe("authorized")])},AuthorizeNonceAccount:{index:7,layout:Qt.struct([Qt.u32("instruction"),Xe("authorized")])},Allocate:{index:8,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("space")])},AllocateWithSeed:{index:9,layout:Qt.struct([Qt.u32("instruction"),Xe("base"),Je("seed"),Qt.ns64("space"),Xe("programId")])},AssignWithSeed:{index:10,layout:Qt.struct([Qt.u32("instruction"),Xe("base"),Je("seed"),Xe("programId")])},TransferWithSeed:{index:11,layout:Qt.struct([Qt.u32("instruction"),bn("lamports"),Je("seed"),Xe("programId")])},UpgradeNonceAccount:{index:12,layout:Qt.struct([Qt.u32("instruction")])}});class _n{constructor(){}static createAccount(t){const e=mn(wn.Create,{lamports:t.lamports,space:t.space,programId:ze(t.programId.toBuffer())});return new an({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;return"basePubkey"in t?(e=mn(wn.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:ze(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=mn(wn.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new an({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;return"basePubkey"in t?(e=mn(wn.AssignWithSeed,{base:ze(t.basePubkey.toBuffer()),seed:t.seed,programId:ze(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=mn(wn.Assign,{programId:ze(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new an({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=mn(wn.CreateWithSeed,{base:ze(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:ze(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new an({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new un;"basePubkey"in t&&"seed"in t?e.add(_n.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:yn,programId:this.programId})):e.add(_n.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:yn,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=mn(wn.InitializeNonceAccount,{authorized:ze(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:dn,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new an(n)}static nonceAdvance(t){const e=mn(wn.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:dn,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new an(n)}static nonceWithdraw(t){const e=mn(wn.WithdrawNonceAccount,{lamports:t.lamports});return new an({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:dn,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=mn(wn.AuthorizeNonceAccount,{authorized:ze(t.newAuthorizedPubkey.toBuffer())});return new an({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;return"basePubkey"in t?(e=mn(wn.AllocateWithSeed,{base:ze(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:ze(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=mn(wn.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new an({keys:n,programId:this.programId,data:e})}}_n.programId=new Ke("11111111111111111111111111111111");class vn{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/vn.chunkSize)+1+1)}static async load(t,e,n,r,i){{const o=await t.getMinimumBalanceForRentExemption(i.length),s=await t.getAccountInfo(n.publicKey,"confirmed");let a=null;if(null!==s){if(s.executable)return console.error("Program load failed, account is already executable"),!1;s.data.length!==i.length&&(a=a||new un,a.add(_n.allocate({accountPubkey:n.publicKey,space:i.length}))),s.owner.equals(r)||(a=a||new un,a.add(_n.assign({accountPubkey:n.publicKey,programId:r}))),s.lamports0?o:1,space:i.length,programId:r}));null!==a&&await fn(t,a,[e,n],{commitment:"confirmed"})}const o=Qt.struct([Qt.u32("instruction"),Qt.u32("offset"),Qt.u32("bytesLength"),Qt.u32("bytesLengthPadding"),Qt.seq(Qt.u8("byte"),Qt.offset(Qt.u32(),-8),"bytes")]),s=vn.chunkSize;let u=0,c=i,d=[];for(;c.length>0;){const i=c.slice(0,s),l=a.Buffer.alloc(s+16);o.encode({instruction:0,offset:u,bytes:i,bytesLength:0,bytesLengthPadding:0},l);const h=(new un).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push(fn(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await pn(1e3/t)}u+=s,c=c.slice(s)}await Promise.all(d);{const i=Qt.struct([Qt.u32("instruction")]),o=a.Buffer.alloc(i.span);i.encode({instruction:1},o);const s=(new un).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1}],programId:r,data:o}),u="processed",c=await t.sendTransaction(s,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:s.lastValidBlockHeight,blockhash:s.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}vn.chunkSize=932,new Ke("BPFLoader2111111111111111111111111111111111"),Object.prototype.toString,Object.keys,globalThis.fetch,Qt.struct([Qt.u32("typeIndex"),bn("deactivationSlot"),Qt.nu64("lastExtendedSlot"),Qt.u8("lastExtendedStartIndex"),Qt.u8(),Qt.seq(Xe(),Qt.offset(Qt.u8(),-1),"authority")]);const kn=(0,ee.oQ)((0,ee.eE)(Ke),(0,ee.Z_)(),(t=>new Ke(t))),Mn=(0,ee.bc)([(0,ee.Z_)(),(0,ee.i0)("base64")]),An=(0,ee.oQ)((0,ee.eE)(a.Buffer),Mn,(t=>a.Buffer.from(t[0],"base64")));function Sn(t){return(0,ee.G0)([(0,ee.dt)({jsonrpc:(0,ee.i0)("2.0"),id:(0,ee.Z_)(),result:t}),(0,ee.dt)({jsonrpc:(0,ee.i0)("2.0"),id:(0,ee.Z_)(),error:(0,ee.dt)({code:(0,ee._4)(),message:(0,ee.Z_)(),data:(0,ee.jt)((0,ee.Yj)())})})])}const In=Sn((0,ee._4)());function xn(t){return(0,ee.oQ)(Sn(t),In,(e=>"error"in e?e:{...e,result:(0,ee.Ue)(e.result,t)}))}function En(t){return xn((0,ee.dt)({context:(0,ee.dt)({slot:(0,ee.Rx)()}),value:t}))}function Tn(t){return(0,ee.dt)({context:(0,ee.dt)({slot:(0,ee.Rx)()}),value:t})}const Pn=(0,ee.dt)({foundation:(0,ee.Rx)(),foundationTerm:(0,ee.Rx)(),initial:(0,ee.Rx)(),taper:(0,ee.Rx)(),terminal:(0,ee.Rx)()}),Bn=(xn((0,ee.IX)((0,ee.AG)((0,ee.dt)({epoch:(0,ee.Rx)(),effectiveSlot:(0,ee.Rx)(),amount:(0,ee.Rx)(),postBalance:(0,ee.Rx)(),commission:(0,ee.jt)((0,ee.AG)((0,ee.Rx)()))})))),(0,ee.IX)((0,ee.dt)({slot:(0,ee.Rx)(),prioritizationFee:(0,ee.Rx)()}))),Ln=(0,ee.dt)({total:(0,ee.Rx)(),validator:(0,ee.Rx)(),foundation:(0,ee.Rx)(),epoch:(0,ee.Rx)()}),$n=(0,ee.dt)({epoch:(0,ee.Rx)(),slotIndex:(0,ee.Rx)(),slotsInEpoch:(0,ee.Rx)(),absoluteSlot:(0,ee.Rx)(),blockHeight:(0,ee.jt)((0,ee.Rx)()),transactionCount:(0,ee.jt)((0,ee.Rx)())}),Rn=(0,ee.dt)({slotsPerEpoch:(0,ee.Rx)(),leaderScheduleSlotOffset:(0,ee.Rx)(),warmup:(0,ee.O7)(),firstNormalEpoch:(0,ee.Rx)(),firstNormalSlot:(0,ee.Rx)()}),On=(0,ee.IM)((0,ee.Z_)(),(0,ee.IX)((0,ee.Rx)())),Dn=(0,ee.AG)((0,ee.G0)([(0,ee.dt)({}),(0,ee.Z_)()])),Cn=(0,ee.dt)({err:Dn}),Nn=(0,ee.i0)("receivedSignature");(0,ee.dt)({"solana-core":(0,ee.Z_)(),"feature-set":(0,ee.jt)((0,ee.Rx)())}),En((0,ee.dt)({err:(0,ee.AG)((0,ee.G0)([(0,ee.dt)({}),(0,ee.Z_)()])),logs:(0,ee.AG)((0,ee.IX)((0,ee.Z_)())),accounts:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.AG)((0,ee.dt)({executable:(0,ee.O7)(),owner:(0,ee.Z_)(),lamports:(0,ee.Rx)(),data:(0,ee.IX)((0,ee.Z_)()),rentEpoch:(0,ee.jt)((0,ee.Rx)())}))))),unitsConsumed:(0,ee.jt)((0,ee.Rx)()),returnData:(0,ee.jt)((0,ee.AG)((0,ee.dt)({programId:(0,ee.Z_)(),data:(0,ee.bc)([(0,ee.Z_)(),(0,ee.i0)("base64")])})))})),En((0,ee.dt)({byIdentity:(0,ee.IM)((0,ee.Z_)(),(0,ee.IX)((0,ee.Rx)())),range:(0,ee.dt)({firstSlot:(0,ee.Rx)(),lastSlot:(0,ee.Rx)()})})),xn(Pn),xn(Ln),xn(Bn),xn($n),xn(Rn),xn(On),xn((0,ee.Rx)()),En((0,ee.dt)({total:(0,ee.Rx)(),circulating:(0,ee.Rx)(),nonCirculating:(0,ee.Rx)(),nonCirculatingAccounts:(0,ee.IX)(kn)}));const zn=(0,ee.dt)({amount:(0,ee.Z_)(),uiAmount:(0,ee.AG)((0,ee.Rx)()),decimals:(0,ee.Rx)(),uiAmountString:(0,ee.jt)((0,ee.Z_)())}),Un=(En((0,ee.IX)((0,ee.dt)({address:kn,amount:(0,ee.Z_)(),uiAmount:(0,ee.AG)((0,ee.Rx)()),decimals:(0,ee.Rx)(),uiAmountString:(0,ee.jt)((0,ee.Z_)())}))),En((0,ee.IX)((0,ee.dt)({pubkey:kn,account:(0,ee.dt)({executable:(0,ee.O7)(),owner:kn,lamports:(0,ee.Rx)(),data:An,rentEpoch:(0,ee.Rx)()})}))),(0,ee.dt)({program:(0,ee.Z_)(),parsed:(0,ee._4)(),space:(0,ee.Rx)()})),jn=(En((0,ee.IX)((0,ee.dt)({pubkey:kn,account:(0,ee.dt)({executable:(0,ee.O7)(),owner:kn,lamports:(0,ee.Rx)(),data:Un,rentEpoch:(0,ee.Rx)()})}))),En((0,ee.IX)((0,ee.dt)({lamports:(0,ee.Rx)(),address:kn}))),(0,ee.dt)({executable:(0,ee.O7)(),owner:kn,lamports:(0,ee.Rx)(),data:An,rentEpoch:(0,ee.Rx)()})),Yn=((0,ee.dt)({pubkey:kn,account:jn}),(0,ee.oQ)((0,ee.G0)([(0,ee.eE)(a.Buffer),Un]),(0,ee.G0)([Mn,Un]),(t=>Array.isArray(t)?(0,ee.Ue)(t,An):t))),Fn=(0,ee.dt)({executable:(0,ee.O7)(),owner:kn,lamports:(0,ee.Rx)(),data:Yn,rentEpoch:(0,ee.Rx)()}),Wn=((0,ee.dt)({pubkey:kn,account:Fn}),(0,ee.dt)({state:(0,ee.G0)([(0,ee.i0)("active"),(0,ee.i0)("inactive"),(0,ee.i0)("activating"),(0,ee.i0)("deactivating")]),active:(0,ee.Rx)(),inactive:(0,ee.Rx)()}),xn((0,ee.IX)((0,ee.dt)({signature:(0,ee.Z_)(),slot:(0,ee.Rx)(),err:Dn,memo:(0,ee.AG)((0,ee.Z_)()),blockTime:(0,ee.jt)((0,ee.AG)((0,ee.Rx)()))}))),xn((0,ee.IX)((0,ee.dt)({signature:(0,ee.Z_)(),slot:(0,ee.Rx)(),err:Dn,memo:(0,ee.AG)((0,ee.Z_)()),blockTime:(0,ee.jt)((0,ee.AG)((0,ee.Rx)()))}))),(0,ee.dt)({subscription:(0,ee.Rx)(),result:Tn(jn)}),(0,ee.dt)({pubkey:kn,account:jn})),Hn=((0,ee.dt)({subscription:(0,ee.Rx)(),result:Tn(Wn)}),(0,ee.dt)({parent:(0,ee.Rx)(),slot:(0,ee.Rx)(),root:(0,ee.Rx)()})),Kn=((0,ee.dt)({subscription:(0,ee.Rx)(),result:Hn}),(0,ee.G0)([(0,ee.dt)({type:(0,ee.G0)([(0,ee.i0)("firstShredReceived"),(0,ee.i0)("completed"),(0,ee.i0)("optimisticConfirmation"),(0,ee.i0)("root")]),slot:(0,ee.Rx)(),timestamp:(0,ee.Rx)()}),(0,ee.dt)({type:(0,ee.i0)("createdBank"),parent:(0,ee.Rx)(),slot:(0,ee.Rx)(),timestamp:(0,ee.Rx)()}),(0,ee.dt)({type:(0,ee.i0)("frozen"),slot:(0,ee.Rx)(),timestamp:(0,ee.Rx)(),stats:(0,ee.dt)({numTransactionEntries:(0,ee.Rx)(),numSuccessfulTransactions:(0,ee.Rx)(),numFailedTransactions:(0,ee.Rx)(),maxTransactionsPerEntry:(0,ee.Rx)()})}),(0,ee.dt)({type:(0,ee.i0)("dead"),slot:(0,ee.Rx)(),timestamp:(0,ee.Rx)(),err:(0,ee.Z_)()})])),qn=((0,ee.dt)({subscription:(0,ee.Rx)(),result:Kn}),(0,ee.dt)({subscription:(0,ee.Rx)(),result:Tn((0,ee.G0)([Cn,Nn]))}),(0,ee.dt)({subscription:(0,ee.Rx)(),result:(0,ee.Rx)()}),(0,ee.dt)({pubkey:(0,ee.Z_)(),gossip:(0,ee.AG)((0,ee.Z_)()),tpu:(0,ee.AG)((0,ee.Z_)()),rpc:(0,ee.AG)((0,ee.Z_)()),version:(0,ee.AG)((0,ee.Z_)())}),(0,ee.dt)({votePubkey:(0,ee.Z_)(),nodePubkey:(0,ee.Z_)(),activatedStake:(0,ee.Rx)(),epochVoteAccount:(0,ee.O7)(),epochCredits:(0,ee.IX)((0,ee.bc)([(0,ee.Rx)(),(0,ee.Rx)(),(0,ee.Rx)()])),commission:(0,ee.Rx)(),lastVote:(0,ee.Rx)(),rootSlot:(0,ee.AG)((0,ee.Rx)())})),Vn=(xn((0,ee.dt)({current:(0,ee.IX)(qn),delinquent:(0,ee.IX)(qn)})),(0,ee.G0)([(0,ee.i0)("processed"),(0,ee.i0)("confirmed"),(0,ee.i0)("finalized")])),Gn=(0,ee.dt)({slot:(0,ee.Rx)(),confirmations:(0,ee.AG)((0,ee.Rx)()),err:Dn,confirmationStatus:(0,ee.jt)(Vn)}),Zn=(En((0,ee.IX)((0,ee.AG)(Gn))),xn((0,ee.Rx)()),(0,ee.dt)({accountKey:kn,writableIndexes:(0,ee.IX)((0,ee.Rx)()),readonlyIndexes:(0,ee.IX)((0,ee.Rx)())})),Xn=(0,ee.dt)({signatures:(0,ee.IX)((0,ee.Z_)()),message:(0,ee.dt)({accountKeys:(0,ee.IX)((0,ee.Z_)()),header:(0,ee.dt)({numRequiredSignatures:(0,ee.Rx)(),numReadonlySignedAccounts:(0,ee.Rx)(),numReadonlyUnsignedAccounts:(0,ee.Rx)()}),instructions:(0,ee.IX)((0,ee.dt)({accounts:(0,ee.IX)((0,ee.Rx)()),data:(0,ee.Z_)(),programIdIndex:(0,ee.Rx)()})),recentBlockhash:(0,ee.Z_)(),addressTableLookups:(0,ee.jt)((0,ee.IX)(Zn))})}),Jn=(0,ee.dt)({pubkey:kn,signer:(0,ee.O7)(),writable:(0,ee.O7)(),source:(0,ee.jt)((0,ee.G0)([(0,ee.i0)("transaction"),(0,ee.i0)("lookupTable")]))}),Qn=(0,ee.dt)({accountKeys:(0,ee.IX)(Jn),signatures:(0,ee.IX)((0,ee.Z_)())}),tr=(0,ee.dt)({parsed:(0,ee._4)(),program:(0,ee.Z_)(),programId:kn}),er=(0,ee.dt)({accounts:(0,ee.IX)(kn),data:(0,ee.Z_)(),programId:kn}),nr=(0,ee.G0)([er,tr]),rr=(0,ee.G0)([(0,ee.dt)({parsed:(0,ee._4)(),program:(0,ee.Z_)(),programId:(0,ee.Z_)()}),(0,ee.dt)({accounts:(0,ee.IX)((0,ee.Z_)()),data:(0,ee.Z_)(),programId:(0,ee.Z_)()})]),ir=(0,ee.oQ)(nr,rr,(t=>"accounts"in t?(0,ee.Ue)(t,er):(0,ee.Ue)(t,tr))),or=(0,ee.dt)({signatures:(0,ee.IX)((0,ee.Z_)()),message:(0,ee.dt)({accountKeys:(0,ee.IX)(Jn),instructions:(0,ee.IX)(ir),recentBlockhash:(0,ee.Z_)(),addressTableLookups:(0,ee.jt)((0,ee.AG)((0,ee.IX)(Zn)))})}),sr=(0,ee.dt)({accountIndex:(0,ee.Rx)(),mint:(0,ee.Z_)(),owner:(0,ee.jt)((0,ee.Z_)()),uiTokenAmount:zn}),ar=(0,ee.dt)({writable:(0,ee.IX)(kn),readonly:(0,ee.IX)(kn)}),ur=(0,ee.dt)({err:Dn,fee:(0,ee.Rx)(),innerInstructions:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.dt)({index:(0,ee.Rx)(),instructions:(0,ee.IX)((0,ee.dt)({accounts:(0,ee.IX)((0,ee.Rx)()),data:(0,ee.Z_)(),programIdIndex:(0,ee.Rx)()}))})))),preBalances:(0,ee.IX)((0,ee.Rx)()),postBalances:(0,ee.IX)((0,ee.Rx)()),logMessages:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.Z_)()))),preTokenBalances:(0,ee.jt)((0,ee.AG)((0,ee.IX)(sr))),postTokenBalances:(0,ee.jt)((0,ee.AG)((0,ee.IX)(sr))),loadedAddresses:(0,ee.jt)(ar),computeUnitsConsumed:(0,ee.jt)((0,ee.Rx)())}),cr=(0,ee.dt)({err:Dn,fee:(0,ee.Rx)(),innerInstructions:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.dt)({index:(0,ee.Rx)(),instructions:(0,ee.IX)(ir)})))),preBalances:(0,ee.IX)((0,ee.Rx)()),postBalances:(0,ee.IX)((0,ee.Rx)()),logMessages:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.Z_)()))),preTokenBalances:(0,ee.jt)((0,ee.AG)((0,ee.IX)(sr))),postTokenBalances:(0,ee.jt)((0,ee.AG)((0,ee.IX)(sr))),loadedAddresses:(0,ee.jt)(ar),computeUnitsConsumed:(0,ee.jt)((0,ee.Rx)())}),dr=(0,ee.G0)([(0,ee.i0)(0),(0,ee.i0)("legacy")]),lr=(0,ee.dt)({pubkey:(0,ee.Z_)(),lamports:(0,ee.Rx)(),postBalance:(0,ee.AG)((0,ee.Rx)()),rewardType:(0,ee.AG)((0,ee.Z_)()),commission:(0,ee.jt)((0,ee.AG)((0,ee.Rx)()))}),hr=(xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:Xn,meta:(0,ee.AG)(ur),version:(0,ee.jt)(dr)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:Qn,meta:(0,ee.AG)(ur),version:(0,ee.jt)(dr)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:or,meta:(0,ee.AG)(cr),version:(0,ee.jt)(dr)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:Qn,meta:(0,ee.AG)(cr),version:(0,ee.jt)(dr)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:Xn,meta:(0,ee.AG)(ur)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),signatures:(0,ee.IX)((0,ee.Z_)()),blockTime:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({slot:(0,ee.Rx)(),meta:(0,ee.AG)(ur),blockTime:(0,ee.jt)((0,ee.AG)((0,ee.Rx)())),transaction:Xn,version:(0,ee.jt)(dr)}))),xn((0,ee.AG)((0,ee.dt)({slot:(0,ee.Rx)(),transaction:or,meta:(0,ee.AG)(cr),blockTime:(0,ee.jt)((0,ee.AG)((0,ee.Rx)())),version:(0,ee.jt)(dr)}))),En((0,ee.dt)({blockhash:(0,ee.Z_)(),feeCalculator:(0,ee.dt)({lamportsPerSignature:(0,ee.Rx)()})})),En((0,ee.dt)({blockhash:(0,ee.Z_)(),lastValidBlockHeight:(0,ee.Rx)()})),En((0,ee.O7)()),(0,ee.dt)({slot:(0,ee.Rx)(),numTransactions:(0,ee.Rx)(),numSlots:(0,ee.Rx)(),samplePeriodSecs:(0,ee.Rx)()})),fr=(xn((0,ee.IX)(hr)),En((0,ee.AG)((0,ee.dt)({feeCalculator:(0,ee.dt)({lamportsPerSignature:(0,ee.Rx)()})}))),xn((0,ee.Z_)()),xn((0,ee.Z_)()),(0,ee.dt)({err:Dn,logs:(0,ee.IX)((0,ee.Z_)()),signature:(0,ee.Z_)()}));(0,ee.dt)({result:Tn(fr),subscription:(0,ee.Rx)()});class pr{constructor(t){this._keypair=void 0,this._keypair=t??Re()}static generate(){return new pr(Re())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=Oe(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new pr({publicKey:n,secretKey:t})}static fromSeed(t){const e=Oe(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new pr({publicKey:e,secretKey:n})}get publicKey(){return new Ke(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:Qt.struct([Qt.u32("instruction"),bn("recentSlot"),Qt.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Qt.struct([Qt.u32("instruction")])},ExtendLookupTable:{index:2,layout:Qt.struct([Qt.u32("instruction"),bn(),Qt.seq(Xe(),Qt.offset(Qt.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Qt.struct([Qt.u32("instruction")])},CloseLookupTable:{index:4,layout:Qt.struct([Qt.u32("instruction")])}});new Ke("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:Qt.struct([Qt.u8("instruction"),Qt.u32("units"),Qt.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Qt.struct([Qt.u8("instruction"),Qt.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Qt.struct([Qt.u8("instruction"),Qt.u32("units")])},SetComputeUnitPrice:{index:3,layout:Qt.struct([Qt.u8("instruction"),bn("microLamports")])}});new Ke("ComputeBudget111111111111111111111111111111");const mr=Qt.struct([Qt.u8("numSignatures"),Qt.u8("padding"),Qt.u16("signatureOffset"),Qt.u16("signatureInstructionIndex"),Qt.u16("publicKeyOffset"),Qt.u16("publicKeyInstructionIndex"),Qt.u16("messageDataOffset"),Qt.u16("messageDataSize"),Qt.u16("messageInstructionIndex")]);class gr{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:i}=t;nn(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),nn(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const o=mr.span,s=o+e.length,u=s+r.length,c=a.Buffer.alloc(u+n.length),d=null==i?65535:i;return mr.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:d,publicKeyOffset:o,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,o),c.fill(r,s),c.fill(n,u),new an({keys:[],programId:gr.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;nn(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=pr.fromSecretKey(e),i=t.publicKey.toBytes(),o=Ce(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}gr.programId=new Ke("Ed25519SigVerify111111111111111111111111111"),$e.utils.isValidPrivateKey;const yr=$e.getPublicKey,br=Qt.struct([Qt.u8("numSignatures"),Qt.u16("signatureOffset"),Qt.u8("signatureInstructionIndex"),Qt.u16("ethAddressOffset"),Qt.u8("ethAddressInstructionIndex"),Qt.u16("messageDataOffset"),Qt.u16("messageDataSize"),Qt.u8("messageInstructionIndex"),Qt.blob(20,"ethAddress"),Qt.blob(64,"signature"),Qt.u8("recoveryId")]);class wr{constructor(){}static publicKeyToEthAddress(t){nn(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return a.Buffer.from(ge(ze(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return wr.createInstructionWithEthAddress({ethAddress:wr.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:i,instructionIndex:o=0}=t;let s;s="string"==typeof e?e.startsWith("0x")?a.Buffer.from(e.substr(2),"hex"):a.Buffer.from(e,"hex"):e,nn(20===s.length,`Address must be 20 bytes but received ${s.length} bytes`);const u=12+s.length,c=u+r.length+1,d=a.Buffer.alloc(br.span+n.length);return br.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:o,signature:ze(r),ethAddress:ze(s),recoveryId:i},d),d.fill(ze(n),br.span),new an({keys:[],programId:wr.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;nn(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=ze(e),i=yr(t,!1).slice(1),o=a.Buffer.from(ge(ze(n))),[s,u]=((t,e)=>{const n=$e.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(o,t);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:s,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var _r;wr.programId=new Ke("KeccakSecp256k11111111111111111111111111111");const vr=new Ke("StakeConfig11111111111111111111111111111111");class kr{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}_r=kr,kr.default=new _r(0,0,Ke.default);const Mr=Object.freeze({Initialize:{index:0,layout:Qt.struct([Qt.u32("instruction"),((t="authorized")=>Qt.struct([Xe("staker"),Xe("withdrawer")],t))(),((t="lockup")=>Qt.struct([Qt.ns64("unixTimestamp"),Qt.ns64("epoch"),Xe("custodian")],t))()])},Authorize:{index:1,layout:Qt.struct([Qt.u32("instruction"),Xe("newAuthorized"),Qt.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:Qt.struct([Qt.u32("instruction")])},Split:{index:3,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports")])},Withdraw:{index:4,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports")])},Deactivate:{index:5,layout:Qt.struct([Qt.u32("instruction")])},Merge:{index:7,layout:Qt.struct([Qt.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:Qt.struct([Qt.u32("instruction"),Xe("newAuthorized"),Qt.u32("stakeAuthorizationType"),Je("authoritySeed"),Xe("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Ar{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||kr.default,o=mn(Mr.Initialize,{authorized:{staker:ze(n.staker.toBuffer()),withdrawer:ze(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:ze(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new an(s)}static createAccountWithSeed(t){const e=new un;e.add(_n.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new un;e.add(_n.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=mn(Mr.Delegate);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:hn,isSigner:!1,isWritable:!1},{pubkey:vr,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=mn(Mr.Authorize,{newAuthorized:ze(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new un).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=mn(Mr.AuthorizeWithSeed,{newAuthorized:ze(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:ze(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:cn,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new un).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=mn(Mr.Split,{lamports:i});return new an({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new un;return e.add(_n.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:s}=t,a=new un;return a.add(_n.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),a.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:s}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=mn(Mr.Merge);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:hn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=mn(Mr.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:hn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new un).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=mn(Mr.Deactivate);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}Ar.programId=new Ke("Stake11111111111111111111111111111111111111"),Ar.space=200;const Sr=Object.freeze({InitializeAccount:{index:0,layout:Qt.struct([Qt.u32("instruction"),((t="voteInit")=>Qt.struct([Xe("nodePubkey"),Xe("authorizedVoter"),Xe("authorizedWithdrawer"),Qt.u8("commission")],t))()])},Authorize:{index:1,layout:Qt.struct([Qt.u32("instruction"),Xe("newAuthorized"),Qt.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports")])},AuthorizeWithSeed:{index:10,layout:Qt.struct([Qt.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>Qt.struct([Qt.u32("voteAuthorizationType"),Xe("currentAuthorityDerivedKeyOwnerPubkey"),Je("currentAuthorityDerivedKeySeed"),Xe("newAuthorized")],t))()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class Ir{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=mn(Sr.InitializeAccount,{voteInit:{nodePubkey:ze(r.nodePubkey.toBuffer()),authorizedVoter:ze(r.authorizedVoter.toBuffer()),authorizedWithdrawer:ze(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new an(o)}static createAccount(t){const e=new un;return e.add(_n.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=mn(Sr.Authorize,{newAuthorized:ze(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=mn(Sr.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:ze(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:ze(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new un).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=mn(Sr.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return Ir.withdraw(t)}}Ir.programId=new Ke("Vote111111111111111111111111111111111111111"),Ir.space=3731,new Ke("Va1idator1nfo111111111111111111111111111111"),(0,ee.dt)({name:(0,ee.Z_)(),website:(0,ee.jt)((0,ee.Z_)()),details:(0,ee.jt)((0,ee.Z_)()),keybaseUsername:(0,ee.jt)((0,ee.Z_)())}),new Ke("Vote111111111111111111111111111111111111111"),Qt.struct([Xe("nodePubkey"),Xe("authorizedWithdrawer"),Qt.u8("commission"),Qt.nu64(),Qt.seq(Qt.struct([Qt.nu64("slot"),Qt.u32("confirmationCount")]),Qt.offset(Qt.u32(),-8),"votes"),Qt.u8("rootSlotValid"),Qt.nu64("rootSlot"),Qt.nu64(),Qt.seq(Qt.struct([Qt.nu64("epoch"),Xe("authorizedVoter")]),Qt.offset(Qt.u32(),-8),"authorizedVoters"),Qt.struct([Qt.seq(Qt.struct([Xe("authorizedPubkey"),Qt.nu64("epochOfLastAuthorizedSwitch"),Qt.nu64("targetEpoch")]),32,"buf"),Qt.nu64("idx"),Qt.u8("isEmpty")],"priorVoters"),Qt.nu64(),Qt.seq(Qt.struct([Qt.nu64("epoch"),Qt.nu64("credits"),Qt.nu64("prevCredits")]),Qt.offset(Qt.u32(),-8),"epochCredits"),Qt.struct([Qt.nu64("slot"),Qt.nu64("timestamp")],"lastTimestamp")]);for(var xr={},Er={byteLength:function(t){var e=Rr(t),n=e[0],r=e[1];return 3*(n+r)/4-r},toByteArray:function(t){var e,n,r=Rr(t),i=r[0],o=r[1],s=new Br(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=Pr[t.charCodeAt(n)]<<2|Pr[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=Pr[t.charCodeAt(n)]<<10|Pr[t.charCodeAt(n+1)]<<4|Pr[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;sa?a:s+o));return 1===r?(e=t[n-1],i.push(Tr[e>>2]+Tr[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(Tr[e>>10]+Tr[e>>4&63]+Tr[e<<2&63]+"=")),i.join("")}},Tr=[],Pr=[],Br="undefined"!=typeof Uint8Array?Uint8Array:Array,Lr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$r=0;$r<64;++$r)Tr[$r]=Lr[$r],Pr[Lr.charCodeAt($r)]=$r;function Rr(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function Or(t,e,n){for(var r,i,o=[],s=e;s>18&63]+Tr[i>>12&63]+Tr[i>>6&63]+Tr[63&i]);return o.join("")}Pr["-".charCodeAt(0)]=62,Pr["_".charCodeAt(0)]=63;var Dr={read:function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,d=-7,l=n?i-1:0,h=n?-1:1,f=t[e+l];for(l+=h,o=f&(1<<-d)-1,f>>=-d,d+=a;d>0;o=256*o+t[e+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+t[e+l],l+=h,d-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,d=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;t[n+f]=255&s,f+=p,s/=256,c-=8);t[n+f-p]|=128*m}};!function(t){const e=Er,n=Dr,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|f(t,e);let r=o(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(q(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(q(t,ArrayBuffer)||t&&q(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(q(t,SharedArrayBuffer)||t&&q(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);const i=function(t){if(s.isBuffer(t)){const e=0|h(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||V(t.length)?o(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return u(t),o(t<0?0:0|h(t))}function d(t){const e=t.length<0?0:0|h(t.length),n=o(e);for(let r=0;r=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function f(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return E(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return M(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),V(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function M(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(e+=" ... "),""},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,i){if(q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0);const u=Math.min(o,a),c=this.slice(r,i),d=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return _(this,t,e,n);case"base64":return v(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function L(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function $(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function R(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,r,i,o){return e=+e,r>>>=0,o||R(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function D(t,e,r,i,o){return e=+e,r>>>=0,o||R(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Z((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Y(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Y(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Z((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Y(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Y(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||P(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||B(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||B(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Z((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Z((function(t,e=0){return $(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=Z((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Z((function(t,e=0){return $(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function U(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new C.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){j(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||Y(e,t.length-(n+1))}(r,i,o)}function j(t,e){if("number"!=typeof t)throw new C.ERR_INVALID_ARG_TYPE(e,"number",t)}function Y(t,e,n){if(Math.floor(t)!==t)throw j(t,n),new C.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new C.ERR_BUFFER_OUT_OF_BOUNDS;throw new C.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}N("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),N("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),N("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=z(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const F=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function V(t){return t!=t}const G=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?X:t}function X(){throw new Error("BigInt not supported")}}(xr);var Cr=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Nr="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t};function zr(t,e){var n={seen:[],stylize:jr};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Hr(e)?n.showHidden=e:e&&function(t,e){if(!e||!Zr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]]}(n,e),Vr(n.showHidden)&&(n.showHidden=!1),Vr(n.depth)&&(n.depth=2),Vr(n.colors)&&(n.colors=!1),Vr(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Ur),Yr(n,t,n.depth)}function Ur(t,e){var n=zr.styles[e];return n?"["+zr.colors[n][0]+"m"+t+"["+zr.colors[n][1]+"m":t}function jr(t,e){return t}function Yr(t,e,n){if(t.customInspect&&e&&Qr(e.inspect)&&e.inspect!==zr&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return qr(r)||(r=Yr(t,r,n)),r}var i=function(t,e){if(Vr(e))return t.stylize("undefined","undefined");if(qr(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return"number"==typeof e?t.stylize(""+e,"number"):Hr(e)?t.stylize(""+e,"boolean"):Kr(e)?t.stylize("null","null"):void 0}(t,e);if(i)return i;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Jr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Fr(e);if(0===o.length){if(Qr(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Gr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Xr(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Jr(e))return Fr(e)}var u,c,d="",l=!1,h=["{","}"];return u=e,Array.isArray(u)&&(l=!0,h=["[","]"]),Qr(e)&&(d=" [Function"+(e.name?": "+e.name:"")+"]"),Gr(e)&&(d=" "+RegExp.prototype.toString.call(e)),Xr(e)&&(d=" "+Date.prototype.toUTCString.call(e)),Jr(e)&&(d=" "+Fr(e)),0!==o.length||l&&0!=e.length?n<0?Gr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=l?function(t,e,n,r,i){for(var o=[],s=0,a=e.length;s60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(c,d,h)):h[0]+d+h[1]}function Fr(t){return"["+Error.prototype.toString.call(t)+"]"}function Wr(t,e,n,r,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),ni(r,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=Kr(n)?Yr(t,u.value,null):Yr(t,u.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),Vr(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function Hr(t){return"boolean"==typeof t}function Kr(t){return null===t}function qr(t){return"string"==typeof t}function Vr(t){return void 0===t}function Gr(t){return Zr(t)&&"[object RegExp]"===ei(t)}function Zr(t){return"object"==typeof t&&null!==t}function Xr(t){return Zr(t)&&"[object Date]"===ei(t)}function Jr(t){return Zr(t)&&("[object Error]"===ei(t)||t instanceof Error)}function Qr(t){return"function"==typeof t}function ti(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function ei(t){return Object.prototype.toString.call(t)}function ni(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ri(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}}function mi(t,e){return"string"==typeof t?t.length=0;a--)if(u[a]!==c[a])return!1;for(a=u.length-1;a>=0;a--)if(!wi(t[s=u[a]],e[s],n,r))return!1;return!0}(t,e,n,r))}return n?t===e:t==e}function _i(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function vi(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function ki(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&yi(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!t&&i&&!n;if((!t&&Jr(i)&&o&&vi(i,n)||s)&&yi(i,n,"Got unwanted exception"+r),t&&i&&n&&!vi(i,n)||!t&&i)throw i}li.AssertionError=pi,Nr(pi,Error),li.fail=yi,li.ok=bi,li.equal=function t(e,n,r){e!=n&&yi(e,n,r,"==",t)},li.notEqual=function t(e,n,r){e==n&&yi(e,n,r,"!=",t)},li.deepEqual=function t(e,n,r){wi(e,n,!1)||yi(e,n,r,"deepEqual",t)},li.deepStrictEqual=function t(e,n,r){wi(e,n,!0)||yi(e,n,r,"deepStrictEqual",t)},li.notDeepEqual=function t(e,n,r){wi(e,n,!1)&&yi(e,n,r,"notDeepEqual",t)},li.notDeepStrictEqual=function t(e,n,r){wi(e,n,!0)&&yi(e,n,r,"notDeepStrictEqual",t)},li.strictEqual=function t(e,n,r){e!==n&&yi(e,n,r,"===",t)},li.notStrictEqual=function t(e,n,r){e===n&&yi(e,n,r,"!==",t)},li.throws=function(t,e,n){ki(!0,t,e,n)},li.doesNotThrow=function(t,e,n){ki(!1,t,e,n)},li.ifError=function(t){if(t)throw t};var Mi={};class Ai{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function Si(t,e){return e.property?t+"["+e.property+"]":t}Mi.Layout=Ai,Mi.nameWithProperty=Si,Mi.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Ai))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class Ii extends Ai{isCount(){throw new Error("ExternalLayout is abstract")}}class xi extends Ii{constructor(t,e){if(void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class Ei extends Ii{constructor(t,e,n){if(!(t instanceof Ai))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Ti||this.layout instanceof Pi}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class Ti extends Ai{constructor(t,e){if(super(t,e),6t+r.encode(i,e,n+t)),0);return this.count instanceof Ii&&this.count.encode(t.length,e,n),i}}class Hi extends Ai{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof Ai),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class Ki{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class qi extends Ki{constructor(t,e){if(!(t instanceof Ii&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class Vi extends Ai{constructor(t,e,n){const r=t instanceof Ti||t instanceof Pi;if(r)t=new qi(new Ei(t));else if(t instanceof Ii&&t.isCount())t=new qi(t);else if(!(t instanceof Ki))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof Ai))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new Gi(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return xr.Buffer.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Gi extends Ai{constructor(t,e,n,r){if(!(t instanceof Vi))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof Ai))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Zi(t){return 0>t&&(t+=4294967296),t}class Xi extends Ai{constructor(t,e,n){if(!(t instanceof Ti||t instanceof Pi))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Zi(t&this.valueMask))throw new TypeError(Si("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Zi(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof Ii&&(r=t.length),!xr.Buffer.isBuffer(t)||r!==t.length)throw new TypeError(Si("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof Ii&&this.length.encode(r,e,n),r}}class eo extends Ai{constructor(t){super(-1,t)}getSpan(t,e){if(!xr.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}class no extends Ai{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!xr.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}class ro extends Ai{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}Mi.ExternalLayout=Ii,Mi.GreedyCount=xi,Mi.OffsetLayout=Ei,Mi.UInt=Ti,Mi.UIntBE=Pi,Mi.Int=Bi,Mi.IntBE=Li,Mi.Float=Ui,Mi.FloatBE=ji,Mi.Double=Yi,Mi.DoubleBE=Fi,Mi.Sequence=Wi,Mi.Structure=Hi,Mi.UnionDiscriminator=Ki,Mi.UnionLayoutDiscriminator=qi,Mi.Union=Vi,Mi.VariantLayout=Gi,Mi.BitStructure=Xi,Mi.BitField=Ji,Mi.Boolean=Qi,Mi.Blob=to,Mi.CString=eo,Mi.UTF8=no,Mi.Constant=ro,Mi.greedy=(t,e)=>new xi(t,e),Mi.offset=(t,e,n)=>new Ei(t,e,n);var io=Mi.u8=t=>new Ti(1,t);Mi.u16=t=>new Ti(2,t),Mi.u24=t=>new Ti(3,t);var oo=Mi.u32=t=>new Ti(4,t);Mi.u40=t=>new Ti(5,t),Mi.u48=t=>new Ti(6,t),Mi.nu64=t=>new Di(t),Mi.u16be=t=>new Pi(2,t),Mi.u24be=t=>new Pi(3,t),Mi.u32be=t=>new Pi(4,t),Mi.u40be=t=>new Pi(5,t),Mi.u48be=t=>new Pi(6,t),Mi.nu64be=t=>new Ci(t),Mi.s8=t=>new Bi(1,t),Mi.s16=t=>new Bi(2,t),Mi.s24=t=>new Bi(3,t),Mi.s32=t=>new Bi(4,t),Mi.s40=t=>new Bi(5,t),Mi.s48=t=>new Bi(6,t),Mi.ns64=t=>new Ni(t),Mi.s16be=t=>new Li(2,t),Mi.s24be=t=>new Li(3,t),Mi.s32be=t=>new Li(4,t),Mi.s40be=t=>new Li(5,t),Mi.s48be=t=>new Li(6,t),Mi.ns64be=t=>new zi(t),Mi.f32=t=>new Ui(t),Mi.f32be=t=>new ji(t),Mi.f64=t=>new Yi(t),Mi.f64be=t=>new Fi(t);var so=Mi.struct=(t,e,n)=>new Hi(t,e,n);Mi.bits=(t,e,n)=>new Xi(t,e,n),Mi.seq=(t,e,n)=>new Wi(t,e,n),Mi.union=(t,e,n)=>new Vi(t,e,n),Mi.unionLayoutDiscriminator=(t,e)=>new qi(t,e);var ao=Mi.blob=(t,e)=>new to(t,e);Mi.cstr=t=>new eo(t),Mi.utf8=(t,e)=>new no(t,e),Mi.const=(t,e)=>new ro(t,e);const uo=(t="publicKey")=>ao(32,t),co=(t="uint64")=>ao(8,t);function lo(t,e,n,...r){return fn(e,n,r,{skipPreflight:!1})}const ho=new Ke("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),fo=new Ke("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),po="Failed to find account",mo="Invalid account owner";function go(t){return xr.Buffer.from(t.toBuffer())}class yo extends(s()){toBuffer(){const t=super.toArray().reverse(),e=xr.Buffer.from(t);if(8===e.length)return e;li(e.length<8,"u64 too large");const n=xr.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){return li(8===t.length,`Invalid buffer length: ${t.length}`),new yo([...t].reverse().map((t=>`00${t.toString(16)}`.slice(-2))).join(""),16)}}function bo(t){return"publicKey"in t}const wo={MintTokens:0,FreezeAccount:1,AccountOwner:2,CloseAccount:3},_o=new Ke("So11111111111111111111111111111111111111112"),vo=so([oo("mintAuthorityOption"),uo("mintAuthority"),co("supply"),io("decimals"),io("isInitialized"),oo("freezeAuthorityOption"),uo("freezeAuthority")]),ko=so([uo("mint"),uo("owner"),co("amount"),oo("delegateOption"),uo("delegate"),io("state"),oo("isNativeOption"),co("isNative"),co("delegatedAmount"),oo("closeAuthorityOption"),uo("closeAuthority")]),Mo=so([io("m"),io("n"),io("is_initialized"),uo("signer1"),uo("signer2"),uo("signer3"),uo("signer4"),uo("signer5"),uo("signer6"),uo("signer7"),uo("signer8"),uo("signer9"),uo("signer10"),uo("signer11")]);class Ao{constructor(t,e,n,r){(0,i.Z)(this,"connection",void 0),(0,i.Z)(this,"publicKey",void 0),(0,i.Z)(this,"programId",void 0),(0,i.Z)(this,"associatedProgramId",void 0),(0,i.Z)(this,"payer",void 0),Object.assign(this,{connection:t,publicKey:e,programId:n,payer:r,associatedProgramId:fo})}static async getMinBalanceRentForExemptMint(t){return await t.getMinimumBalanceForRentExemption(vo.span)}static async getMinBalanceRentForExemptAccount(t){return await t.getMinimumBalanceForRentExemption(ko.span)}static async getMinBalanceRentForExemptMultisig(t){return await t.getMinimumBalanceForRentExemption(Mo.span)}static async createMint(t,e,n,r,i,o){const s=pr.generate(),a=new Ao(t,s.publicKey,o,e),u=await Ao.getMinBalanceRentForExemptMint(t),c=new un;return c.add(_n.createAccount({fromPubkey:e.publicKey,newAccountPubkey:s.publicKey,lamports:u,space:vo.span,programId:o})),c.add(Ao.createInitMintInstruction(o,s.publicKey,i,n,r)),await lo(0,t,c,e,s),a}async createAccount(t){const e=await Ao.getMinBalanceRentForExemptAccount(this.connection),n=pr.generate(),r=new un;r.add(_n.createAccount({fromPubkey:this.payer.publicKey,newAccountPubkey:n.publicKey,lamports:e,space:ko.span,programId:this.programId}));const i=this.publicKey;return r.add(Ao.createInitAccountInstruction(this.programId,i,n.publicKey,t)),await lo(0,this.connection,r,this.payer,n),n.publicKey}async createAssociatedTokenAccount(t){const e=await Ao.getAssociatedTokenAddress(this.associatedProgramId,this.programId,this.publicKey,t);return this.createAssociatedTokenAccountInternal(t,e)}async createAssociatedTokenAccountInternal(t,e){return await lo(0,this.connection,(new un).add(Ao.createAssociatedTokenAccountInstruction(this.associatedProgramId,this.programId,this.publicKey,e,t,this.payer.publicKey)),this.payer),e}async getOrCreateAssociatedAccountInfo(t){const e=await Ao.getAssociatedTokenAddress(this.associatedProgramId,this.programId,this.publicKey,t);try{return await this.getAccountInfo(e)}catch(n){if(n.message===po||n.message===mo){try{await this.createAssociatedTokenAccountInternal(t,e)}catch(t){}return await this.getAccountInfo(e)}throw n}}static async createWrappedNativeAccount(t,e,n,r,i){const o=await Ao.getMinBalanceRentForExemptAccount(t),s=pr.generate(),a=new un;return a.add(_n.createAccount({fromPubkey:r.publicKey,newAccountPubkey:s.publicKey,lamports:o,space:ko.span,programId:e})),a.add(_n.transfer({fromPubkey:r.publicKey,toPubkey:s.publicKey,lamports:i})),a.add(Ao.createInitAccountInstruction(e,_o,s.publicKey,n)),await lo(0,t,a,r,s),s.publicKey}async createMultisig(t,e){const n=pr.generate(),r=await Ao.getMinBalanceRentForExemptMultisig(this.connection),i=new un;i.add(_n.createAccount({fromPubkey:this.payer.publicKey,newAccountPubkey:n.publicKey,lamports:r,space:Mo.span,programId:this.programId}));let o=[{pubkey:n.publicKey,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1}];e.forEach((t=>o.push({pubkey:t,isSigner:!1,isWritable:!1})));const s=so([io("instruction"),io("m")]),a=xr.Buffer.alloc(s.span);return s.encode({instruction:2,m:t},a),i.add({keys:o,programId:this.programId,data:a}),await lo(0,this.connection,i,this.payer,n),n.publicKey}async getMintInfo(){const t=await this.connection.getAccountInfo(this.publicKey);if(null===t)throw new Error("Failed to find mint account");if(!t.owner.equals(this.programId))throw new Error(`Invalid mint owner: ${JSON.stringify(t.owner)}`);if(t.data.length!=vo.span)throw new Error("Invalid mint size");const e=xr.Buffer.from(t.data),n=vo.decode(e);return 0===n.mintAuthorityOption?n.mintAuthority=null:n.mintAuthority=new Ke(n.mintAuthority),n.supply=yo.fromBuffer(n.supply),n.isInitialized=0!=n.isInitialized,0===n.freezeAuthorityOption?n.freezeAuthority=null:n.freezeAuthority=new Ke(n.freezeAuthority),n}async getAccountInfo(t,e){const n=await this.connection.getAccountInfo(t,e);if(null===n)throw new Error(po);if(!n.owner.equals(this.programId))throw new Error(mo);if(n.data.length!=ko.span)throw new Error("Invalid account size");const r=xr.Buffer.from(n.data),i=ko.decode(r);if(i.address=t,i.mint=new Ke(i.mint),i.owner=new Ke(i.owner),i.amount=yo.fromBuffer(i.amount),0===i.delegateOption?(i.delegate=null,i.delegatedAmount=new yo):(i.delegate=new Ke(i.delegate),i.delegatedAmount=yo.fromBuffer(i.delegatedAmount)),i.isInitialized=0!==i.state,i.isFrozen=2===i.state,1===i.isNativeOption?(i.rentExemptReserve=yo.fromBuffer(i.isNative),i.isNative=!0):(i.rentExemptReserve=null,i.isNative=!1),0===i.closeAuthorityOption?i.closeAuthority=null:i.closeAuthority=new Ke(i.closeAuthority),!i.mint.equals(this.publicKey))throw new Error(`Invalid account mint: ${JSON.stringify(i.mint)} !== ${JSON.stringify(this.publicKey)}`);return i}async getMultisigInfo(t){const e=await this.connection.getAccountInfo(t);if(null===e)throw new Error("Failed to find multisig");if(!e.owner.equals(this.programId))throw new Error("Invalid multisig owner");if(e.data.length!=Mo.span)throw new Error("Invalid multisig size");const n=xr.Buffer.from(e.data),r=Mo.decode(n);return r.signer1=new Ke(r.signer1),r.signer2=new Ke(r.signer2),r.signer3=new Ke(r.signer3),r.signer4=new Ke(r.signer4),r.signer5=new Ke(r.signer5),r.signer6=new Ke(r.signer6),r.signer7=new Ke(r.signer7),r.signer8=new Ke(r.signer8),r.signer9=new Ke(r.signer9),r.signer10=new Ke(r.signer10),r.signer11=new Ke(r.signer11),r}async transfer(t,e,n,r,i){let o,s;return bo(n)?(o=n.publicKey,s=[n]):(o=n,s=r),await lo("Transfer",this.connection,(new un).add(Ao.createTransferInstruction(this.programId,t,e,o,r,i)),this.payer,...s)}async approve(t,e,n,r,i){let o,s;bo(n)?(o=n.publicKey,s=[n]):(o=n,s=r),await lo("Approve",this.connection,(new un).add(Ao.createApproveInstruction(this.programId,t,e,o,r,i)),this.payer,...s)}async revoke(t,e,n){let r,i;bo(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await lo("Revoke",this.connection,(new un).add(Ao.createRevokeInstruction(this.programId,t,r,n)),this.payer,...i)}async setAuthority(t,e,n,r,i){let o,s;bo(r)?(o=r.publicKey,s=[r]):(o=r,s=i),await lo("SetAuthority",this.connection,(new un).add(Ao.createSetAuthorityInstruction(this.programId,t,e,n,o,i)),this.payer,...s)}async mintTo(t,e,n,r){let i,o;bo(e)?(i=e.publicKey,o=[e]):(i=e,o=n),await lo("MintTo",this.connection,(new un).add(Ao.createMintToInstruction(this.programId,this.publicKey,t,i,n,r)),this.payer,...o)}async burn(t,e,n,r){let i,o;bo(e)?(i=e.publicKey,o=[e]):(i=e,o=n),await lo("Burn",this.connection,(new un).add(Ao.createBurnInstruction(this.programId,this.publicKey,t,i,n,r)),this.payer,...o)}async closeAccount(t,e,n,r){let i,o;bo(n)?(i=n.publicKey,o=[n]):(i=n,o=r),await lo("CloseAccount",this.connection,(new un).add(Ao.createCloseAccountInstruction(this.programId,t,e,i,r)),this.payer,...o)}async freezeAccount(t,e,n){let r,i;bo(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await lo("FreezeAccount",this.connection,(new un).add(Ao.createFreezeAccountInstruction(this.programId,t,this.publicKey,r,n)),this.payer,...i)}async thawAccount(t,e,n){let r,i;bo(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await lo("ThawAccount",this.connection,(new un).add(Ao.createThawAccountInstruction(this.programId,t,this.publicKey,r,n)),this.payer,...i)}async transferChecked(t,e,n,r,i,o){let s,a;return bo(n)?(s=n.publicKey,a=[n]):(s=n,a=r),await lo("TransferChecked",this.connection,(new un).add(Ao.createTransferCheckedInstruction(this.programId,t,this.publicKey,e,s,r,i,o)),this.payer,...a)}async approveChecked(t,e,n,r,i,o){let s,a;bo(n)?(s=n.publicKey,a=[n]):(s=n,a=r),await lo("ApproveChecked",this.connection,(new un).add(Ao.createApproveCheckedInstruction(this.programId,t,this.publicKey,e,s,r,i,o)),this.payer,...a)}async mintToChecked(t,e,n,r,i){let o,s;bo(e)?(o=e.publicKey,s=[e]):(o=e,s=n),await lo("MintToChecked",this.connection,(new un).add(Ao.createMintToCheckedInstruction(this.programId,this.publicKey,t,o,n,r,i)),this.payer,...s)}async burnChecked(t,e,n,r,i){let o,s;bo(e)?(o=e.publicKey,s=[e]):(o=e,s=n),await lo("BurnChecked",this.connection,(new un).add(Ao.createBurnCheckedInstruction(this.programId,this.publicKey,t,o,n,r,i)),this.payer,...s)}async syncNative(t){await lo(0,this.connection,(new un).add(Ao.createSyncNativeInstruction(this.programId,t)),this.payer)}static createInitMintInstruction(t,e,n,r,i){let o=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1}];const s=so([io("instruction"),io("decimals"),uo("mintAuthority"),io("option"),uo("freezeAuthority")]);let a=xr.Buffer.alloc(1024);{const t=s.encode({instruction:0,decimals:n,mintAuthority:go(r),option:null===i?0:1,freezeAuthority:go(i||new Ke(0))},a);a=a.slice(0,t)}return new an({keys:o,programId:t,data:a})}static createInitAccountInstruction(t,e,n,r){const i=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1}],o=so([io("instruction")]),s=xr.Buffer.alloc(o.span);return o.encode({instruction:1},s),new an({keys:i,programId:t,data:s})}static createTransferInstruction(t,e,n,r,i,o){const s=so([io("instruction"),co("amount")]),a=xr.Buffer.alloc(s.span);s.encode({instruction:3,amount:new yo(o).toBuffer()},a);let u=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?u.push({pubkey:r,isSigner:!0,isWritable:!1}):(u.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createApproveInstruction(t,e,n,r,i,o){const s=so([io("instruction"),co("amount")]),a=xr.Buffer.alloc(s.span);s.encode({instruction:4,amount:new yo(o).toBuffer()},a);let u=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?u.push({pubkey:r,isSigner:!0,isWritable:!1}):(u.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createRevokeInstruction(t,e,n,r){const i=so([io("instruction")]),o=xr.Buffer.alloc(i.span);i.encode({instruction:5},o);let s=[{pubkey:e,isSigner:!1,isWritable:!0}];return 0===r.length?s.push({pubkey:n,isSigner:!0,isWritable:!1}):(s.push({pubkey:n,isSigner:!1,isWritable:!1}),r.forEach((t=>s.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:s,programId:t,data:o})}static createSetAuthorityInstruction(t,e,n,r,i,o){const s=so([io("instruction"),io("authorityType"),io("option"),uo("newAuthority")]);let a=xr.Buffer.alloc(1024);{const t=s.encode({instruction:6,authorityType:wo[r],option:null===n?0:1,newAuthority:go(n||new Ke(0))},a);a=a.slice(0,t)}let u=[{pubkey:e,isSigner:!1,isWritable:!0}];return 0===o.length?u.push({pubkey:i,isSigner:!0,isWritable:!1}):(u.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createMintToInstruction(t,e,n,r,i,o){const s=so([io("instruction"),co("amount")]),a=xr.Buffer.alloc(s.span);s.encode({instruction:7,amount:new yo(o).toBuffer()},a);let u=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?u.push({pubkey:r,isSigner:!0,isWritable:!1}):(u.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createBurnInstruction(t,e,n,r,i,o){const s=so([io("instruction"),co("amount")]),a=xr.Buffer.alloc(s.span);s.encode({instruction:8,amount:new yo(o).toBuffer()},a);let u=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}];return 0===i.length?u.push({pubkey:r,isSigner:!0,isWritable:!1}):(u.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createCloseAccountInstruction(t,e,n,r,i){const o=so([io("instruction")]),s=xr.Buffer.alloc(o.span);o.encode({instruction:9},s);let a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?a.push({pubkey:r,isSigner:!0,isWritable:!1}):(a.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>a.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:a,programId:t,data:s})}static createFreezeAccountInstruction(t,e,n,r,i){const o=so([io("instruction")]),s=xr.Buffer.alloc(o.span);o.encode({instruction:10},s);let a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?a.push({pubkey:r,isSigner:!0,isWritable:!1}):(a.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>a.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:a,programId:t,data:s})}static createThawAccountInstruction(t,e,n,r,i){const o=so([io("instruction")]),s=xr.Buffer.alloc(o.span);o.encode({instruction:11},s);let a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?a.push({pubkey:r,isSigner:!0,isWritable:!1}):(a.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>a.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:a,programId:t,data:s})}static createTransferCheckedInstruction(t,e,n,r,i,o,s,a){const u=so([io("instruction"),co("amount"),io("decimals")]),c=xr.Buffer.alloc(u.span);u.encode({instruction:12,amount:new yo(s).toBuffer(),decimals:a},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!0}];return 0===o.length?d.push({pubkey:i,isSigner:!0,isWritable:!1}):(d.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:d,programId:t,data:c})}static createApproveCheckedInstruction(t,e,n,r,i,o,s,a){const u=so([io("instruction"),co("amount"),io("decimals")]),c=xr.Buffer.alloc(u.span);u.encode({instruction:13,amount:new yo(s).toBuffer(),decimals:a},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1}];return 0===o.length?d.push({pubkey:i,isSigner:!0,isWritable:!1}):(d.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:d,programId:t,data:c})}static createMintToCheckedInstruction(t,e,n,r,i,o,s){const a=so([io("instruction"),co("amount"),io("decimals")]),u=xr.Buffer.alloc(a.span);a.encode({instruction:14,amount:new yo(o).toBuffer(),decimals:s},u);let c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:c,programId:t,data:u})}static createBurnCheckedInstruction(t,e,n,r,i,o,s){const a=so([io("instruction"),co("amount"),io("decimals")]),u=xr.Buffer.alloc(a.span);a.encode({instruction:15,amount:new yo(o).toBuffer(),decimals:s},u);let c=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:c,programId:t,data:u})}static createSyncNativeInstruction(t,e){const n=so([io("instruction")]),r=xr.Buffer.alloc(n.span);return n.encode({instruction:17},r),new an({keys:[{pubkey:e,isSigner:!1,isWritable:!0}],programId:t,data:r})}static async getAssociatedTokenAddress(t,e,n,r,i=!1){if(!i&&!Ke.isOnCurve(r.toBuffer()))throw new Error(`Owner cannot sign: ${r.toString()}`);return(await Ke.findProgramAddress([r.toBuffer(),e.toBuffer(),n.toBuffer()],t))[0]}static createAssociatedTokenAccountInstruction(t,e,n,r,i,o){const s=xr.Buffer.alloc(0);let a=[{pubkey:o,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:_n.programId,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1}];return new an({keys:a,programId:t,data:s})}}},48990:(t,e,n)=>{"use strict";n(48764).Buffer;var r=n(64836),i=(r(n(64687)),r(n(17156)),r(n(18698)),r(n(56690)),r(n(89728)),r(n(61655)),r(n(94993)),r(n(73808)),n(26729));n(78340);i.EventEmitter},46299:(t,e,n)=>{"use strict";var r=n(64836),i=r(n(56690)),o=r(n(89728)),s=r(n(61655)),a=r(n(94993)),u=r(n(73808));n(26729).EventEmitter},78340:(t,e,n)=>{"use strict";var r=n(64836);Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDataPack=void 0,e.createError=function(t,e){var n={code:t,message:s.get(t)||"Internal Server Error"};return e&&(n.data=e),n};var i=r(n(56690)),o=r(n(89728)),s=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),a=function(){function t(){(0,i.default)(this,t)}return(0,o.default)(t,[{key:"encode",value:function(t){return JSON.stringify(t)}},{key:"decode",value:function(t){return JSON.parse(t)}}]),t}();e.DefaultDataPack=a},73591:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolContext=void 0;const i=n(78845),o=r(n(92220)),s=n(57752),a=n(51986),u={createWrappedSolAccountMethod:"keypair",allowPDAOwnerAddress:!1};class c{static from(t,e,n,r=(0,s.buildDefaultAccountFetcher)(t),a,u={}){const d=new i.AnchorProvider(t,e,{commitment:u.userDefaultConfirmCommitment||"confirmed",preflightCommitment:u.userDefaultConfirmCommitment||"confirmed"}),l=new i.Program(o.default,n,d);return new c(d,d.wallet,l,r,a,u)}static fromWorkspace(t,e,n=(0,s.buildDefaultAccountFetcher)(t.connection),r,i={}){return new c(t,t.wallet,e,n,r,i)}static withProvider(t,e,n=(0,s.buildDefaultAccountFetcher)(t.connection),r,a={}){const u=new i.Program(o.default,e,t);return new c(t,t.wallet,u,n,r,a)}constructor(t,e,n,r,i,o={}){this.connection=t.connection,this.wallet=e,this.program=n,this.provider=t,this.fetcher=r,this.lookupTableFetcher=i,this.opts=o,this.txBuilderOpts=(0,a.contextOptionsToBuilderOptions)(this.opts),this.accountResolverOpts=o.accountResolverOptions??u}}e.WhirlpoolContext=c},37392:(t,e)=>{"use strict";var n,r,i,o;Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolsError=e.RouteQueryErrorCode=e.SwapErrorCode=e.TokenErrorCode=e.MathErrorCode=void 0,function(t){t.MultiplicationOverflow="MultiplicationOverflow",t.MulDivOverflow="MulDivOverflow",t.MultiplicationShiftRightOverflow="MultiplicationShiftRightOverflow",t.DivideByZero="DivideByZero"}(n||(e.MathErrorCode=n={})),function(t){t.TokenMaxExceeded="TokenMaxExceeded",t.TokenMinSubceeded="TokenMinSubceeded"}(r||(e.TokenErrorCode=r={})),function(t){t.InvalidDevFeePercentage="InvalidDevFeePercentage",t.InvalidSqrtPriceLimitDirection="InvalidSqrtPriceLimitDirection",t.SqrtPriceOutOfBounds="SqrtPriceOutOfBounds",t.ZeroTradableAmount="ZeroTradableAmount",t.AmountOutBelowMinimum="AmountOutBelowMinimum",t.AmountInAboveMaximum="AmountInAboveMaximum",t.TickArrayCrossingAboveMax="TickArrayCrossingAboveMax",t.TickArrayIndexNotInitialized="TickArrayIndexNotInitialized",t.TickArraySequenceInvalid="TickArraySequenceInvalid"}(i||(e.SwapErrorCode=i={})),function(t){t.RouteDoesNotExist="RouteDoesNotExist",t.TradeAmountTooHigh="TradeAmountTooHigh",t.ZeroInputAmount="ZeroInputAmount",t.General="General"}(o||(e.RouteQueryErrorCode=o={}));class s extends Error{constructor(t,e,n){super(t),this.message=t,this.errorCode=e,this.stack=n}static isWhirlpoolsErrorCode(t,e){return t instanceof s&&t.errorCode===e}}e.WhirlpoolsError=s},7496:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.PositionImpl=void 0;const i=n(66259),o=n(29955),s=n(18245),a=r(n(26018)),u=n(62902),c=n(41786),d=n(48231),l=n(74808),h=n(25367),f=n(93018),p=n(51986);e.PositionImpl=class{constructor(t,e,n,r,i,o){this.ctx=t,this.address=e,this.data=n,this.whirlpoolData=r,this.lowerTickArrayData=i,this.upperTickArrayData=o}getAddress(){return this.address}getData(){return this.data}getWhirlpoolData(){return this.whirlpoolData}getLowerTickData(){return l.TickArrayUtil.getTickFromArray(this.lowerTickArrayData,this.data.tickLowerIndex,this.whirlpoolData.tickSpacing)}getUpperTickData(){return l.TickArrayUtil.getTickFromArray(this.upperTickArrayData,this.data.tickUpperIndex,this.whirlpoolData.tickSpacing)}async refreshData(){return await this.refresh(),this.data}async increaseLiquidity(t,e=!0,n,r,s){const a=n?i.AddressUtil.toPubKey(n):this.ctx.wallet.publicKey,d=r?i.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,h=s?i.AddressUtil.toPubKey(s):this.ctx.wallet.publicKey,p=await this.ctx.fetcher.getPool(this.data.whirlpool,c.IGNORE_CACHE);if(!p)throw new Error("Unable to fetch whirlpool for this position.");const m=await f.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,p,c.IGNORE_CACHE),g=new i.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);let y,b;if(e){const[e,n]=await(0,i.resolveOrCreateATAs)(this.ctx.connection,a,[{tokenMint:p.tokenMintA,wrappedSolAmountIn:t.tokenMaxA},{tokenMint:p.tokenMintB,wrappedSolAmountIn:t.tokenMaxB}],(()=>this.ctx.fetcher.getAccountRentExempt()),h,void 0,this.ctx.accountResolverOpts.allowPDAOwnerAddress,this.ctx.accountResolverOpts.createWrappedSolAccountMethod),{address:r,...o}=e,{address:s,...u}=n;y=r,b=s,g.addInstruction(o),g.addInstruction(u)}else y=(0,o.getAssociatedTokenAddressSync)(p.tokenMintA,a,this.ctx.accountResolverOpts.allowPDAOwnerAddress,m.tokenMintWithProgramA.tokenProgram),b=(0,o.getAssociatedTokenAddressSync)(p.tokenMintB,a,this.ctx.accountResolverOpts.allowPDAOwnerAddress,m.tokenMintWithProgramB.tokenProgram);const w=(0,o.getAssociatedTokenAddressSync)(this.data.positionMint,d,this.ctx.accountResolverOpts.allowPDAOwnerAddress),_={...t,whirlpool:this.data.whirlpool,position:this.address,positionTokenAccount:w,tokenOwnerAccountA:y,tokenOwnerAccountB:b,tokenVaultA:p.tokenVaultA,tokenVaultB:p.tokenVaultB,tickArrayLower:l.PDAUtil.getTickArray(this.ctx.program.programId,this.data.whirlpool,l.TickUtil.getStartTickIndex(this.data.tickLowerIndex,p.tickSpacing)).publicKey,tickArrayUpper:l.PDAUtil.getTickArray(this.ctx.program.programId,this.data.whirlpool,l.TickUtil.getStartTickIndex(this.data.tickUpperIndex,p.tickSpacing)).publicKey,positionAuthority:d},v=f.TokenExtensionUtil.isV2IxRequiredPool(m)?(0,u.increaseLiquidityV2Ix)(this.ctx.program,{..._,tokenMintA:p.tokenMintA,tokenMintB:p.tokenMintB,tokenProgramA:m.tokenMintWithProgramA.tokenProgram,tokenProgramB:m.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,m.tokenMintWithProgramA,_.tokenOwnerAccountA,_.tokenVaultA,_.positionAuthority),tokenTransferHookAccountsB:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,m.tokenMintWithProgramB,_.tokenOwnerAccountB,_.tokenVaultB,_.positionAuthority)}):(0,u.increaseLiquidityIx)(this.ctx.program,_);return g.addInstruction(v),g}async decreaseLiquidity(t,e=!0,n,r,s){const a=n?i.AddressUtil.toPubKey(n):this.ctx.wallet.publicKey,d=r?i.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,h=s?i.AddressUtil.toPubKey(s):this.ctx.wallet.publicKey,p=await this.ctx.fetcher.getPool(this.data.whirlpool,c.IGNORE_CACHE);if(!p)throw new Error("Unable to fetch whirlpool for this position.");const m=await f.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,p,c.IGNORE_CACHE),g=new i.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);let y,b;if(e){const[t,e]=await(0,i.resolveOrCreateATAs)(this.ctx.connection,a,[{tokenMint:p.tokenMintA},{tokenMint:p.tokenMintB}],(()=>this.ctx.fetcher.getAccountRentExempt()),h,void 0,this.ctx.accountResolverOpts.allowPDAOwnerAddress,this.ctx.accountResolverOpts.createWrappedSolAccountMethod),{address:n,...r}=t,{address:o,...s}=e;y=n,b=o,g.addInstruction(r),g.addInstruction(s)}else y=(0,o.getAssociatedTokenAddressSync)(p.tokenMintA,a,this.ctx.accountResolverOpts.allowPDAOwnerAddress,m.tokenMintWithProgramA.tokenProgram),b=(0,o.getAssociatedTokenAddressSync)(p.tokenMintB,a,this.ctx.accountResolverOpts.allowPDAOwnerAddress,m.tokenMintWithProgramB.tokenProgram);const w={...t,whirlpool:this.data.whirlpool,position:this.address,positionTokenAccount:(0,o.getAssociatedTokenAddressSync)(this.data.positionMint,d,this.ctx.accountResolverOpts.allowPDAOwnerAddress),tokenOwnerAccountA:y,tokenOwnerAccountB:b,tokenVaultA:p.tokenVaultA,tokenVaultB:p.tokenVaultB,tickArrayLower:l.PDAUtil.getTickArray(this.ctx.program.programId,this.data.whirlpool,l.TickUtil.getStartTickIndex(this.data.tickLowerIndex,p.tickSpacing)).publicKey,tickArrayUpper:l.PDAUtil.getTickArray(this.ctx.program.programId,this.data.whirlpool,l.TickUtil.getStartTickIndex(this.data.tickUpperIndex,p.tickSpacing)).publicKey,positionAuthority:d},_=f.TokenExtensionUtil.isV2IxRequiredPool(m)?(0,u.decreaseLiquidityV2Ix)(this.ctx.program,{...w,tokenMintA:p.tokenMintA,tokenMintB:p.tokenMintB,tokenProgramA:m.tokenMintWithProgramA.tokenProgram,tokenProgramB:m.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,m.tokenMintWithProgramA,w.tokenVaultA,w.tokenOwnerAccountA,w.whirlpool),tokenTransferHookAccountsB:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,m.tokenMintWithProgramB,w.tokenVaultB,w.tokenOwnerAccountB,w.whirlpool)}):(0,u.decreaseLiquidityIx)(this.ctx.program,w);return g.addInstruction(_),g}async collectFees(t=!0,e,n,r,s,d=c.PREFER_CACHE){const[l,p,m]=i.AddressUtil.toPubKeys([n??this.ctx.wallet.publicKey,r??this.ctx.wallet.publicKey,s??this.ctx.wallet.publicKey]),g=await this.ctx.fetcher.getPool(this.data.whirlpool,d);if(!g)throw new Error(`Unable to fetch whirlpool (${this.data.whirlpool}) for this position (${this.address}).`);const y=await f.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,g,c.IGNORE_CACHE);let b=new i.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);const w=await this.ctx.fetcher.getAccountRentExempt();let _={...e};if(!e){const t=(0,h.getTokenMintsFromWhirlpools)([g],h.TokenMintTypes.POOL_ONLY),{ataTokenAddresses:e,resolveAtaIxs:n}=await(0,h.resolveAtaForMints)(this.ctx,{mints:t.mintMap,accountExemption:w,receiver:l,payer:m});if(b.addInstructions(n),t.hasNativeMint){let{address:t,...n}=i.TokenUtil.createWrappedNativeAccountInstruction(l,i.ZERO,w,m,l,this.ctx.accountResolverOpts.createWrappedSolAccountMethod);e[o.NATIVE_MINT.toBase58()]=t,b.addInstruction(n)}_={...e}}const v=_[g.tokenMintA.toBase58()];(0,a.default)(!!v,`No owner token account provided for wallet ${l.toBase58()} for token A ${g.tokenMintA.toBase58()} `);const k=_[g.tokenMintB.toBase58()];(0,a.default)(!!k,`No owner token account provided for wallet ${l.toBase58()} for token B ${g.tokenMintB.toBase58()} `);const M=(0,o.getAssociatedTokenAddressSync)(this.data.positionMint,p,this.ctx.accountResolverOpts.allowPDAOwnerAddress);if(t&&!this.data.liquidity.isZero()){const t=await this.updateFeesAndRewards();b.addInstruction(t)}const A={whirlpool:this.data.whirlpool,position:this.address,positionTokenAccount:M,tokenOwnerAccountA:i.AddressUtil.toPubKey(v),tokenOwnerAccountB:i.AddressUtil.toPubKey(k),tokenVaultA:g.tokenVaultA,tokenVaultB:g.tokenVaultB,positionAuthority:p},S=f.TokenExtensionUtil.isV2IxRequiredPool(y)?(0,u.collectFeesV2Ix)(this.ctx.program,{...A,tokenMintA:g.tokenMintA,tokenMintB:g.tokenMintB,tokenProgramA:y.tokenMintWithProgramA.tokenProgram,tokenProgramB:y.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,y.tokenMintWithProgramA,A.tokenVaultA,A.tokenOwnerAccountA,A.whirlpool),tokenTransferHookAccountsB:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,y.tokenMintWithProgramB,A.tokenVaultB,A.tokenOwnerAccountB,A.whirlpool)}):(0,u.collectFeesIx)(this.ctx.program,A);return b.addInstruction(S),b}async collectRewards(t,e=!0,n,r,d,m,g=c.IGNORE_CACHE){const[y,b,w]=i.AddressUtil.toPubKeys([r??this.ctx.wallet.publicKey,d??this.ctx.wallet.publicKey,m??this.ctx.wallet.publicKey]),_=await this.ctx.fetcher.getPool(this.data.whirlpool,g);if(!_)throw new Error(`Unable to fetch whirlpool(${this.data.whirlpool}) for this position(${this.address}).`);const v=_.rewardInfos.filter((t=>l.PoolUtil.isRewardInitialized(t))),k=await f.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,_,c.IGNORE_CACHE);let M;if(n)M={},Object.entries(n).forEach((([t,e])=>{e&&(M[t]={address:i.AddressUtil.toPubKey(e),instructions:[],cleanupInstructions:[],signers:[],tokenProgram:s.PublicKey.default})}));else{const t=await this.ctx.fetcher.getAccountRentExempt(),e=(0,h.getTokenMintsFromWhirlpools)([_],h.TokenMintTypes.REWARD_ONLY);M=(0,p.convertListToMap)(await(0,i.resolveOrCreateATAs)(this.ctx.connection,y,e.mintMap.map((t=>({tokenMint:t}))),(async()=>t),w,!0,this.ctx.accountResolverOpts.allowPDAOwnerAddress),e.mintMap.map((t=>t.toBase58())))}const A=new p.MultipleTransactionBuilderFactoryWithAccountResolver(this.ctx,M,y,w),S=(0,o.getAssociatedTokenAddressSync)(this.data.positionMint,b,this.ctx.accountResolverOpts.allowPDAOwnerAddress);e&&!this.data.liquidity.isZero()&&await A.addInstructions((async()=>[await this.updateFeesAndRewards()]));for(let e=0;et.toString()===n.mint.toBase58())))break;await A.addInstructions((async t=>{const r=t(n.mint.toBase58());(0,a.default)(!!r,`No owner token account provided for wallet ${y.toBase58()} for reward ${e} token ${n.mint.toBase58()} `);const o={whirlpool:this.data.whirlpool,position:this.address,positionTokenAccount:S,rewardIndex:e,rewardOwnerAccount:i.AddressUtil.toPubKey(r),rewardVault:n.vault,positionAuthority:b};return[f.TokenExtensionUtil.isV2IxRequiredReward(k,e)?(0,u.collectRewardV2Ix)(this.ctx.program,{...o,rewardMint:n.mint,rewardTokenProgram:k.rewardTokenMintsWithProgram[e].tokenProgram,rewardTransferHookAccounts:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,k.rewardTokenMintsWithProgram[e],o.rewardVault,o.rewardOwnerAccount,o.whirlpool)}):(0,u.collectRewardIx)(this.ctx.program,o)]}))}return A.build()}async refresh(){const t=await this.ctx.fetcher.getPosition(this.address,c.IGNORE_CACHE);t&&(this.data=t);const e=await this.ctx.fetcher.getPool(this.data.whirlpool,c.IGNORE_CACHE);e&&(this.whirlpoolData=e);const[n,r]=await(0,d.getTickArrayDataForPosition)(this.ctx,this.data,this.whirlpoolData,c.IGNORE_CACHE);n&&(this.lowerTickArrayData=n),r&&(this.upperTickArrayData=r)}async updateFeesAndRewards(){const t=await this.ctx.fetcher.getPool(this.data.whirlpool);if(!t)throw new Error(`Unable to fetch whirlpool(${this.data.whirlpool}) for this position(${this.address}).`);const[e,n]=[this.data.tickLowerIndex,this.data.tickUpperIndex].map((e=>l.PDAUtil.getTickArrayFromTickIndex(e,t.tickSpacing,this.data.whirlpool,this.ctx.program.programId)));return(0,u.updateFeesAndRewardsIx)(this.ctx.program,{whirlpool:this.data.whirlpool,position:this.address,tickArrayLower:e.publicKey,tickArrayUpper:n.publicKey})}}},13464:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getTokenVaultAccountInfos=e.getRewardInfos=e.getTokenMintInfos=void 0;const i=r(n(13550)),o=n(40273);async function s(t,e,n){const r={...e,initialized:!1,vaultAmount:new i.default(0)};if(o.PoolUtil.isRewardInitialized(e)){const o=await t.getTokenInfo(e.vault,n);if(!o)throw new Error(`Unable to fetch TokenAccountInfo for vault - ${e.vault}`);r.initialized=!0,r.vaultAmount=new i.default(o.amount.toString())}return r}e.getTokenMintInfos=async function(t,e,n){const r=e.tokenMintA,i=await t.getMintInfo(r,n);if(!i)throw new Error(`Unable to fetch MintInfo for mint - ${r}`);const o=e.tokenMintB,s=await t.getMintInfo(o,n);if(!s)throw new Error(`Unable to fetch MintInfo for mint - ${o}`);return[{mint:r,...i},{mint:o,...s}]},e.getRewardInfos=async function(t,e,n){const r=[];for(const i of e.rewardInfos)r.push(await s(t,i,n));return r},e.getTokenVaultAccountInfos=async function(t,e,n){const r=e.tokenVaultA,i=await t.getTokenInfo(r,n);if(!i)throw new Error(`Unable to fetch TokenAccountInfo for vault - ${r}`);const o=e.tokenVaultB,s=await t.getTokenInfo(o,n);if(!s)throw new Error(`Unable to fetch TokenAccountInfo for vault - ${o}`);return[i,s]}},4263:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolClientImpl=void 0;const i=n(66259),o=n(18245),s=r(n(26018)),a=n(62902),u=n(84533),c=n(19503),d=n(41786),l=n(94138),h=n(48231),f=n(74808),p=n(7496),m=n(13464),g=n(96040),y=n(93018);e.WhirlpoolClientImpl=class{constructor(t){this.ctx=t}getContext(){return this.ctx}getFetcher(){return this.ctx.fetcher}getRouter(t){return l.WhirlpoolRouterBuilder.buildWithPools(this.ctx,t)}async getPool(t,e=d.PREFER_CACHE){const n=await this.ctx.fetcher.getPool(t,e);if(!n)throw new Error(`Unable to fetch Whirlpool at address at ${t}`);const r=await(0,m.getTokenMintInfos)(this.ctx.fetcher,n,e),o=await(0,m.getTokenVaultAccountInfos)(this.ctx.fetcher,n,e),s=await(0,m.getRewardInfos)(this.ctx.fetcher,n,e);return new g.WhirlpoolImpl(this.ctx,i.AddressUtil.toPubKey(t),r[0],r[1],o[0],o[1],s,n)}async getPools(t,e=d.PREFER_CACHE){const n=Array.from((await this.ctx.fetcher.getPools(t,e)).values()).filter((t=>!!t));if(n.length!==t.length)throw new Error(`Unable to fetch all Whirlpools at addresses ${t}`);const r=new Set,o=new Set;n.forEach((t=>{r.add(t.tokenMintA.toBase58()),r.add(t.tokenMintB.toBase58()),o.add(t.tokenVaultA.toBase58()),o.add(t.tokenVaultB.toBase58()),t.rewardInfos.forEach((t=>{f.PoolUtil.isRewardInitialized(t)&&o.add(t.vault.toBase58())}))})),await this.ctx.fetcher.getMintInfos(Array.from(r),e),await this.ctx.fetcher.getTokenInfos(Array.from(o),e);const s=[];for(let e=0;et?.whirlpool.toBase58())).flatMap((t=>t||[]));await this.ctx.fetcher.getPools(r,e);const i=new Set;await Promise.all(n.map((async t=>{if(t){const e=await this.ctx.fetcher.getPool(t.whirlpool,d.PREFER_CACHE);if(e){const n=f.PDAUtil.getTickArrayFromTickIndex(t.tickLowerIndex,e.tickSpacing,t.whirlpool,this.ctx.program.programId).publicKey,r=f.PDAUtil.getTickArrayFromTickIndex(t.tickUpperIndex,e.tickSpacing,t.whirlpool,this.ctx.program.programId).publicKey;i.add(n.toBase58()),i.add(r.toBase58())}}}))),await this.ctx.fetcher.getTickArrays(Array.from(i),d.IGNORE_CACHE);const o=await Promise.all(t.map((async t=>{try{return[t,await this.getPosition(t,d.PREFER_CACHE)]}catch{return[t,null]}})));return Object.fromEntries(o)}async createPool(t,e,n,r,u,l,h=d.PREFER_CACHE){(0,s.default)(f.TickUtil.checkTickInBounds(u),"initialTick is out of bounds."),(0,s.default)(f.TickUtil.isTickInitializable(u,r),`initial tick ${u} is not an initializable tick for tick-spacing ${r}`);const p=f.PoolUtil.orderMints(e,n).map((t=>t.toString()));(0,s.default)(p[0]===e.toString(),"Token order needs to be flipped to match the canonical ordering (i.e. sorted on the byte repr. of the mint pubkeys)");const m=await this.ctx.fetcher.getMintInfos([e,n],h),g={...y.NO_TOKEN_EXTENSION_CONTEXT,tokenMintWithProgramA:m.get(e.toString()),tokenMintWithProgramB:m.get(n.toString())};t=i.AddressUtil.toPubKey(t);const b=f.PDAUtil.getFeeTier(this.ctx.program.programId,t,r).publicKey,w=f.PriceMath.tickIndexToSqrtPriceX64(u),_=o.Keypair.generate(),v=o.Keypair.generate(),k=f.PDAUtil.getWhirlpool(this.ctx.program.programId,t,new o.PublicKey(e),new o.PublicKey(n),r),M=await this.ctx.fetcher.getFeeTier(b,h);(0,s.default)(!!M,`Fee tier for ${r} doesn't exist`);const A=new i.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts),S=f.PDAUtil.getTokenBadge(this.ctx.program.programId,t,i.AddressUtil.toPubKey(e)).publicKey,I=f.PDAUtil.getTokenBadge(this.ctx.program.programId,t,i.AddressUtil.toPubKey(n)).publicKey,x={initSqrtPrice:w,whirlpoolsConfig:t,whirlpoolPda:k,tokenMintA:new o.PublicKey(e),tokenMintB:new o.PublicKey(n),tokenVaultAKeypair:_,tokenVaultBKeypair:v,feeTierKey:b,tickSpacing:r,funder:new o.PublicKey(l)},E=y.TokenExtensionUtil.isV2IxRequiredPool(g)?c.WhirlpoolIx.initializePoolV2Ix(this.ctx.program,{...x,tokenProgramA:g.tokenMintWithProgramA.tokenProgram,tokenProgramB:g.tokenMintWithProgramB.tokenProgram,tokenBadgeA:S,tokenBadgeB:I}):c.WhirlpoolIx.initializePoolIx(this.ctx.program,x),T=f.TickUtil.getStartTickIndex(u,r),P=f.PDAUtil.getTickArray(this.ctx.program.programId,k.publicKey,T);return A.addInstruction(E),A.addInstruction((0,a.initTickArrayIx)(this.ctx.program,{startTick:T,tickArrayPda:P,whirlpool:k.publicKey,funder:i.AddressUtil.toPubKey(l)})),{poolKey:k.publicKey,tx:A}}async collectFeesAndRewardsForPositions(t,e){const n=this.ctx.wallet.publicKey;return(0,u.collectAllForPositionAddressesTxns)(this.ctx,{positions:t,receiver:n,positionAuthority:n,positionOwner:n,payer:n},e)}async collectProtocolFeesForPools(t){return(0,u.collectProtocolFees)(this.ctx,t)}}},96040:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolImpl=void 0;const i=n(78845),o=n(66259),s=n(29955),a=n(18245),u=r(n(26018)),c=n(62902),d=n(41786),l=n(27122),h=n(48231),f=n(74808),p=n(25367),m=n(7496),g=n(13464),y=n(51986),b=n(93018),w=n(19503);e.WhirlpoolImpl=class{constructor(t,e,n,r,i,o,s,a){this.ctx=t,this.address=e,this.tokenAInfo=n,this.tokenBInfo=r,this.tokenVaultAInfo=i,this.tokenVaultBInfo=o,this.rewardInfos=s,this.data=a}getAddress(){return this.address}getData(){return this.data}getTokenAInfo(){return this.tokenAInfo}getTokenBInfo(){return this.tokenBInfo}getTokenVaultAInfo(){return this.tokenVaultAInfo}getTokenVaultBInfo(){return this.tokenVaultBInfo}getRewardInfos(){return this.rewardInfos}async refreshData(){return await this.refresh(),this.data}async openPosition(t,e,n,r,i,s){return await this.refresh(),this.getOpenPositionWithOptMetadataTx(t,e,n,r?o.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,i?o.AddressUtil.toPubKey(i):this.ctx.wallet.publicKey,!1,s)}async openPositionWithMetadata(t,e,n,r,i,s){return await this.refresh(),this.getOpenPositionWithOptMetadataTx(t,e,n,r?o.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,i?o.AddressUtil.toPubKey(i):this.ctx.wallet.publicKey,!0,s)}async initTickArrayForTicks(t,e,n=d.IGNORE_CACHE){const r=await f.TickArrayUtil.getUninitializedArraysPDAs(t,this.ctx.program.programId,this.address,this.data.tickSpacing,this.ctx.fetcher,n);if(!r.length)return null;const i=new o.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);return r.forEach((t=>{i.addInstruction((0,c.initTickArrayIx)(this.ctx.program,{startTick:t.startIndex,tickArrayPda:t.pda,whirlpool:this.address,funder:e?o.AddressUtil.toPubKey(e):this.ctx.provider.wallet.publicKey}))})),i}async closePosition(t,e,n,r,i){await this.refresh();const s=r?o.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,a=n?o.AddressUtil.toPubKey(n):this.ctx.wallet.publicKey,u=i?o.AddressUtil.toPubKey(i):this.ctx.wallet.publicKey;return this.getClosePositionIx(o.AddressUtil.toPubKey(t),e,a,s,u)}async swap(t,e){const n=e?o.AddressUtil.toPubKey(e):this.ctx.wallet.publicKey;return(0,c.swapAsync)(this.ctx,{swapInput:t,whirlpool:this,wallet:n},d.IGNORE_CACHE)}async swapWithDevFees(t,e,n,r){const i=n?o.AddressUtil.toPubKey(n):this.ctx.wallet.publicKey,s=r?o.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,a=new o.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);if(!t.devFeeAmount.eq(o.ZERO)){const n=t.aToB===t.amountSpecifiedIsInput?this.getTokenAInfo():this.getTokenBInfo();a.addInstruction(await o.TokenUtil.createSendTokensToWalletInstruction(this.ctx.connection,i,e,n.mint,n.decimals,t.devFeeAmount,(()=>this.ctx.fetcher.getAccountRentExempt()),s,this.ctx.accountResolverOpts.allowPDAOwnerAddress))}const u=await(0,c.swapAsync)(this.ctx,{swapInput:t,whirlpool:this,wallet:i},d.IGNORE_CACHE);return a.addInstruction(u.compressIx(!0)),a}async getOpenPositionWithOptMetadataTx(t,e,n,r,l,h=!1,p){(0,u.default)(f.TickUtil.checkTickInBounds(t),"tickLower is out of bounds."),(0,u.default)(f.TickUtil.checkTickInBounds(e),"tickUpper is out of bounds.");const{liquidityAmount:m,tokenMaxA:g,tokenMaxB:y}=n;(0,u.default)(m.gt(new i.BN(0)),"liquidity must be greater than zero");const w=await this.ctx.fetcher.getPool(this.address,d.PREFER_CACHE);if(!w)throw new Error(`Whirlpool not found: ${(0,i.translateAddress)(this.address).toBase58()}`);const _=await b.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,w,d.IGNORE_CACHE);(0,u.default)(f.TickUtil.isTickInitializable(t,w.tickSpacing),`lower tick ${t} is not an initializable tick for tick-spacing ${w.tickSpacing}`),(0,u.default)(f.TickUtil.isTickInitializable(e,w.tickSpacing),`upper tick ${e} is not an initializable tick for tick-spacing ${w.tickSpacing}`);const v=a.Keypair.generate(),k=p??v.publicKey,M=f.PDAUtil.getPosition(this.ctx.program.programId,k),A=f.PDAUtil.getPositionMetadata(k),S=(0,s.getAssociatedTokenAddressSync)(k,r,this.ctx.accountResolverOpts.allowPDAOwnerAddress),I=new o.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts),x=(h?c.openPositionWithMetadataIx:c.openPositionIx)(this.ctx.program,{funder:l,owner:r,positionPda:M,metadataPda:A,positionMintAddress:k,positionTokenAccount:S,whirlpool:this.address,tickLowerIndex:t,tickUpperIndex:e});I.addInstruction(x),void 0===p&&I.addSigner(v);const[E,T]=await(0,o.resolveOrCreateATAs)(this.ctx.connection,r,[{tokenMint:w.tokenMintA,wrappedSolAmountIn:g},{tokenMint:w.tokenMintB,wrappedSolAmountIn:y}],(()=>this.ctx.fetcher.getAccountRentExempt()),l,void 0,this.ctx.accountResolverOpts.allowPDAOwnerAddress,this.ctx.accountResolverOpts.createWrappedSolAccountMethod),{address:P,...B}=E,{address:L,...$}=T;I.addInstruction(B),I.addInstruction($);const R=f.PDAUtil.getTickArrayFromTickIndex(t,this.data.tickSpacing,this.address,this.ctx.program.programId),O=f.PDAUtil.getTickArrayFromTickIndex(e,this.data.tickSpacing,this.address,this.ctx.program.programId),D={liquidityAmount:m,tokenMaxA:g,tokenMaxB:y,whirlpool:this.address,positionAuthority:r,position:M.publicKey,positionTokenAccount:S,tokenOwnerAccountA:P,tokenOwnerAccountB:L,tokenVaultA:w.tokenVaultA,tokenVaultB:w.tokenVaultB,tickArrayLower:R.publicKey,tickArrayUpper:O.publicKey},C=b.TokenExtensionUtil.isV2IxRequiredPool(_)?(0,c.increaseLiquidityV2Ix)(this.ctx.program,{...D,tokenMintA:w.tokenMintA,tokenMintB:w.tokenMintB,tokenProgramA:_.tokenMintWithProgramA.tokenProgram,tokenProgramB:_.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,_.tokenMintWithProgramA,D.tokenOwnerAccountA,D.tokenVaultA,D.positionAuthority),tokenTransferHookAccountsB:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,_.tokenMintWithProgramB,D.tokenOwnerAccountB,D.tokenVaultB,D.positionAuthority)}):(0,c.increaseLiquidityIx)(this.ctx.program,D);return I.addInstruction(C),{positionMint:k,tx:I}}async getClosePositionIx(t,e,n,r,i){const a=await this.ctx.fetcher.getPosition(t,d.IGNORE_CACHE);if(!a)throw new Error(`Position not found: ${t.toBase58()}`);const g=this.data;(0,u.default)(a.whirlpool.equals(this.address),`Position ${t.toBase58()} is not a position for Whirlpool ${this.address.toBase58()}`);const _=(0,s.getAssociatedTokenAddressSync)(a.positionMint,r,this.ctx.accountResolverOpts.allowPDAOwnerAddress),v=await this.ctx.fetcher.getAccountRentExempt(),k=(new o.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts),f.PDAUtil.getTickArrayFromTickIndex(a.tickLowerIndex,g.tickSpacing,a.whirlpool,this.ctx.program.programId).publicKey),M=f.PDAUtil.getTickArrayFromTickIndex(a.tickUpperIndex,g.tickSpacing,a.whirlpool,this.ctx.program.programId).publicKey,[A,S]=await(0,h.getTickArrayDataForPosition)(this.ctx,a,g,d.IGNORE_CACHE);(0,u.default)(!!A,`Tick array ${k} expected to be initialized for whirlpool ${this.address}`),(0,u.default)(!!S,`Tick array ${M} expected to be initialized for whirlpool ${this.address}`);const I=await b.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,g,d.IGNORE_CACHE),x=new m.PositionImpl(this.ctx,t,a,g,A,S),E=x.getLowerTickData(),T=x.getUpperTickData(),P=(0,l.collectFeesQuote)({position:a,whirlpool:g,tickLower:E,tickUpper:T,tokenExtensionCtx:I}),B=(0,l.collectRewardsQuote)({position:a,whirlpool:g,tickLower:E,tickUpper:T,tokenExtensionCtx:I}),L=P.feeOwedA.gtn(0)||P.feeOwedB.gtn(0);(0,u.default)(this.data.rewardInfos.length===B.rewardOwed.length,"Rewards quote does not match reward infos length");const $=a.liquidity.gtn(0),R=this.data.rewardInfos.filter(((t,e)=>(B.rewardOwed[e]??o.ZERO).gtn(0)||(B.transferFee.deductedFromRewardOwed[e]??o.ZERO).gtn(0))).map((t=>t.mint)),O=R.length>0;let D=p.TokenMintTypes.ALL;!$&&!L||O?$||L||!O||(D=p.TokenMintTypes.REWARD_ONLY):D=p.TokenMintTypes.POOL_ONLY;const C=(0,p.getTokenMintsFromWhirlpools)([g],D),N=(0,y.convertListToMap)(await(0,o.resolveOrCreateATAs)(this.ctx.connection,n,C.mintMap.map((t=>({tokenMint:t}))),(async()=>v),i,!0,this.ctx.accountResolverOpts.allowPDAOwnerAddress,this.ctx.accountResolverOpts.createWrappedSolAccountMethod),C.mintMap.map((t=>t.toBase58()))),z=new y.MultipleTransactionBuilderFactoryWithAccountResolver(this.ctx,N,n,i);if($&&await z.addInstructions((async n=>{const i=n(g.tokenMintA.toBase58()),o=n(g.tokenMintB.toBase58()),s={...(0,l.decreaseLiquidityQuoteByLiquidityWithParams)({liquidity:a.liquidity,slippageTolerance:e,sqrtPrice:g.sqrtPrice,tickCurrentIndex:g.tickCurrentIndex,tickLowerIndex:a.tickLowerIndex,tickUpperIndex:a.tickUpperIndex,tokenExtensionCtx:I}),whirlpool:a.whirlpool,positionAuthority:r,position:t,positionTokenAccount:_,tokenOwnerAccountA:i,tokenOwnerAccountB:o,tokenVaultA:g.tokenVaultA,tokenVaultB:g.tokenVaultB,tickArrayLower:k,tickArrayUpper:M};return[b.TokenExtensionUtil.isV2IxRequiredPool(I)?w.WhirlpoolIx.decreaseLiquidityV2Ix(this.ctx.program,{...s,tokenMintA:g.tokenMintA,tokenMintB:g.tokenMintB,tokenProgramA:I.tokenMintWithProgramA.tokenProgram,tokenProgramB:I.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.tokenMintWithProgramA,s.tokenVaultA,s.tokenOwnerAccountA,s.whirlpool),tokenTransferHookAccountsB:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.tokenMintWithProgramB,s.tokenVaultB,s.tokenOwnerAccountB,s.whirlpool)}):w.WhirlpoolIx.decreaseLiquidityIx(this.ctx.program,s)]})),L&&await z.addInstructions((async e=>{const n=e(g.tokenMintA.toBase58()),i=e(g.tokenMintB.toBase58()),o={whirlpool:a.whirlpool,position:t,positionAuthority:r,positionTokenAccount:_,tokenOwnerAccountA:n,tokenOwnerAccountB:i,tokenVaultA:g.tokenVaultA,tokenVaultB:g.tokenVaultB};return[b.TokenExtensionUtil.isV2IxRequiredPool(I)?w.WhirlpoolIx.collectFeesV2Ix(this.ctx.program,{...o,tokenMintA:I.tokenMintWithProgramA.address,tokenMintB:I.tokenMintWithProgramB.address,tokenProgramA:I.tokenMintWithProgramA.tokenProgram,tokenProgramB:I.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.tokenMintWithProgramA,o.tokenVaultA,o.tokenOwnerAccountA,o.whirlpool),tokenTransferHookAccountsB:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.tokenMintWithProgramB,o.tokenVaultB,o.tokenOwnerAccountB,o.whirlpool)}):w.WhirlpoolIx.collectFeesIx(this.ctx.program,o)]})),O)for(let e=0;e{const i=n(R[e].toBase58()),o={whirlpool:a.whirlpool,position:t,positionAuthority:r,positionTokenAccount:_,rewardIndex:e,rewardOwnerAccount:i,rewardVault:g.rewardInfos[e].vault};return[b.TokenExtensionUtil.isV2IxRequiredReward(I,e)?w.WhirlpoolIx.collectRewardV2Ix(this.ctx.program,{...o,rewardMint:I.rewardTokenMintsWithProgram[e].address,rewardTokenProgram:I.rewardTokenMintsWithProgram[e].tokenProgram,rewardTransferHookAccounts:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.rewardTokenMintsWithProgram[e],o.rewardVault,o.rewardOwnerAccount,o.whirlpool)}):w.WhirlpoolIx.collectRewardIx(this.ctx.program,o)]}));return await z.addInstructions((async()=>[(0,c.closePositionIx)(this.ctx.program,{positionAuthority:r,receiver:n,positionTokenAccount:_,position:t,positionMint:a.positionMint})])),z.build()}async refresh(){const t=await this.ctx.fetcher.getPool(this.address,d.IGNORE_CACHE);if(t){const e=await(0,g.getRewardInfos)(this.ctx.fetcher,t,d.IGNORE_CACHE),[n,r]=await(0,g.getTokenVaultAccountInfos)(this.ctx.fetcher,t,d.IGNORE_CACHE);this.data=t,this.tokenVaultAInfo=n,this.tokenVaultBInfo=r,this.rewardInfos=e}}}},40273:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(n(93776));i(n(73591),e),i(n(7496),e),i(n(19503),e),i(n(57752),e),i(n(54274),e),i(n(27122),e),i(n(94138),e),i(n(37917),e),i(n(26168),e),i(n(74808),e),i(n(63273),e),s.default.set({precision:40,toExpPos:40,toExpNeg:-20,rounding:1})},65664:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.closeBundledPositionIx=void 0,e.closeBundledPositionIx=function(t,e){const{bundledPosition:n,positionBundle:r,positionBundleTokenAccount:i,positionBundleAuthority:o,bundleIndex:s,receiver:a}=e;return{instructions:[t.instruction.closeBundledPosition(s,{accounts:{bundledPosition:n,positionBundle:r,positionBundleTokenAccount:i,positionBundleAuthority:o,receiver:a}})],cleanupInstructions:[],signers:[]}}},67236:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.closePositionIx=void 0;const r=n(29955);e.closePositionIx=function(t,e){const{positionAuthority:n,receiver:i,position:o,positionMint:s,positionTokenAccount:a}=e;return{instructions:[t.instruction.closePosition({accounts:{positionAuthority:n,receiver:i,position:o,positionMint:s,positionTokenAccount:a,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},42851:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectFeesIx=void 0;const r=n(29955);e.collectFeesIx=function(t,e){const{whirlpool:n,positionAuthority:i,position:o,positionTokenAccount:s,tokenOwnerAccountA:a,tokenOwnerAccountB:u,tokenVaultA:c,tokenVaultB:d}=e;return{instructions:[t.instruction.collectFees({accounts:{whirlpool:n,positionAuthority:i,position:o,positionTokenAccount:s,tokenOwnerAccountA:a,tokenOwnerAccountB:u,tokenVaultA:c,tokenVaultB:d,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},76300:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectProtocolFeesIx=void 0;const r=n(29955);e.collectProtocolFeesIx=function(t,e){const{whirlpoolsConfig:n,whirlpool:i,collectProtocolFeesAuthority:o,tokenVaultA:s,tokenVaultB:a,tokenOwnerAccountA:u,tokenOwnerAccountB:c}=e;return{instructions:[t.instruction.collectProtocolFees({accounts:{whirlpoolsConfig:n,whirlpool:i,collectProtocolFeesAuthority:o,tokenVaultA:s,tokenVaultB:a,tokenDestinationA:u,tokenDestinationB:c,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},63621:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectRewardIx=void 0;const r=n(29955);e.collectRewardIx=function(t,e){const{whirlpool:n,positionAuthority:i,position:o,positionTokenAccount:s,rewardOwnerAccount:a,rewardVault:u,rewardIndex:c}=e;return{instructions:[t.instruction.collectReward(c,{accounts:{whirlpool:n,positionAuthority:i,position:o,positionTokenAccount:s,rewardOwnerAccount:a,rewardVault:u,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},37970:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectAllForPositionsTxns=e.collectAllForPositionAddressesTxns=void 0;const r=n(66259),i=n(29955),o=n(18245),s=n(19503),a=n(41786),u=n(74808),c=n(51986),d=n(25367),l=n(85204),h=n(93018);async function f(t,e){const{positions:n,receiver:o,positionAuthority:s,positionOwner:l,payer:h}=e,f=o??t.wallet.publicKey,m=s??t.wallet.publicKey,g=l??t.wallet.publicKey,y=h??t.wallet.publicKey,b=Object.entries(n);if(0===b.length)return[];const w=b.map((([,t])=>t.whirlpool.toBase58())),_=await t.fetcher.getPools(w,a.PREFER_CACHE),v=(0,d.getTokenMintsFromWhirlpools)(Array.from(_.values())),k=await t.fetcher.getAccountRentExempt();await t.fetcher.getMintInfos(v.mintMap);const M=(0,c.convertListToMap)(await(0,r.resolveOrCreateATAs)(t.connection,f,v.mintMap.map((t=>({tokenMint:t}))),(async()=>k),y,!0,t.accountResolverOpts.allowPDAOwnerAddress,t.accountResolverOpts.createWrappedSolAccountMethod),v.mintMap.map((t=>t.toBase58()))),A=await t.connection.getLatestBlockhash(),S=[],I=[];b.forEach((([t,e])=>{const n=_.get(e.whirlpool.toBase58());if(!n)throw new Error(`Unable to process positionMint ${e.positionMint.toBase58()} - unable to derive whirlpool ${e.whirlpool.toBase58()}`);I.push({collectionType:"fee",positionAddr:t,position:e,whirlpool:n}),n.rewardInfos.forEach(((r,i)=>{u.PoolUtil.isRewardInitialized(r)&&I.push({collectionType:"reward",rewardIndex:i,positionAddr:t,position:e,whirlpool:n})}))}));let x=0,E=null,T=null,P=null,B=!1;for(;x{t&&(s[e]=t)})),f(t,{positions:s,...i})},e.collectAllForPositionsTxns=f;const p=async(t,e,n,c,d,f,p)=>{const m=[],{whirlpool:g,liquidity:y,tickLowerIndex:b,tickUpperIndex:w,positionMint:_,rewardInfos:v}=e.position,k=e.whirlpool,{tickSpacing:M}=k,A=k.tokenMintA.toBase58(),S=k.tokenMintB.toBase58(),I=await h.TokenExtensionUtil.buildTokenExtensionContext(t.fetcher,k,a.PREFER_CACHE),x=(0,i.getAssociatedTokenAddressSync)(_,c,t.accountResolverOpts.allowPDAOwnerAddress);if(y.eq(r.ZERO)||n||m.push((0,l.updateFeesAndRewardsIx)(t.program,{position:new o.PublicKey(e.positionAddr),whirlpool:g,tickArrayLower:u.PDAUtil.getTickArray(t.program.programId,g,u.TickUtil.getStartTickIndex(b,M)).publicKey,tickArrayUpper:u.PDAUtil.getTickArray(t.program.programId,g,u.TickUtil.getStartTickIndex(w,M)).publicKey})),"fee"===e.collectionType){p.has(A)||(m.push(f[A]),p.add(A)),p.has(S)||(m.push(f[S]),p.add(S));const n={whirlpool:g,position:new o.PublicKey(e.positionAddr),positionAuthority:d,positionTokenAccount:x,tokenOwnerAccountA:f[A].address,tokenOwnerAccountB:f[S].address,tokenVaultA:k.tokenVaultA,tokenVaultB:k.tokenVaultB};m.push(h.TokenExtensionUtil.isV2IxRequiredPool(I)?s.WhirlpoolIx.collectFeesV2Ix(t.program,{...n,tokenMintA:I.tokenMintWithProgramA.address,tokenMintB:I.tokenMintWithProgramB.address,tokenProgramA:I.tokenMintWithProgramA.tokenProgram,tokenProgramB:I.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await h.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,I.tokenMintWithProgramA,n.tokenVaultA,n.tokenOwnerAccountA,n.whirlpool),tokenTransferHookAccountsB:await h.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,I.tokenMintWithProgramB,n.tokenVaultB,n.tokenOwnerAccountB,n.whirlpool)}):s.WhirlpoolIx.collectFeesIx(t.program,n))}else{const n=e.rewardIndex,r=k.rewardInfos[n],i=r.mint.toBase58();p.has(i)||(m.push(f[i]),p.add(i));const a={whirlpool:g,position:new o.PublicKey(e.positionAddr),positionAuthority:d,positionTokenAccount:x,rewardIndex:n,rewardOwnerAccount:f[i].address,rewardVault:r.vault};m.push(h.TokenExtensionUtil.isV2IxRequiredReward(I,n)?s.WhirlpoolIx.collectRewardV2Ix(t.program,{...a,rewardMint:I.rewardTokenMintsWithProgram[n].address,rewardTokenProgram:I.rewardTokenMintsWithProgram[n].tokenProgram,rewardTransferHookAccounts:await h.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,I.rewardTokenMintsWithProgram[n],a.rewardVault,a.rewardOwnerAccount,a.whirlpool)}):s.WhirlpoolIx.collectRewardIx(t.program,a))}return m}},73984:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectProtocolFees=void 0;const r=n(66259),i=n(29955),o=n(18245),s=n(41786),a=n(25367),u=n(76300),c=n(93018),d=n(90115);e.collectProtocolFees=async function(t,e){const n=t.wallet.publicKey,l=t.wallet.publicKey,h=Array.from((await t.fetcher.getPools(e,s.PREFER_CACHE)).values()),f=(0,a.getTokenMintsFromWhirlpools)(h,a.TokenMintTypes.POOL_ONLY).mintMap;await t.fetcher.getMintInfos(f);const p=await t.fetcher.getAccountRentExempt(),{ataTokenAddresses:m,resolveAtaIxs:g}=await(0,a.resolveAtaForMints)(t,{mints:f,accountExemption:p,receiver:n,payer:l}),y=await t.connection.getLatestBlockhash();let b=new r.TransactionBuilder(t.connection,t.wallet,t.txBuilderOpts).addInstructions(g);const w=[];for(const o of e){const e=await t.fetcher.getPool(o);if(!e)throw new Error(`Pool not found: ${o}`);const l=await t.fetcher.getConfig(e.whirlpoolsConfig);if(!l)throw new Error(`Config not found: ${e.whirlpoolsConfig}`);if(l.collectProtocolFeesAuthority.toBase58()!==t.wallet.publicKey.toBase58())throw new Error("Wallet is not the collectProtocolFeesAuthority");const h=r.TokenUtil.isNativeMint(e.tokenMintA)||r.TokenUtil.isNativeMint(e.tokenMintB),f=!!m[i.NATIVE_MINT.toBase58()];h&&!f&&(0,a.addNativeMintHandlingIx)(b,m,n,p,t.accountResolverOpts.createWrappedSolAccountMethod);const g=await c.TokenExtensionUtil.buildTokenExtensionContext(t.fetcher,e,s.PREFER_CACHE),y={whirlpoolsConfig:e.whirlpoolsConfig,whirlpool:r.AddressUtil.toPubKey(o),tokenVaultA:e.tokenVaultA,tokenVaultB:e.tokenVaultB,tokenOwnerAccountA:m[e.tokenMintA.toBase58()],tokenOwnerAccountB:m[e.tokenMintB.toBase58()],collectProtocolFeesAuthority:l.collectProtocolFeesAuthority};w.push(c.TokenExtensionUtil.isV2IxRequiredPool(g)?(0,d.collectProtocolFeesV2Ix)(t.program,{...y,tokenMintA:g.tokenMintWithProgramA.address,tokenMintB:g.tokenMintWithProgramB.address,tokenProgramA:g.tokenMintWithProgramA.tokenProgram,tokenProgramB:g.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await c.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,g.tokenMintWithProgramA,y.tokenVaultA,y.tokenOwnerAccountA,y.whirlpool),tokenTransferHookAccountsB:await c.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,g.tokenMintWithProgramB,y.tokenVaultB,y.tokenOwnerAccountB,y.whirlpool)}):(0,u.collectProtocolFeesIx)(t.program,y))}b.addInstructions(w);const _=await b.txnSize({latestBlockhash:y});if(_>o.PACKET_DATA_SIZE)throw new Error(`Transaction size is too large: ${_}`);return b}},84533:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(37970),e),i(n(73984),e),i(n(9599),e)},9599:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.swapAsync=void 0;const r=n(66259),i=n(40273),o=n(76191),s=n(93018),a=n(90115);e.swapAsync=async function(t,e,n){const{wallet:u,whirlpool:c,swapInput:d}=e,{aToB:l,amount:h}=d,f=new r.TransactionBuilder(t.connection,t.wallet,t.txBuilderOpts),p=[d.tickArray0,d.tickArray1,d.tickArray2];let m=await i.TickArrayUtil.getUninitializedArraysString(p,t.fetcher,n);if(m)throw new Error(`TickArray addresses - [${m}] need to be initialized.`);const g=c.getData(),[y,b]=await(0,r.resolveOrCreateATAs)(t.connection,u,[{tokenMint:g.tokenMintA,wrappedSolAmountIn:l?h:r.ZERO},{tokenMint:g.tokenMintB,wrappedSolAmountIn:l?r.ZERO:h}],(()=>t.fetcher.getAccountRentExempt()),void 0,!0,t.accountResolverOpts.allowPDAOwnerAddress,t.accountResolverOpts.createWrappedSolAccountMethod),{address:w,..._}=y,{address:v,...k}=b;f.addInstructions([_,k]);const M=l?w:v,A=l?v:w,S=await s.TokenExtensionUtil.buildTokenExtensionContext(t.fetcher,g),I=i.SwapUtils.getSwapParamsFromQuote(d,t,c,M,A,u);return f.addInstruction(s.TokenExtensionUtil.isV2IxRequiredPool(S)?(0,a.swapV2Ix)(t.program,{...I,tokenMintA:S.tokenMintWithProgramA.address,tokenMintB:S.tokenMintWithProgramB.address,tokenProgramA:S.tokenMintWithProgramA.tokenProgram,tokenProgramB:S.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await s.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,S.tokenMintWithProgramA,I.aToB?I.tokenOwnerAccountA:I.tokenVaultA,I.aToB?I.tokenVaultA:I.tokenOwnerAccountA,I.aToB?I.tokenAuthority:I.whirlpool),tokenTransferHookAccountsB:await s.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,S.tokenMintWithProgramB,I.aToB?I.tokenVaultB:I.tokenOwnerAccountB,I.aToB?I.tokenOwnerAccountB:I.tokenVaultB,I.aToB?I.whirlpool:I.tokenAuthority)}):(0,o.swapIx)(t.program,I))}},37542:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getSwapFromRoute=void 0;const i=n(66259),o=n(29955),s=n(18245),a=r(n(13550)),u=n(40273),c=n(41786),d=n(79468),l=n(51986),h=n(76191),f=n(37771);function p(t,e){const{hopQuotes:n}=t;if(1===n.length)return{...t,hopQuotes:[{...n[0],quote:{...n[0].quote,...u.SwapUtils.calculateSwapAmountsFromQuote(n[0].quote.amount,n[0].quote.estimatedAmountIn,n[0].quote.estimatedAmountOut,e,n[0].quote.amountSpecifiedIsInput)}}]};if(2===t.hopQuotes.length){const n=t.hopQuotes[0],r=t.hopQuotes[1],i=n.quote.amountSpecifiedIsInput;let o={...t};return o.hopQuotes=i?[o.hopQuotes[0],{...r,quote:{...r.quote,otherAmountThreshold:(0,d.adjustForSlippage)(r.quote.estimatedAmountOut,e,!1)}}]:[{...n,quote:{...n.quote,otherAmountThreshold:(0,d.adjustForSlippage)(n.quote.estimatedAmountIn,e,!0)}},o.hopQuotes[1]],o}return t}e.getSwapFromRoute=async function(t,e,n=c.PREFER_CACHE,r=new i.TransactionBuilder(t.connection,t.wallet,(0,l.contextOptionsToBuilderOptions)(t.opts))){const{route:d,wallet:m,resolvedAtaAccounts:g,slippage:y}=e,b=new Set,w=new Set,_=[];let v=!1,k=new a.default(0);function M(t,e){t===o.NATIVE_MINT.toBase58()?(v=!0,k=k.add(e)):b.add(t)}for(let t=0;tnew s.PublicKey(t))),l=d.map((e=>(0,o.getAssociatedTokenAddressSync)(e,t,u)));return(await r(l)).forEach(((e,r)=>{const s=l[r];let u;if(e){if(!e.owner.equals(t))throw new Error(`ATA with change of ownership detected: ${s.toBase58()}`);u={address:s,...i.EMPTY_INSTRUCTION}}else{const e=d[r],i=[(0,o.createAssociatedTokenAccountInstruction)(a,s,t,e)];let c=[];n.has(e.toBase58())&&(c=[(0,o.createCloseAccountInstruction)(s,t,t)]),u={address:s,instructions:i,cleanupInstructions:c,signers:[]}}c[d[r].toBase58()]={tokenProgram:o.TOKEN_PROGRAM_ID,...u}})),c}(m,b,w,(e=>null!=g?Promise.resolve(e.map((t=>g.find((e=>e.address?.toBase58()===t.toBase58()))))):t.fetcher.getTokenInfos(e,n).then((t=>Array.from(t.values())))),void 0,t.accountResolverOpts.allowPDAOwnerAddress),I=Object.values(S);if(v){const e=i.TokenUtil.createWrappedNativeAccountInstruction(m,k,await t.fetcher.getAccountRentExempt(),void 0,void 0,t.accountResolverOpts.createWrappedSolAccountMethod);r.addInstruction(e),S[o.NATIVE_MINT.toBase58()]=e}r.addInstructions(I);const x=d.subRoutes.map((t=>p(t,y)));for(let e=0;e{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decreaseLiquidityIx=void 0;const r=n(29955);e.decreaseLiquidityIx=function(t,e){const{liquidityAmount:n,tokenMinA:i,tokenMinB:o,whirlpool:s,positionAuthority:a,position:u,positionTokenAccount:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tickArrayLower:p,tickArrayUpper:m}=e;return{instructions:[t.instruction.decreaseLiquidity(n,i,o,{accounts:{whirlpool:s,tokenProgram:r.TOKEN_PROGRAM_ID,positionAuthority:a,position:u,positionTokenAccount:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tickArrayLower:p,tickArrayUpper:m}})],cleanupInstructions:[],signers:[]}}},23895:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.deletePositionBundleIx=void 0;const r=n(29955);e.deletePositionBundleIx=function(t,e){const{owner:n,positionBundle:i,positionBundleMint:o,positionBundleTokenAccount:s,receiver:a}=e;return{instructions:[t.instruction.deletePositionBundle({accounts:{positionBundle:i,positionBundleMint:o,positionBundleTokenAccount:s,positionBundleOwner:n,receiver:a,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},84284:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.increaseLiquidityIx=void 0;const r=n(29955);e.increaseLiquidityIx=function(t,e){const{liquidityAmount:n,tokenMaxA:i,tokenMaxB:o,whirlpool:s,positionAuthority:a,position:u,positionTokenAccount:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tickArrayLower:p,tickArrayUpper:m}=e;return{instructions:[t.instruction.increaseLiquidity(n,i,o,{accounts:{whirlpool:s,tokenProgram:r.TOKEN_PROGRAM_ID,positionAuthority:a,position:u,positionTokenAccount:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tickArrayLower:p,tickArrayUpper:m}})],cleanupInstructions:[],signers:[]}}},62902:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(65664),e),i(n(67236),e),i(n(42851),e),i(n(76300),e),i(n(63621),e),i(n(84533),e),i(n(54214),e),i(n(23895),e),i(n(84284),e),i(n(73483),e),i(n(20539),e),i(n(76255),e),i(n(74121),e),i(n(62314),e),i(n(23722),e),i(n(24833),e),i(n(30125),e),i(n(43582),e),i(n(54614),e),i(n(71822),e),i(n(3124),e),i(n(32655),e),i(n(88484),e),i(n(99195),e),i(n(7526),e),i(n(70786),e),i(n(72286),e),i(n(76191),e),i(n(37771),e),i(n(85204),e),i(n(90115),e)},73483:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializeConfigIx=void 0;const r=n(18245);e.initializeConfigIx=function(t,e){const{feeAuthority:n,collectProtocolFeesAuthority:i,rewardEmissionsSuperAuthority:o,defaultProtocolFeeRate:s,funder:a}=e;return{instructions:[t.instruction.initializeConfig(n,i,o,s,{accounts:{config:e.whirlpoolsConfigKeypair.publicKey,funder:a,systemProgram:r.SystemProgram.programId}})],cleanupInstructions:[],signers:[e.whirlpoolsConfigKeypair]}}},20539:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializeFeeTierIx=void 0;const r=n(18245);e.initializeFeeTierIx=function(t,e){const{feeTierPda:n,whirlpoolsConfig:i,tickSpacing:o,feeAuthority:s,defaultFeeRate:a,funder:u}=e;return{instructions:[t.instruction.initializeFeeTier(o,a,{accounts:{config:i,feeTier:n.publicKey,feeAuthority:s,funder:u,systemProgram:r.SystemProgram.programId}})],cleanupInstructions:[],signers:[]}}},76255:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializePoolIx=void 0;const r=n(29955),i=n(18245);e.initializePoolIx=function(t,e){const{initSqrtPrice:n,tokenMintA:o,tokenMintB:s,whirlpoolsConfig:a,whirlpoolPda:u,feeTierKey:c,tokenVaultAKeypair:d,tokenVaultBKeypair:l,tickSpacing:h,funder:f}=e,p={whirlpoolBump:u.bump};return{instructions:[t.instruction.initializePool(p,h,n,{accounts:{whirlpoolsConfig:a,tokenMintA:o,tokenMintB:s,funder:f,whirlpool:u.publicKey,tokenVaultA:d.publicKey,tokenVaultB:l.publicKey,feeTier:c,tokenProgram:r.TOKEN_PROGRAM_ID,systemProgram:i.SystemProgram.programId,rent:i.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[d,l]}}},74121:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.initializePositionBundleWithMetadataIx=e.initializePositionBundleIx=void 0;const s=o(n(78845)),a=n(29955),u=n(18245),c=n(40273);e.initializePositionBundleIx=function(t,e){const{owner:n,positionBundlePda:r,positionBundleMintKeypair:i,positionBundleTokenAccount:o,funder:c}=e;return{instructions:[t.instruction.initializePositionBundle({accounts:{positionBundle:r.publicKey,positionBundleMint:i.publicKey,positionBundleTokenAccount:o,positionBundleOwner:n,funder:c,associatedTokenProgram:a.ASSOCIATED_TOKEN_PROGRAM_ID,tokenProgram:a.TOKEN_PROGRAM_ID,systemProgram:u.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[i]}},e.initializePositionBundleWithMetadataIx=function(t,e){const{owner:n,positionBundlePda:r,positionBundleMintKeypair:i,positionBundleTokenAccount:o,positionBundleMetadataPda:d,funder:l}=e;return{instructions:[t.instruction.initializePositionBundleWithMetadata({accounts:{positionBundle:r.publicKey,positionBundleMint:i.publicKey,positionBundleMetadata:d.publicKey,positionBundleTokenAccount:o,positionBundleOwner:n,funder:l,associatedTokenProgram:a.ASSOCIATED_TOKEN_PROGRAM_ID,tokenProgram:a.TOKEN_PROGRAM_ID,systemProgram:u.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY,metadataProgram:c.METADATA_PROGRAM_ADDRESS,metadataUpdateAuth:c.WHIRLPOOL_NFT_UPDATE_AUTH}})],cleanupInstructions:[],signers:[i]}}},62314:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeRewardIx=void 0;const s=o(n(78845)),a=n(29955),u=n(18245);e.initializeRewardIx=function(t,e){const{rewardAuthority:n,funder:r,whirlpool:i,rewardMint:o,rewardVaultKeypair:c,rewardIndex:d}=e;return{instructions:[t.instruction.initializeReward(d,{accounts:{rewardAuthority:n,funder:r,whirlpool:i,rewardMint:o,rewardVault:c.publicKey,tokenProgram:a.TOKEN_PROGRAM_ID,systemProgram:u.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[c]}}},23722:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.initTickArrayIx=void 0;const s=o(n(78845));e.initTickArrayIx=function(t,e){const{whirlpool:n,funder:r,tickArrayPda:i}=e;return{instructions:[t.instruction.initializeTickArray(e.startTick,{accounts:{whirlpool:n,funder:r,tickArray:i.publicKey,systemProgram:s.web3.SystemProgram.programId}})],cleanupInstructions:[],signers:[]}}},24833:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.openBundledPositionIx=void 0;const s=o(n(78845)),a=n(18245);e.openBundledPositionIx=function(t,e){const{whirlpool:n,bundledPositionPda:r,positionBundle:i,positionBundleTokenAccount:o,positionBundleAuthority:u,bundleIndex:c,tickLowerIndex:d,tickUpperIndex:l,funder:h}=e;return{instructions:[t.instruction.openBundledPosition(c,d,l,{accounts:{bundledPosition:r.publicKey,positionBundle:i,positionBundleTokenAccount:o,positionBundleAuthority:u,whirlpool:n,funder:h,systemProgram:a.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[]}}},30125:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.openPositionWithMetadataIx=e.openPositionIx=void 0;const r=n(40273),i=n(70706);e.openPositionIx=function(t,e){const{positionPda:n,tickLowerIndex:r,tickUpperIndex:o}=e,s={positionBump:n.bump};return{instructions:[t.instruction.openPosition(s,r,o,{accounts:(0,i.openPositionAccounts)(e)})],cleanupInstructions:[],signers:[]}},e.openPositionWithMetadataIx=function(t,e){const{positionPda:n,metadataPda:o,tickLowerIndex:s,tickUpperIndex:a}=e,u={positionBump:n.bump,metadataBump:o.bump};return{instructions:[t.instruction.openPositionWithMetadata(u,s,a,{accounts:{...(0,i.openPositionAccounts)(e),positionMetadataAccount:o.publicKey,metadataProgram:r.METADATA_PROGRAM_ADDRESS,metadataUpdateAuth:r.WHIRLPOOL_NFT_UPDATE_AUTH}})],cleanupInstructions:[],signers:[]}}},43582:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setCollectProtocolFeesAuthorityIx=void 0,e.setCollectProtocolFeesAuthorityIx=function(t,e){const{whirlpoolsConfig:n,collectProtocolFeesAuthority:r,newCollectProtocolFeesAuthority:i}=e;return{instructions:[t.instruction.setCollectProtocolFeesAuthority({accounts:{whirlpoolsConfig:n,collectProtocolFeesAuthority:r,newCollectProtocolFeesAuthority:i}})],cleanupInstructions:[],signers:[]}}},54614:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setDefaultFeeRateIx=void 0;const r=n(74808);e.setDefaultFeeRateIx=function(t,e){const{whirlpoolsConfig:n,feeAuthority:i,tickSpacing:o,defaultFeeRate:s}=e,a=r.PDAUtil.getFeeTier(t.programId,n,o);return{instructions:[t.instruction.setDefaultFeeRate(s,{accounts:{whirlpoolsConfig:n,feeTier:a.publicKey,feeAuthority:i}})],cleanupInstructions:[],signers:[]}}},71822:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setDefaultProtocolFeeRateIx=void 0,e.setDefaultProtocolFeeRateIx=function(t,e){const{whirlpoolsConfig:n,feeAuthority:r,defaultProtocolFeeRate:i}=e;return{instructions:[t.instruction.setDefaultProtocolFeeRate(i,{accounts:{whirlpoolsConfig:n,feeAuthority:r}})],cleanupInstructions:[],signers:[]}}},3124:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setFeeAuthorityIx=void 0,e.setFeeAuthorityIx=function(t,e){const{whirlpoolsConfig:n,feeAuthority:r,newFeeAuthority:i}=e;return{instructions:[t.instruction.setFeeAuthority({accounts:{whirlpoolsConfig:n,feeAuthority:r,newFeeAuthority:i}})],cleanupInstructions:[],signers:[]}}},32655:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setFeeRateIx=void 0,e.setFeeRateIx=function(t,e){const{whirlpoolsConfig:n,whirlpool:r,feeAuthority:i,feeRate:o}=e;return{instructions:[t.instruction.setFeeRate(o,{accounts:{whirlpoolsConfig:n,whirlpool:r,feeAuthority:i}})],cleanupInstructions:[],signers:[]}}},88484:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setProtocolFeeRateIx=void 0,e.setProtocolFeeRateIx=function(t,e){const{whirlpoolsConfig:n,whirlpool:r,feeAuthority:i,protocolFeeRate:o}=e;return{instructions:[t.instruction.setProtocolFeeRate(o,{accounts:{whirlpoolsConfig:n,whirlpool:r,feeAuthority:i}})],cleanupInstructions:[],signers:[]}}},99195:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardAuthorityBySuperAuthorityIx=void 0,e.setRewardAuthorityBySuperAuthorityIx=function(t,e){const{whirlpoolsConfig:n,whirlpool:r,rewardEmissionsSuperAuthority:i,newRewardAuthority:o,rewardIndex:s}=e;return{instructions:[t.instruction.setRewardAuthorityBySuperAuthority(s,{accounts:{whirlpoolsConfig:n,whirlpool:r,rewardEmissionsSuperAuthority:i,newRewardAuthority:o}})],cleanupInstructions:[],signers:[]}}},7526:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardAuthorityIx=void 0,e.setRewardAuthorityIx=function(t,e){const{whirlpool:n,rewardAuthority:r,newRewardAuthority:i,rewardIndex:o}=e;return{instructions:[t.instruction.setRewardAuthority(o,{accounts:{whirlpool:n,rewardAuthority:r,newRewardAuthority:i}})],cleanupInstructions:[],signers:[]}}},70786:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardEmissionsIx=void 0,e.setRewardEmissionsIx=function(t,e){const{rewardAuthority:n,whirlpool:r,rewardIndex:i,rewardVaultKey:o,emissionsPerSecondX64:s}=e;return{instructions:[t.instruction.setRewardEmissions(i,s,{accounts:{rewardAuthority:n,whirlpool:r,rewardVault:o}})],cleanupInstructions:[],signers:[]}}},72286:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardEmissionsSuperAuthorityIx=void 0,e.setRewardEmissionsSuperAuthorityIx=function(t,e){const{whirlpoolsConfig:n,rewardEmissionsSuperAuthority:r,newRewardEmissionsSuperAuthority:i}=e;return{instructions:[t.instruction.setRewardEmissionsSuperAuthority({accounts:{whirlpoolsConfig:n,rewardEmissionsSuperAuthority:r,newRewardEmissionsSuperAuthority:i}})],cleanupInstructions:[],signers:[]}}},76191:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.swapIx=void 0;const r=n(29955);e.swapIx=function(t,e){const{amount:n,otherAmountThreshold:i,sqrtPriceLimit:o,amountSpecifiedIsInput:s,aToB:a,whirlpool:u,tokenAuthority:c,tokenOwnerAccountA:d,tokenVaultA:l,tokenOwnerAccountB:h,tokenVaultB:f,tickArray0:p,tickArray1:m,tickArray2:g,oracle:y}=e;return{instructions:[t.instruction.swap(n,i,o,s,a,{accounts:{tokenProgram:r.TOKEN_PROGRAM_ID,tokenAuthority:c,whirlpool:u,tokenOwnerAccountA:d,tokenVaultA:l,tokenOwnerAccountB:h,tokenVaultB:f,tickArray0:p,tickArray1:m,tickArray2:g,oracle:y}})],cleanupInstructions:[],signers:[]}}},37771:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.twoHopSwapIx=void 0;const r=n(29955);e.twoHopSwapIx=function(t,e){const{amount:n,otherAmountThreshold:i,amountSpecifiedIsInput:o,aToBOne:s,aToBTwo:a,sqrtPriceLimitOne:u,sqrtPriceLimitTwo:c,whirlpoolOne:d,whirlpoolTwo:l,tokenAuthority:h,tokenOwnerAccountOneA:f,tokenVaultOneA:p,tokenOwnerAccountOneB:m,tokenVaultOneB:g,tokenOwnerAccountTwoA:y,tokenVaultTwoA:b,tokenOwnerAccountTwoB:w,tokenVaultTwoB:_,tickArrayOne0:v,tickArrayOne1:k,tickArrayOne2:M,tickArrayTwo0:A,tickArrayTwo1:S,tickArrayTwo2:I,oracleOne:x,oracleTwo:E}=e;return{instructions:[t.instruction.twoHopSwap(n,i,o,s,a,u,c,{accounts:{tokenProgram:r.TOKEN_PROGRAM_ID,tokenAuthority:h,whirlpoolOne:d,whirlpoolTwo:l,tokenOwnerAccountOneA:f,tokenVaultOneA:p,tokenOwnerAccountOneB:m,tokenVaultOneB:g,tokenOwnerAccountTwoA:y,tokenVaultTwoA:b,tokenOwnerAccountTwoB:w,tokenVaultTwoB:_,tickArrayOne0:v,tickArrayOne1:k,tickArrayOne2:M,tickArrayTwo0:A,tickArrayTwo1:S,tickArrayTwo2:I,oracleOne:x,oracleTwo:E}})],cleanupInstructions:[],signers:[]}}},85204:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.updateFeesAndRewardsIx=void 0,e.updateFeesAndRewardsIx=function(t,e){const{whirlpool:n,position:r,tickArrayLower:i,tickArrayUpper:o}=e;return{instructions:[t.instruction.updateFeesAndRewards({accounts:{whirlpool:n,position:r,tickArrayLower:i,tickArrayUpper:o}})],cleanupInstructions:[],signers:[]}}},99110:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectFeesV2Ix=void 0;const r=n(40273),i=n(60605);e.collectFeesV2Ix=function(t,e){const{whirlpool:n,positionAuthority:o,position:s,positionTokenAccount:a,tokenMintA:u,tokenMintB:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tokenTransferHookAccountsA:p,tokenTransferHookAccountsB:m,tokenProgramA:g,tokenProgramB:y}=e,[b,w]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,p).addSlice(i.RemainingAccountsType.TransferHookB,m).build();return{instructions:[t.instruction.collectFeesV2(b,{accounts:{whirlpool:n,positionAuthority:o,position:s,positionTokenAccount:a,tokenMintA:u,tokenMintB:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tokenProgramA:g,tokenProgramB:y,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:w})],cleanupInstructions:[],signers:[]}}},20628:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectProtocolFeesV2Ix=void 0;const r=n(40273),i=n(60605);e.collectProtocolFeesV2Ix=function(t,e){const{whirlpoolsConfig:n,whirlpool:o,collectProtocolFeesAuthority:s,tokenMintA:a,tokenMintB:u,tokenVaultA:c,tokenVaultB:d,tokenTransferHookAccountsA:l,tokenTransferHookAccountsB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenProgramA:m,tokenProgramB:g}=e,[y,b]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,l).addSlice(i.RemainingAccountsType.TransferHookB,h).build();return{instructions:[t.instruction.collectProtocolFeesV2(y,{accounts:{whirlpoolsConfig:n,whirlpool:o,collectProtocolFeesAuthority:s,tokenMintA:a,tokenMintB:u,tokenVaultA:c,tokenVaultB:d,tokenDestinationA:f,tokenDestinationB:p,tokenProgramA:m,tokenProgramB:g,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:b})],cleanupInstructions:[],signers:[]}}},48893:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectRewardV2Ix=void 0;const r=n(40273),i=n(60605);e.collectRewardV2Ix=function(t,e){const{whirlpool:n,positionAuthority:o,position:s,positionTokenAccount:a,rewardMint:u,rewardOwnerAccount:c,rewardVault:d,rewardTransferHookAccounts:l,rewardIndex:h,rewardTokenProgram:f}=e,[p,m]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookReward,l).build();return{instructions:[t.instruction.collectRewardV2(h,p,{accounts:{whirlpool:n,positionAuthority:o,position:s,positionTokenAccount:a,rewardMint:u,rewardOwnerAccount:c,rewardVault:d,rewardTokenProgram:f,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:m})],cleanupInstructions:[],signers:[]}}},28110:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decreaseLiquidityV2Ix=void 0;const r=n(40273),i=n(60605);e.decreaseLiquidityV2Ix=function(t,e){const{liquidityAmount:n,tokenMinA:o,tokenMinB:s,whirlpool:a,positionAuthority:u,position:c,positionTokenAccount:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenVaultA:m,tokenVaultB:g,tokenTransferHookAccountsA:y,tokenTransferHookAccountsB:b,tokenProgramA:w,tokenProgramB:_,tickArrayLower:v,tickArrayUpper:k}=e,[M,A]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,y).addSlice(i.RemainingAccountsType.TransferHookB,b).build();return{instructions:[t.instruction.decreaseLiquidityV2(n,o,s,M,{accounts:{whirlpool:a,positionAuthority:u,position:c,positionTokenAccount:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenVaultA:m,tokenVaultB:g,tokenProgramA:w,tokenProgramB:_,tickArrayLower:v,tickArrayUpper:k,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:A})],cleanupInstructions:[],signers:[]}}},96555:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.deleteTokenBadgeIx=void 0,e.deleteTokenBadgeIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,tokenBadgeAuthority:i,tokenMint:o,tokenBadge:s,receiver:a}=e;return{instructions:[t.instruction.deleteTokenBadge({accounts:{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,tokenBadgeAuthority:i,tokenMint:o,tokenBadge:s,receiver:a}})],cleanupInstructions:[],signers:[]}}},29582:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.increaseLiquidityV2Ix=void 0;const r=n(40273),i=n(60605);e.increaseLiquidityV2Ix=function(t,e){const{liquidityAmount:n,tokenMaxA:o,tokenMaxB:s,whirlpool:a,positionAuthority:u,position:c,positionTokenAccount:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenVaultA:m,tokenVaultB:g,tokenTransferHookAccountsA:y,tokenTransferHookAccountsB:b,tokenProgramA:w,tokenProgramB:_,tickArrayLower:v,tickArrayUpper:k}=e,[M,A]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,y).addSlice(i.RemainingAccountsType.TransferHookB,b).build();return{instructions:[t.instruction.increaseLiquidityV2(n,o,s,M,{accounts:{whirlpool:a,positionAuthority:u,position:c,positionTokenAccount:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenVaultA:m,tokenVaultB:g,tokenProgramA:w,tokenProgramB:_,tickArrayLower:v,tickArrayUpper:k,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:A})],cleanupInstructions:[],signers:[]}}},90115:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(99110),e),i(n(20628),e),i(n(48893),e),i(n(28110),e),i(n(29582),e),i(n(45805),e),i(n(81522),e),i(n(51965),e),i(n(63486),e),i(n(73826),e),i(n(38310),e),i(n(64439),e),i(n(82982),e),i(n(82607),e),i(n(96555),e)},38310:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializeConfigExtensionIx=void 0;const r=n(18245);e.initializeConfigExtensionIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtensionPda:i,funder:o,feeAuthority:s}=e;return{instructions:[t.instruction.initializeConfigExtension({accounts:{config:n,configExtension:i.publicKey,funder:o,feeAuthority:s,systemProgram:r.SystemProgram.programId}})],cleanupInstructions:[],signers:[]}}},45805:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializePoolV2Ix=void 0;const r=n(18245);e.initializePoolV2Ix=function(t,e){const{initSqrtPrice:n,tokenMintA:i,tokenMintB:o,tokenBadgeA:s,tokenBadgeB:a,tokenProgramA:u,tokenProgramB:c,whirlpoolsConfig:d,whirlpoolPda:l,feeTierKey:h,tokenVaultAKeypair:f,tokenVaultBKeypair:p,tickSpacing:m,funder:g}=e;return{instructions:[t.instruction.initializePoolV2(m,n,{accounts:{whirlpoolsConfig:d,tokenMintA:i,tokenMintB:o,tokenBadgeA:s,tokenBadgeB:a,funder:g,whirlpool:l.publicKey,tokenVaultA:f.publicKey,tokenVaultB:p.publicKey,feeTier:h,systemProgram:r.SystemProgram.programId,tokenProgramA:u,tokenProgramB:c,rent:r.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[f,p]}}},81522:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeRewardV2Ix=void 0;const s=o(n(78845)),a=n(18245);e.initializeRewardV2Ix=function(t,e){const{rewardAuthority:n,funder:r,whirlpool:i,rewardMint:o,rewardTokenBadge:u,rewardVaultKeypair:c,rewardIndex:d,rewardTokenProgram:l}=e;return{instructions:[t.instruction.initializeRewardV2(d,{accounts:{rewardAuthority:n,funder:r,whirlpool:i,rewardMint:o,rewardTokenBadge:u,rewardVault:c.publicKey,rewardTokenProgram:l,systemProgram:a.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[c]}}},82607:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializeTokenBadgeIx=void 0;const r=n(18245);e.initializeTokenBadgeIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtension:i,tokenBadgeAuthority:o,tokenMint:s,tokenBadgePda:a,funder:u}=e;return{instructions:[t.instruction.initializeTokenBadge({accounts:{whirlpoolsConfig:n,whirlpoolsConfigExtension:i,tokenBadgeAuthority:o,tokenMint:s,tokenBadge:a.publicKey,funder:u,systemProgram:r.SystemProgram.programId}})],cleanupInstructions:[],signers:[]}}},64439:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setConfigExtensionAuthorityIx=void 0,e.setConfigExtensionAuthorityIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,configExtensionAuthority:i,newConfigExtensionAuthority:o}=e;return{instructions:[t.instruction.setConfigExtensionAuthority({accounts:{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,configExtensionAuthority:i,newConfigExtensionAuthority:o}})],cleanupInstructions:[],signers:[]}}},51965:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardEmissionsV2Ix=void 0,e.setRewardEmissionsV2Ix=function(t,e){const{rewardAuthority:n,whirlpool:r,rewardIndex:i,rewardVaultKey:o,emissionsPerSecondX64:s}=e;return{instructions:[t.instruction.setRewardEmissionsV2(i,s,{accounts:{rewardAuthority:n,whirlpool:r,rewardVault:o}})],cleanupInstructions:[],signers:[]}}},82982:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setTokenBadgeAuthorityIx=void 0,e.setTokenBadgeAuthorityIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,configExtensionAuthority:i,newTokenBadgeAuthority:o}=e;return{instructions:[t.instruction.setTokenBadgeAuthority({accounts:{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,configExtensionAuthority:i,newTokenBadgeAuthority:o}})],cleanupInstructions:[],signers:[]}}},63486:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.swapV2Ix=void 0;const r=n(37917),i=n(60605);e.swapV2Ix=function(t,e){const{amount:n,otherAmountThreshold:o,sqrtPriceLimit:s,amountSpecifiedIsInput:a,aToB:u,whirlpool:c,tokenAuthority:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenVaultA:p,tokenOwnerAccountB:m,tokenVaultB:g,tokenTransferHookAccountsA:y,tokenTransferHookAccountsB:b,tokenProgramA:w,tokenProgramB:_,tickArray0:v,tickArray1:k,tickArray2:M,oracle:A}=e,[S,I]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,y).addSlice(i.RemainingAccountsType.TransferHookB,b).build();return{instructions:[t.instruction.swapV2(n,o,s,a,u,S,{accounts:{tokenProgramA:w,tokenProgramB:_,memoProgram:r.MEMO_PROGRAM_ADDRESS,tokenAuthority:d,whirlpool:c,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenVaultA:p,tokenOwnerAccountB:m,tokenVaultB:g,tickArray0:v,tickArray1:k,tickArray2:M,oracle:A},remainingAccounts:I})],cleanupInstructions:[],signers:[]}}},73826:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.twoHopSwapV2Ix=void 0;const r=n(37917),i=n(60605);e.twoHopSwapV2Ix=function(t,e){const{amount:n,otherAmountThreshold:o,amountSpecifiedIsInput:s,aToBOne:a,aToBTwo:u,sqrtPriceLimitOne:c,sqrtPriceLimitTwo:d,whirlpoolOne:l,whirlpoolTwo:h,tokenMintInput:f,tokenMintIntermediate:p,tokenMintOutput:m,tokenProgramInput:g,tokenProgramIntermediate:y,tokenProgramOutput:b,tokenVaultOneInput:w,tokenVaultOneIntermediate:_,tokenVaultTwoIntermediate:v,tokenVaultTwoOutput:k,tokenAuthority:M,tokenTransferHookAccountsInput:A,tokenTransferHookAccountsIntermediate:S,tokenTransferHookAccountsOutput:I,tokenOwnerAccountInput:x,tokenOwnerAccountOutput:E,tickArrayOne0:T,tickArrayOne1:P,tickArrayOne2:B,tickArrayTwo0:L,tickArrayTwo1:$,tickArrayTwo2:R,oracleOne:O,oracleTwo:D}=e,[C,N]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookInput,A).addSlice(i.RemainingAccountsType.TransferHookIntermediate,S).addSlice(i.RemainingAccountsType.TransferHookOutput,I).build();return{instructions:[t.instruction.twoHopSwapV2(n,o,s,a,u,c,d,C,{accounts:{whirlpoolOne:l,whirlpoolTwo:h,tokenMintInput:f,tokenMintIntermediate:p,tokenMintOutput:m,tokenProgramInput:g,tokenProgramIntermediate:y,tokenProgramOutput:b,tokenOwnerAccountInput:x,tokenVaultOneInput:w,tokenVaultOneIntermediate:_,tokenVaultTwoIntermediate:v,tokenVaultTwoOutput:k,tokenOwnerAccountOutput:E,tokenAuthority:M,tickArrayOne0:T,tickArrayOne1:P,tickArrayOne2:B,tickArrayTwo0:L,tickArrayTwo1:$,tickArrayTwo2:R,oracleOne:O,oracleTwo:D,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:N})],cleanupInstructions:[],signers:[]}}},19503:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolIx=void 0;const s=o(n(62902));e.WhirlpoolIx=class{static initializeConfigIx(t,e){return s.initializeConfigIx(t,e)}static initializeFeeTierIx(t,e){return s.initializeFeeTierIx(t,e)}static initializePoolIx(t,e){return s.initializePoolIx(t,e)}static initializeRewardIx(t,e){return s.initializeRewardIx(t,e)}static initTickArrayIx(t,e){return s.initTickArrayIx(t,e)}static openPositionIx(t,e){return s.openPositionIx(t,e)}static openPositionWithMetadataIx(t,e){return s.openPositionWithMetadataIx(t,e)}static increaseLiquidityIx(t,e){return s.increaseLiquidityIx(t,e)}static decreaseLiquidityIx(t,e){return s.decreaseLiquidityIx(t,e)}static closePositionIx(t,e){return s.closePositionIx(t,e)}static swapIx(t,e){return s.swapIx(t,e)}static twoHopSwapIx(t,e){return s.twoHopSwapIx(t,e)}static updateFeesAndRewardsIx(t,e){return s.updateFeesAndRewardsIx(t,e)}static collectFeesIx(t,e){return s.collectFeesIx(t,e)}static collectProtocolFeesIx(t,e){return s.collectProtocolFeesIx(t,e)}static collectRewardIx(t,e){return s.collectRewardIx(t,e)}static setCollectProtocolFeesAuthorityIx(t,e){return s.setCollectProtocolFeesAuthorityIx(t,e)}static setDefaultFeeRateIx(t,e){return s.setDefaultFeeRateIx(t,e)}static setDefaultProtocolFeeRateIx(t,e){return s.setDefaultProtocolFeeRateIx(t,e)}static setFeeAuthorityIx(t,e){return s.setFeeAuthorityIx(t,e)}static setFeeRateIx(t,e){return s.setFeeRateIx(t,e)}static setProtocolFeeRateIx(t,e){return s.setProtocolFeeRateIx(t,e)}static setRewardAuthorityBySuperAuthorityIx(t,e){return s.setRewardAuthorityBySuperAuthorityIx(t,e)}static setRewardAuthorityIx(t,e){return s.setRewardAuthorityIx(t,e)}static setRewardEmissionsIx(t,e){return s.setRewardEmissionsIx(t,e)}static setRewardEmissionsSuperAuthorityIx(t,e){return s.setRewardEmissionsSuperAuthorityIx(t,e)}static initializePositionBundleIx(t,e){return s.initializePositionBundleIx(t,e)}static initializePositionBundleWithMetadataIx(t,e){return s.initializePositionBundleWithMetadataIx(t,e)}static deletePositionBundleIx(t,e){return s.deletePositionBundleIx(t,e)}static openBundledPositionIx(t,e){return s.openBundledPositionIx(t,e)}static closeBundledPositionIx(t,e){return s.closeBundledPositionIx(t,e)}static collectFeesV2Ix(t,e){return s.collectFeesV2Ix(t,e)}static collectProtocolFeesV2Ix(t,e){return s.collectProtocolFeesV2Ix(t,e)}static collectRewardV2Ix(t,e){return s.collectRewardV2Ix(t,e)}static decreaseLiquidityV2Ix(t,e){return s.decreaseLiquidityV2Ix(t,e)}static increaseLiquidityV2Ix(t,e){return s.increaseLiquidityV2Ix(t,e)}static initializePoolV2Ix(t,e){return s.initializePoolV2Ix(t,e)}static initializeRewardV2Ix(t,e){return s.initializeRewardV2Ix(t,e)}static setRewardEmissionsV2Ix(t,e){return s.setRewardEmissionsV2Ix(t,e)}static swapV2Ix(t,e){return s.swapV2Ix(t,e)}static twoHopSwapV2Ix(t,e){return s.twoHopSwapV2Ix(t,e)}static initializeConfigExtensionIx(t,e){return s.initializeConfigExtensionIx(t,e)}static setConfigExtensionAuthorityIx(t,e){return s.setConfigExtensionAuthorityIx(t,e)}static setTokenBadgeAuthorityIx(t,e){return s.setTokenBadgeAuthorityIx(t,e)}static initializeTokenBadgeIx(t,e){return s.initializeTokenBadgeIx(t,e)}static deleteTokenBadgeIx(t,e){return s.deleteTokenBadgeIx(t,e)}}},74498:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolAccountFetcher=e.buildDefaultAccountFetcher=void 0;const r=n(66259),i=n(29955),o=n(57752),s=n(69261);e.buildDefaultAccountFetcher=t=>new a(t,new r.SimpleAccountFetcher(t,o.DEFAULT_WHIRLPOOL_RETENTION_POLICY));class a{constructor(t,e){this.connection=t,this.fetcher=e,this._epochInfoNextFetchTime=0}async getAccountRentExempt(t=!1){return this._accountRentExempt&&!t||(this._accountRentExempt=await this.connection.getMinimumBalanceForRentExemption(i.AccountLayout.span)),this._accountRentExempt}async getEpoch(t=!1){if(!this._epochInfo||Date.now()>=this._epochInfoNextFetchTime||t){const t=await this.connection.getEpochInfo(),e=Math.max(t.slotsInEpoch-t.slotIndex,0),n=Date.now()+320*e;this._epochInfo=t,this._epochInfoNextFetchTime=n}return this._epochInfo.epoch}getPool(t,e){return this.fetcher.getAccount(t,s.ParsableWhirlpool,e)}getPools(t,e){return this.fetcher.getAccounts(t,s.ParsableWhirlpool,e)}getPosition(t,e){return this.fetcher.getAccount(t,s.ParsablePosition,e)}getPositions(t,e){return this.fetcher.getAccounts(t,s.ParsablePosition,e)}getTickArray(t,e){return this.fetcher.getAccount(t,s.ParsableTickArray,e)}getTickArrays(t,e){return this.fetcher.getAccountsAsArray(t,s.ParsableTickArray,e)}getFeeTier(t,e){return this.fetcher.getAccount(t,s.ParsableFeeTier,e)}getFeeTiers(t,e){return this.fetcher.getAccounts(t,s.ParsableFeeTier,e)}getTokenInfo(t,e){return this.fetcher.getAccount(t,r.ParsableTokenAccountInfo,e)}getTokenInfos(t,e){return this.fetcher.getAccounts(t,r.ParsableTokenAccountInfo,e)}getMintInfo(t,e){return this.fetcher.getAccount(t,r.ParsableMintInfo,e)}getMintInfos(t,e){return this.fetcher.getAccounts(t,r.ParsableMintInfo,e)}getConfig(t,e){return this.fetcher.getAccount(t,s.ParsableWhirlpoolsConfig,e)}getConfigs(t,e){return this.fetcher.getAccounts(t,s.ParsableWhirlpoolsConfig,e)}getPositionBundle(t,e){return this.fetcher.getAccount(t,s.ParsablePositionBundle,e)}getPositionBundles(t,e){return this.fetcher.getAccounts(t,s.ParsablePositionBundle,e)}getConfigExtension(t,e){return this.fetcher.getAccount(t,s.ParsableWhirlpoolsConfigExtension,e)}getConfigExtensions(t,e){return this.fetcher.getAccounts(t,s.ParsableWhirlpoolsConfigExtension,e)}getTokenBadge(t,e){return this.fetcher.getAccount(t,s.ParsableTokenBadge,e)}getTokenBadges(t,e){return this.fetcher.getAccounts(t,s.ParsableTokenBadge,e)}populateCache(t,e,n=Date.now()){this.fetcher.populateAccounts(t,e,n)}}e.WhirlpoolAccountFetcher=a},36926:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PREFER_CACHE=e.IGNORE_CACHE=e.DEFAULT_WHIRLPOOL_RETENTION_POLICY=void 0,e.DEFAULT_WHIRLPOOL_RETENTION_POLICY=new Map([]),e.IGNORE_CACHE={maxAge:0},e.PREFER_CACHE={maxAge:Number.POSITIVE_INFINITY}},22862:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getAllWhirlpoolAccountsForConfig=void 0;const i=n(66259),o=r(n(26018)),s=n(37917),a=n(69261);e.getAllWhirlpoolAccountsForConfig=async function({connection:t,programId:e,configId:n}){const r=[{dataSize:(0,s.getAccountSize)(s.AccountName.Whirlpool)},{memcmp:s.WHIRLPOOL_CODER.memcmp(s.AccountName.Whirlpool,i.AddressUtil.toPubKey(n).toBuffer())}],u=await t.getProgramAccounts(i.AddressUtil.toPubKey(e),{filters:r}),c=[];return u.forEach((({pubkey:t,account:e})=>{const n=a.ParsableWhirlpool.parse(t,e);(0,o.default)(!!n,`could not parse whirlpool: ${t.toBase58()}`),c.push([i.AddressUtil.toString(t),n])})),new Map(c.map((([t,e])=>[i.AddressUtil.toString(t),e])))}},41786:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(74498),e),i(n(36926),e),i(n(22862),e)},57752:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(41786),e),i(n(69261),e)},69261:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.ParsableTokenBadge=e.ParsableWhirlpoolsConfigExtension=e.ParsablePositionBundle=e.ParsableFeeTier=e.ParsableTickArray=e.ParsablePosition=e.ParsableWhirlpool=e.ParsableWhirlpoolsConfig=void 0;const a=n(78845),u=n(66259),c=s(n(92220)),d=n(37917);let l=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.WhirlpoolsConfig,e)}catch(t){return console.error(`error while parsing WhirlpoolsConfig: ${t}`),null}}};e.ParsableWhirlpoolsConfig=l,e.ParsableWhirlpoolsConfig=l=o([(0,u.staticImplements)()],l);let h=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.Whirlpool,e)}catch(t){return console.error(`error while parsing Whirlpool: ${t}`),null}}};e.ParsableWhirlpool=h,e.ParsableWhirlpool=h=o([(0,u.staticImplements)()],h);let f=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.Position,e)}catch(t){return console.error(`error while parsing Position: ${t}`),null}}};e.ParsablePosition=f,e.ParsablePosition=f=o([(0,u.staticImplements)()],f);let p=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.TickArray,e)}catch(t){return console.error(`error while parsing TickArray: ${t}`),null}}};e.ParsableTickArray=p,e.ParsableTickArray=p=o([(0,u.staticImplements)()],p);let m=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.FeeTier,e)}catch(t){return console.error(`error while parsing FeeTier: ${t}`),null}}};e.ParsableFeeTier=m,e.ParsableFeeTier=m=o([(0,u.staticImplements)()],m);let g=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.PositionBundle,e)}catch(t){return console.error(`error while parsing PositionBundle: ${t}`),null}}};e.ParsablePositionBundle=g,e.ParsablePositionBundle=g=o([(0,u.staticImplements)()],g);let y=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.WhirlpoolsConfigExtension,e)}catch(t){return console.error(`error while parsing WhirlpoolsConfigExtension: ${t}`),null}}};e.ParsableWhirlpoolsConfigExtension=y,e.ParsableWhirlpoolsConfigExtension=y=o([(0,u.staticImplements)()],y);let b=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.TokenBadge,e)}catch(t){return console.error(`error while parsing TokenBadge: ${t}`),null}}};e.ParsableTokenBadge=b,e.ParsableTokenBadge=b=o([(0,u.staticImplements)()],b);const w=new a.BorshAccountsCoder(c);function _(t,e){const n=e.data;if(a.BorshAccountsCoder.accountDiscriminator(t).compare(n.slice(0,8)))return console.error("incorrect account name during parsing"),null;try{return w.decode(t,n)}catch(t){return console.error("unknown account name during parsing"),null}}},36074:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.convertAmount=e.isSubset=e.calculatePricesForQuoteToken=void 0;const i=n(66259),o=r(n(93776)),s=n(54274),a=n(51476),u=n(74808),c=n(93018);function d(t,e){const n=t.tokenMintA.toBase58(),r=t.tokenMintB.toBase58();if(!(n in e)||!(r in e))throw new Error("Missing token decimals");return u.PriceMath.sqrtPriceX64ToPrice(t.sqrtPrice,e[n],e[r])}e.calculatePricesForQuoteToken=function(t,e,n,r,l,h,f){const p=function(t,e){const n=new Map;return Object.entries(e).forEach((([e,r])=>{const o=r.tokenMintA.toBase58(),s=r.tokenMintB.toBase58();if(r.liquidity.isZero())return;if(!r.tokenMintA.equals(t)&&!r.tokenMintB.equals(t))return;const a=r.tokenMintA.equals(t)?s:o,u=n.get(a);u&&!r.liquidity.gt(u.pool.liquidity)||n.set(a,{address:i.AddressUtil.toPubKey(e),pool:r})})),Object.fromEntries(n)}(e,n);return Object.fromEntries(t.map((t=>{const n=i.AddressUtil.toPubKey(t);if(n.equals(e))return[n.toBase58(),new o.default(1)];const[m,g]=u.PoolUtil.orderMints(n,e),y=i.AddressUtil.toPubKey(g).equals(e),b=y?m:g,w=p[i.AddressUtil.toString(b)];if(void 0===w)return[n.toBase58(),null];const{pool:_,address:v}=w,k=function(t,e,n,r,i=s.defaultGetPricesConfig){const{programId:o}=i;return u.SwapUtils.getTickArrayPublicKeys(t.tickCurrentIndex,t.tickSpacing,n,o,e).map((t=>({address:t,data:r[t.toBase58()]})))}(_,v,y,r,h),M=function(t,e,n,r,s){const{amountOut:l,priceImpactThreshold:h}=r;let f,p,m,g;try{({estimatedAmountIn:f}=(0,a.swapQuoteWithParams)({whirlpoolData:t,aToB:n,amountSpecifiedIsInput:!1,tokenAmount:l,otherAmountThreshold:u.SwapUtils.getDefaultOtherAmountThreshold(!1),sqrtPriceLimit:u.SwapUtils.getDefaultSqrtPriceLimit(n),tickArrays:e,tokenExtensionCtx:c.NO_TOKEN_EXTENSION_CONTEXT},i.Percentage.fromDecimal(new o.default(0))))}catch(t){return!1}n?(p=d(t,s),m=s[t.tokenMintA.toBase58()],g=s[t.tokenMintB.toBase58()]):(p=d(t,s).pow(-1),m=s[t.tokenMintB.toBase58()],g=s[t.tokenMintA.toBase58()]);const y=i.DecimalUtil.fromBN(l,g),b=i.DecimalUtil.fromBN(f,m),w=y.div(p).mul(h).toDecimalPlaces(m);return b.lte(w)}(_,k,y,f,l);if(!M)return[n.toBase58(),null];const A=d(_,l),S=y?A:A.pow(-1);return[n.toBase58(),S]})))},e.isSubset=function(t,e){return t.every((t=>e.includes(t)))},e.convertAmount=function(t,e,n,r){return i.DecimalUtil.toBN(i.DecimalUtil.fromBN(t,n).div(e),r)}},54274:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultGetPricesThresholdConfig=e.defaultGetPricesConfig=e.defaultQuoteTokens=void 0;const s=n(18245),a=o(n(13550)),u=n(37917),c=n(47178);i(n(65360),e),e.defaultQuoteTokens=[c.TOKEN_MINTS.USDC,c.TOKEN_MINTS.SOL,c.TOKEN_MINTS.mSOL,c.TOKEN_MINTS.stSOL].map((t=>new s.PublicKey(t))),e.defaultGetPricesConfig={quoteTokens:e.defaultQuoteTokens,tickSpacings:u.ORCA_SUPPORTED_TICK_SPACINGS,programId:u.ORCA_WHIRLPOOL_PROGRAM_ID,whirlpoolsConfig:u.ORCA_WHIRLPOOLS_CONFIG},e.defaultGetPricesThresholdConfig={amountOut:new a.default(1e9),priceImpactThreshold:1.05}},65360:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PriceModuleUtils=e.PriceModule=void 0;const r=n(66259),i=n(18245),o=n(54274),s=n(41786),a=n(74808),u=n(51986),c=n(36074);class d{static async fetchTokenPricesByMints(t,e,n=o.defaultGetPricesConfig,r=o.defaultGetPricesThresholdConfig,i=s.IGNORE_CACHE,a={}){const u=a?.poolMap?a?.poolMap:await l.fetchPoolDataFromMints(t,e,n,i),c=a?.tickArrayMap?a.tickArrayMap:await l.fetchTickArraysForPools(t,u,n,i),h=a?.decimalsMap?a.decimalsMap:await l.fetchDecimalsForMints(t,e,s.PREFER_CACHE);return d.calculateTokenPrices(e,{poolMap:u,tickArrayMap:c,decimalsMap:h},n,r)}static async fetchTokenPricesByPools(t,e,n=o.defaultGetPricesConfig,i=o.defaultGetPricesThresholdConfig,a=s.IGNORE_CACHE){const c=Array.from((await t.getPools(e,a)).values()),[h,f]=(0,u.filterNullObjects)(c,e),p=(0,u.convertListToMap)(h,r.AddressUtil.toStrings(f)),m=await l.fetchTickArraysForPools(t,p,n,a),g=Array.from(Object.values(p).reduce(((t,e)=>(t.add(e.tokenMintA.toBase58()),t.add(e.tokenMintB.toBase58()),t)),new Set)),y=await l.fetchDecimalsForMints(t,g,s.PREFER_CACHE);return d.calculateTokenPrices(g,{poolMap:p,tickArrayMap:m,decimalsMap:y},n,i)}static calculateTokenPrices(t,e,n=o.defaultGetPricesConfig,i=o.defaultGetPricesThresholdConfig){const{poolMap:s,decimalsMap:a,tickArrayMap:u}=e,d=r.AddressUtil.toStrings(t);if(!(0,c.isSubset)(n.quoteTokens.map((t=>r.AddressUtil.toString(t))),d.map((t=>t))))throw new Error("Quote tokens must be in mints array");const l=Object.fromEntries(d.map((t=>[t,null]))),h=n.quoteTokens.slice();let f=t.slice();for(;h.length>0&&f.length>0;){const t=h.shift();if(!t)throw new Error("Unreachable: remainingQuoteTokens is an empty array");let e;if(t.equals(n.quoteTokens[0]))e=i.amountOut;else{const r=t.toBase58(),o=l[r];if(!o)throw new Error(`Quote token - ${r} must have a price against the first quote token`);e=(0,c.convertAmount)(i.amountOut,o,a[n.quoteTokens[0].toBase58()],a[r])}const o=(0,c.calculatePricesForQuoteToken)(f,t,s,u,a,n,{amountOut:e,priceImpactThreshold:i.priceImpactThreshold}),d=l[t.toBase58()]||o[t.toBase58()];f.forEach((t=>{const e=r.AddressUtil.toString(t),n=o[e];null!=n&&null!=d&&(l[e]=n.mul(d))})),f=f.filter((t=>null==l[r.AddressUtil.toString(t)]))}return l}}e.PriceModule=d;class l{static async fetchPoolDataFromMints(t,e,n=o.defaultGetPricesConfig,i=s.IGNORE_CACHE){const{quoteTokens:c,tickSpacings:d,programId:l,whirlpoolsConfig:h}=n,f=e.map((t=>d.map((e=>c.map((n=>{const[i,o]=a.PoolUtil.orderMints(t,n);return a.PDAUtil.getWhirlpool(l,h,r.AddressUtil.toPubKey(i),r.AddressUtil.toPubKey(o),e).publicKey.toBase58()})))).flat())).flat(),p=Array.from((await t.getPools(f,i)).values()),[m,g]=(0,u.filterNullObjects)(p,f);return(0,u.convertListToMap)(m,g)}static async fetchTickArraysForPools(t,e,n=o.defaultGetPricesConfig,r=s.IGNORE_CACHE){const{programId:c}=n,d=t=>{const e=n.quoteTokens.findIndex((e=>e.equals(t)));return-1===e?n.quoteTokens.length:e},l=new Set;Object.entries(e).forEach((([t,e])=>{const n=d(e.tokenMintA),r=d(e.tokenMintB);if(n===r)return;const o=n>r;a.SwapUtils.getTickArrayPublicKeys(e.tickCurrentIndex,e.tickSpacing,o,c,new i.PublicKey(t)).forEach((t=>l.add(t.toBase58())))}));const h=Array.from(l),f=await t.getTickArrays(h,r),[p,m]=(0,u.filterNullObjects)(f,h);return(0,u.convertListToMap)(p,m)}static async fetchDecimalsForMints(t,e,n=s.IGNORE_CACHE){return Array.from((await t.getMintInfos(e,n)).values()).reduce(((t,n,i)=>{const o=r.AddressUtil.toString(e[i]);if(!n)throw new Error(`Mint account does not exist: ${o}`);return t[o]=n.decimals,t}),{})}}e.PriceModuleUtils=l},39313:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectFeesQuote=void 0;const r=n(66259),i=n(93018);e.collectFeesQuote=function(t){const{whirlpool:e,position:n,tickLower:o,tickUpper:s,tokenExtensionCtx:a}=t,{tickCurrentIndex:u,feeGrowthGlobalA:c,feeGrowthGlobalB:d}=e,{tickLowerIndex:l,tickUpperIndex:h,liquidity:f,feeOwedA:p,feeOwedB:m,feeGrowthCheckpointA:g,feeGrowthCheckpointB:y}=n,{feeGrowthOutsideA:b,feeGrowthOutsideB:w}=o,{feeGrowthOutsideA:_,feeGrowthOutsideB:v}=s;let k=null,M=null;u{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.swapQuoteByInputTokenWithDevFees=void 0;const r=n(37392),i=n(51476);e.swapQuoteByInputTokenWithDevFees=async function(t,e,n,o,s,a,u,c){if(u.toDecimal().greaterThanOrEqualTo(1))throw new r.WhirlpoolsError("Provided devFeePercentage must be less than 100%",r.SwapErrorCode.InvalidDevFeePercentage);const d=n.mul(u.numerator).div(u.denominator),l=await(0,i.swapQuoteByInputToken)(t,e,n.sub(d),o,s,a,c);return{...l,amountSpecifiedIsInput:!0,estimatedAmountIn:l.estimatedAmountIn.add(d),estimatedFeeAmount:l.estimatedFeeAmount.add(d),estimatedSwapFeeAmount:l.estimatedFeeAmount,devFeeAmount:d}}},1001:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.increaseLiquidityQuoteByInputTokenWithParams=e.increaseLiquidityQuoteByInputToken=e.increaseLiquidityQuoteByLiquidityWithParams=e.increaseLiquidityQuoteByInputTokenWithParamsUsingPriceSlippage=e.increaseLiquidityQuoteByInputTokenUsingPriceSlippage=void 0;const i=n(66259),o=r(n(13550)),s=r(n(26018)),a=n(79468),u=n(74808),c=n(93018);function d(t){(0,s.default)(u.TickUtil.checkTickInBounds(t.tickLowerIndex),"tickLowerIndex is out of bounds."),(0,s.default)(u.TickUtil.checkTickInBounds(t.tickUpperIndex),"tickUpperIndex is out of bounds."),(0,s.default)(t.inputTokenMint.equals(t.tokenMintA)||t.inputTokenMint.equals(t.tokenMintB),`input token mint ${t.inputTokenMint.toBase58()} does not match any tokens in the provided pool.`);const e=function(t){const{inputTokenMint:e,inputTokenAmount:n,tickLowerIndex:r,tickUpperIndex:o,sqrtPrice:d,tokenExtensionCtx:l}=t;if((0,s.default)(r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.twoHopSwapQuoteFromSwapQuotes=void 0,e.twoHopSwapQuoteFromSwapQuotes=function(t,e){const n=t.amountSpecifiedIsInput;let[r,i]=n?[t.amount,e.otherAmountThreshold]:[e.amount,t.otherAmountThreshold];return{amount:r,otherAmountThreshold:i,amountSpecifiedIsInput:n,aToBOne:t.aToB,aToBTwo:e.aToB,sqrtPriceLimitOne:t.sqrtPriceLimit,sqrtPriceLimitTwo:e.sqrtPriceLimit,tickArrayOne0:t.tickArray0,tickArrayOne1:t.tickArray1,tickArrayOne2:t.tickArray2,tickArrayTwo0:e.tickArray0,tickArrayTwo1:e.tickArray1,tickArrayTwo2:e.tickArray2,swapOneEstimates:{...t},swapTwoEstimates:{...e}}}},93909:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.computeSwap=void 0;const i=n(66259),o=r(n(13550)),s=n(37917),a=n(1922),u=n(74808);function c(t,e,n){const r=u.PriceMath.tickIndexToSqrtPriceX64(t);return{nextTickPrice:r,nextSqrtPriceLimit:n?o.default.max(e,r):o.default.min(e,r)}}function d(t,e,n,r,a){let u=r,c=a,d=t;if(e>0){let t=function(t,e){return t.mul(new o.default(e).div(s.PROTOCOL_FEE_RATE_MUL_VALUE))}(d,e);d=d.sub(t),u=u.add(r)}if(n.gt(i.ZERO)){const t=d.shln(64).div(n);c=c.add(t)}return{nextProtocolFee:u,nextFeeGrowthGlobalInput:c}}function l(t,e,n){return n?e.sub(t):e.add(t)}e.computeSwap=function(t,e,n,r,s,h){let f=n,p=i.ZERO,m=t.sqrtPrice,g=t.liquidity,y=t.tickCurrentIndex,b=i.ZERO;const w=t.feeRate,_=t.protocolFeeRate;let v=new o.default(0),k=h?t.feeGrowthGlobalA:t.feeGrowthGlobalB;for(;f.gt(i.ZERO)&&!r.eq(m);){let{nextIndex:t}=e.findNextInitializedTickIndex(y),{nextTickPrice:n,nextSqrtPriceLimit:i}=c(t,r,h);const o=(0,a.computeSwapStep)(f,w,g,m,i,s,h);b=b.add(o.feeAmount),s?(f=f.sub(o.amountIn),f=f.sub(o.feeAmount),p=p.add(o.amountOut)):(f=f.sub(o.amountOut),p=p.add(o.amountIn),p=p.add(o.feeAmount));let{nextProtocolFee:M,nextFeeGrowthGlobalInput:A}=d(o.feeAmount,_,g,v,k);if(v=M,k=A,o.nextPrice.eq(n)){const n=e.getTick(t);n.initialized&&(g=l(n.liquidityNet,g,h)),y=h?t-1:t}else y=u.PriceMath.sqrtPriceX64ToTickIndex(o.nextPrice);m=o.nextPrice}let{amountA:M,amountB:A}=function(t,e,n,r,i){return r===i?{amountA:t.sub(e),amountB:n}:{amountA:n,amountB:t.sub(e)}}(n,f,p,h,s);return{amountA:M,amountB:A,nextTickIndex:y,nextSqrtPrice:m,totalFeeAmount:b}}},99671:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.simulateSwap=void 0;const r=n(78845),i=n(66259),o=n(37392),s=n(37917),a=n(93909),u=n(6113),c=n(93018);e.simulateSwap=function(t){const{aToB:e,whirlpoolData:n,tickArrays:d,tokenAmount:l,sqrtPriceLimit:h,otherAmountThreshold:f,amountSpecifiedIsInput:p,tokenExtensionCtx:m}=t;if(h.gt(new r.BN(s.MAX_SQRT_PRICE))||h.lt(new r.BN(s.MIN_SQRT_PRICE)))throw new o.WhirlpoolsError("Provided SqrtPriceLimit is out of bounds.",o.SwapErrorCode.SqrtPriceOutOfBounds);if(e&&h.gt(n.sqrtPrice)||!e&&h.lt(n.sqrtPrice))throw new o.WhirlpoolsError("Provided SqrtPriceLimit is in the opposite direction of the trade.",o.SwapErrorCode.InvalidSqrtPriceLimitDirection);if(l.eq(i.ZERO))throw new o.WhirlpoolsError("Provided tokenAmount is zero.",o.SwapErrorCode.ZeroTradableAmount);const g=new u.TickArraySequence(d,n.tickSpacing,e);if(!g.isValidTickArray0(n.tickCurrentIndex))throw new o.WhirlpoolsError("TickArray at index 0 does not contain the Whirlpool current tick index.",o.SwapErrorCode.TickArraySequenceInvalid);if(p){const t=c.TokenExtensionUtil.calculateTransferFeeExcludedAmount(l,e?m.tokenMintWithProgramA:m.tokenMintWithProgramB,m.currentEpoch);if(t.amount.eq(i.ZERO))throw new o.WhirlpoolsError("Provided tokenAmount is virtually zero due to transfer fee.",o.SwapErrorCode.ZeroTradableAmount);const r=(0,a.computeSwap)(n,g,t.amount,h,p,e),u=c.TokenExtensionUtil.calculateTransferFeeExcludedAmount(e?r.amountB:r.amountA,e?m.tokenMintWithProgramB:m.tokenMintWithProgramA,m.currentEpoch);if(u.amount.lt(f))throw new o.WhirlpoolsError("Quoted amount for the other token is below the otherAmountThreshold.",o.SwapErrorCode.AmountOutBelowMinimum);const d=(e?r.amountA:r.amountB).eq(t.amount)?{isFeeIncludedAmount:!0,amount:l,fee:t.fee}:c.TokenExtensionUtil.calculateTransferFeeIncludedAmount(e?r.amountA:r.amountB,e?m.tokenMintWithProgramA:m.tokenMintWithProgramB,m.currentEpoch),y=g.getNumOfTouchedArrays();if(y>s.MAX_SWAP_TICK_ARRAYS)throw new o.WhirlpoolsError(`Input amount causes the quote to traverse more than the allowable amount of tick-arrays ${y}`,o.SwapErrorCode.TickArrayCrossingAboveMax);const b=g.getTouchedArrays(s.MAX_SWAP_TICK_ARRAYS);return{estimatedAmountIn:d.amount,estimatedAmountOut:u.amount,estimatedEndTickIndex:r.nextTickIndex,estimatedEndSqrtPrice:r.nextSqrtPrice,estimatedFeeAmount:r.totalFeeAmount,transferFee:{deductingFromEstimatedAmountIn:d.fee,deductedFromEstimatedAmountOut:u.fee},amount:l,amountSpecifiedIsInput:p,aToB:e,otherAmountThreshold:f,sqrtPriceLimit:h,tickArray0:b[0],tickArray1:b[1],tickArray2:b[2]}}const y=c.TokenExtensionUtil.calculateTransferFeeIncludedAmount(l,e?m.tokenMintWithProgramB:m.tokenMintWithProgramA,m.currentEpoch),b=(0,a.computeSwap)(n,g,y.amount,h,p,e),w=c.TokenExtensionUtil.calculateTransferFeeIncludedAmount(e?b.amountA:b.amountB,e?m.tokenMintWithProgramA:m.tokenMintWithProgramB,m.currentEpoch);if(w.amount.gt(f))throw new o.WhirlpoolsError("Quoted amount for the other token is above the otherAmountThreshold.",o.SwapErrorCode.AmountInAboveMaximum);const _=c.TokenExtensionUtil.calculateTransferFeeExcludedAmount(e?b.amountB:b.amountA,e?m.tokenMintWithProgramB:m.tokenMintWithProgramA,m.currentEpoch),v=g.getNumOfTouchedArrays();if(v>s.MAX_SWAP_TICK_ARRAYS)throw new o.WhirlpoolsError(`Input amount causes the quote to traverse more than the allowable amount of tick-arrays ${v}`,o.SwapErrorCode.TickArrayCrossingAboveMax);const k=g.getTouchedArrays(s.MAX_SWAP_TICK_ARRAYS);return{estimatedAmountIn:w.amount,estimatedAmountOut:_.amount,estimatedEndTickIndex:b.nextTickIndex,estimatedEndSqrtPrice:b.nextSqrtPrice,estimatedFeeAmount:b.totalFeeAmount,transferFee:{deductingFromEstimatedAmountIn:w.fee,deductedFromEstimatedAmountOut:_.fee},amount:l,amountSpecifiedIsInput:p,aToB:e,otherAmountThreshold:f,sqrtPriceLimit:h,tickArray0:k[0],tickArray1:k[1],tickArray2:k[2]}}},37581:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TickArrayIndex=void 0;const r=n(37917);class i{static fromTickIndex(t,e){const n=Math.floor(Math.floor(t/e)/r.TICK_ARRAY_SIZE);let o=Math.floor(t%(e*r.TICK_ARRAY_SIZE)/e);return o<0&&(o=r.TICK_ARRAY_SIZE+o),new i(n,o,e)}constructor(t,e,n){if(this.arrayIndex=t,this.offsetIndex=e,this.tickSpacing=n,e>=r.TICK_ARRAY_SIZE)throw new Error("Invalid offsetIndex - value has to be smaller than TICK_ARRAY_SIZE");if(e<0)throw new Error("Invalid offsetIndex - value is smaller than 0");if(n<0)throw new Error("Invalid tickSpacing - value is less than 0")}toTickIndex(){return this.arrayIndex*r.TICK_ARRAY_SIZE*this.tickSpacing+this.offsetIndex*this.tickSpacing}toNextInitializableTickIndex(){return i.fromTickIndex(this.toTickIndex()+this.tickSpacing,this.tickSpacing)}toPrevInitializableTickIndex(){return i.fromTickIndex(this.toTickIndex()-this.tickSpacing,this.tickSpacing)}}e.TickArrayIndex=i},6113:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TickArraySequence=void 0;const r=n(37392),i=n(37917),o=n(37581);e.TickArraySequence=class{constructor(t,e,n){if(this.tickSpacing=e,this.aToB=n,!t[0]||!t[0].data)throw new Error("TickArray index 0 must be initialized");this.sequence=[];for(const e of t){if(!e||!e.data)break;this.sequence.push({address:e.address,data:e.data})}this.touchedArrays=[...Array(this.sequence.length).fill(!1)],this.startArrayIndex=o.TickArrayIndex.fromTickIndex(this.sequence[0].data.startTickIndex,this.tickSpacing).arrayIndex}isValidTickArray0(t){const e=this.aToB?0:this.tickSpacing,n=this.sequence[0].data;return this.checkIfIndexIsInTickArrayRange(n.startTickIndex,t+e)}getNumOfTouchedArrays(){return this.touchedArrays.filter((t=>!!t)).length}getTouchedArrays(t){let e=this.touchedArrays.reduce(((t,e,n)=>(e&&t.push(this.sequence[n].address),t)),[]);if(0===e.length)return[];const n=t-e.length;return n>0&&(e=e.concat(Array(n).fill(e[e.length-1]))),e}getTick(t){const e=o.TickArrayIndex.fromTickIndex(t,this.tickSpacing);if(!this.isArrayIndexInBounds(e,this.aToB))throw new Error("Provided tick index is out of bounds for this sequence.");const n=this.getLocalArrayIndex(e.arrayIndex,this.aToB),i=this.sequence[n].data;if(this.touchedArrays[n]=!0,!i)throw new r.WhirlpoolsError(`TickArray at index ${n} is not initialized.`,r.SwapErrorCode.TickArrayIndexNotInitialized);if(!this.checkIfIndexIsInTickArrayRange(i.startTickIndex,t))throw new r.WhirlpoolsError(`TickArray at index ${n} is unexpected for this sequence.`,r.SwapErrorCode.TickArraySequenceInvalid);return i.ticks[e.offsetIndex]}findNextInitializedTickIndex(t){const e=this.aToB?t:t+this.tickSpacing;let n=o.TickArrayIndex.fromTickIndex(e,this.tickSpacing);if(!this.isArrayIndexInBounds(n,this.aToB))throw new r.WhirlpoolsError(`Swap input value traversed too many arrays. Out of bounds at attempt to traverse tick index - ${n.toTickIndex()}.`,r.SwapErrorCode.TickArraySequenceInvalid);for(;this.isArrayIndexInBounds(n,this.aToB);){const t=this.getTick(n.toTickIndex());if(t.initialized)return{nextIndex:n.toTickIndex(),nextTickData:t};n=this.aToB?n.toPrevInitializableTickIndex():n.toNextInitializableTickIndex()}return{nextIndex:Math.max(Math.min(this.aToB?n.toTickIndex()+this.tickSpacing:n.toTickIndex()-1,i.MAX_TICK_INDEX),i.MIN_TICK_INDEX),nextTickData:null}}getLocalArrayIndex(t,e){return e?this.startArrayIndex-t:t-this.startArrayIndex}isArrayIndexInBounds(t,e){const n=this.getLocalArrayIndex(t.arrayIndex,e),r=this.sequence.length;return n>=0&&n=t&&et.whirlpool)),r),c=i.AddressUtil.toPubKey(e),d=t.map((t=>{const{whirlpool:e,tokenAmount:n,tradeTokenMint:r,amountSpecifiedIsInput:a}=t,c=u.get(i.AddressUtil.toString(e)),d=i.AddressUtil.toPubKey(r),l=s.PoolUtil.getTokenType(c,d);return(0,o.default)(!!l,"swapTokenMint does not match any tokens on this pool"),{whirlpoolData:c,tokenAmount:n,aToB:s.SwapUtils.getSwapDirection(c,d,a)===s.SwapDirection.AtoB,tickCurrentIndex:c.tickCurrentIndex,tickSpacing:c.tickSpacing,whirlpoolAddress:i.AddressUtil.toPubKey(e),amountSpecifiedIsInput:a}})),l=await s.SwapUtils.getBatchTickArrays(c,n,d,r);return d.map(((t,e)=>{const{whirlpoolData:n,tokenAmount:r,aToB:i,amountSpecifiedIsInput:o}=t;return{whirlpoolData:n,tokenAmount:r,aToB:i,amountSpecifiedIsInput:o,sqrtPriceLimit:s.SwapUtils.getDefaultSqrtPriceLimit(i),otherAmountThreshold:s.SwapUtils.getDefaultOtherAmountThreshold(o),tickArrays:l[e],tokenExtensionCtx:a.NO_TOKEN_EXTENSION_CONTEXT}}))}},50303:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getBestRoutesFromQuoteMap=void 0;const i=r(n(13550)),o=n(39634);function s(t){const e=t[100];return e?e.filter((t=>1==t.calculatedEdgeQuotes.length)).map((t=>{const e=t.calculatedEdgeQuotes[0];return{quotes:[t],splitPercent:100,totalIn:e.amountIn,totalOut:e.amountOut}})).flatMap((t=>t||[])):[]}function a(t,e,n,r){let s=function(t,e){let n=[];return u(t,e,{quotes:[],splitPercent:0,totalIn:new i.default(0),totalOut:new i.default(0)},n),n}(t,r);const a=c(e);return s.length<=n?s.sort(a):((0,o.kSmallestPartition)(s,n,0,s.length-1,a),s.slice(0,n).sort(a))}function u(t,e,n,r){const{splitPercent:i,quotes:o}=n,s=Object.keys(t).map((t=>Number(t)));for(let a=s.length-1;a>=0;a--){const c=s[a],d=i+c,l=o.length>0&&c>o[o.length-1].splitPercent;if(d>100||l)continue;const h=t[c];for(let i=0;io.some((e=>e.edgesPoolAddrs.some((e=>-1!==e.indexOf(t))))))))continue;const a={quotes:[...o,s],splitPercent:d,totalIn:n.totalIn.add(s.amountIn),totalOut:n.totalOut.add(s.amountOut)},l=h.slice(i+1);100===d?r.push(a):o.length+1!=e&&u({...t,[c]:l},e,a,r)}}}function c(t){return t?d:l}function d(t,e){return e.totalOut.cmp(t.totalOut)}function l(t,e){return t.totalIn.cmp(e.totalIn)}e.getBestRoutesFromQuoteMap=function(t,e,n){const{numTopRoutes:r,maxSplits:i}=n;return[...a(t,e,r,i),...s(t)].sort(c(e)).map((t=>{const{quotes:e,totalIn:n,totalOut:r}=t;return{subRoutes:e.map((t=>function(t){const{calculatedEdgeQuotes:e,path:n,splitPercent:r,amountIn:i,amountOut:o}=t;return{path:n,splitPercent:r,amountIn:i,amountOut:o,hopQuotes:e}}(t))),totalAmountIn:n,totalAmountOut:r}}))}},94138:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(71736),e),i(n(31126),e)},71736:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolRouterBuilder=void 0;const r=n(74808),i=n(68614);e.WhirlpoolRouterBuilder=class{static buildWithPoolGraph(t,e){return new i.WhirlpoolRouterImpl(t,e)}static async buildWithPools(t,e){const n=await r.PoolGraphBuilder.buildPoolGraphWithFetch(e,t.fetcher);return new i.WhirlpoolRouterImpl(t,n)}}},31126:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RouterUtils=void 0;const i=n(66259),o=r(n(13550)),s=r(n(93776)),a=n(37542),u=n(41786),c=n(17759),d=n(74808),l=n(88459);class h{static async selectFirstExecutableRoute(t,e,n){const{wallet:r}=t;if(0===e.length)return null;if(!(0,l.isWalletConnected)(r))return[e[0],void 0];"legacy"!==n.maxSupportedTransactionVersion&&t.lookupTableFetcher&&await async function(t,e){const n=new Set;for(let t=0;tn.add(t.toBase58())))}const r=Array.from(n),o=[];for(let t=0;t{const n=i.AddressUtil.toPubKeys(e);t.loadLookupTables(n)})))}(t.lookupTableFetcher,e);for(let o=0;op)continue;const r=await t.lookupTableFetcher.getLookupTableAccountsForAddresses(e);try{if(d=c.txnSize({latestBlockhash:i.MEASUREMENT_BLOCKHASH,maxSupportedTransactionVersion:n.maxSupportedTransactionVersion,lookupTableAccounts:r}),void 0!==d&&d<=n.maxTransactionSize)return[s,r]}catch(t){}}}return null}static getPriceImpactForRoute(t,e){const{amountSpecifiedIsInput:n}=t,r=e.subRoutes.reduce(((t,e)=>{const r=(n?e.hopQuotes:e.hopQuotes.slice().reverse()).reduce(((t,e,r)=>{const{snapshot:i}=e,{aToB:o,sqrtPrice:s,feeRate:a}=i,u=o?s:d.PriceMath.invertSqrtPriceX64(s);let l;const h=u.mul(u).div(c.U64);if(n){const n=(0===r?e.amountIn:t[r-1]).mul(a.denominator.sub(a.numerator)).div(a.denominator);l=h.mul(n).div(c.U64)}else l=(0===r?e.amountOut:t[r-1]).mul(c.U64).div(h).mul(a.denominator).div(a.denominator.sub(a.numerator));return t.push(l),t}),new Array);return t.add(r[r.length-1])}),new o.default(0)),i=new s.default(r.toString()),a=new s.default(n?e.totalAmountOut.toString():e.totalAmountIn.toString());return(n?i.sub(a).div(i):a.sub(i).div(a)).mul(100)}static getTouchedTickArraysFromRoute(t){const e=new Set;for(const n of t.subRoutes)for(const t of n.hopQuotes)e.add(t.quote.tickArray0.toBase58()),e.add(t.quote.tickArray1.toBase58()),e.add(t.quote.tickArray2.toBase58());return i.AddressUtil.toPubKeys(Array.from(e))}static getDefaultRouteOptions(){return{percentIncrement:20,numTopRoutes:50,numTopPartialQuotes:10,maxSplits:3}}static getDefaultSelectOptions(){return{maxSupportedTransactionVersion:0,maxTransactionSize:i.TX_SIZE_LIMIT}}}e.RouterUtils=h;const f=100,p=50},88359:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getQuoteMap=void 0;const i=n(66259),o=r(n(13550)),s=n(41786),a=n(27122),u=n(74808),c=n(87151);function d(t,e,n){for(const{splitPercent:r,pathIndex:o,quoteIndex:s,edgeIndex:c,request:d}of t){const t=e[s],l=n[r][o];try{const e=(0,a.swapQuoteWithParams)(t,i.Percentage.fromFraction(0,1e3)),{whirlpoolData:n,tokenAmount:r,aToB:o,amountSpecifiedIsInput:s}=t,[h,f,p,m]=[n.tokenMintA.toBase58(),n.tokenMintB.toBase58(),n.tokenVaultA.toBase58(),n.tokenVaultB.toBase58()],[g,y]=o?[h,f]:[f,h];l.calculatedEdgeQuotes[c]={success:!0,amountIn:s?r:e.estimatedAmountIn,amountOut:s?e.estimatedAmountOut:r,whirlpool:d.whirlpool,inputMint:g,outputMint:y,mintA:h,mintB:f,vaultA:p,vaultB:m,quote:e,snapshot:{aToB:t.aToB,sqrtPrice:n.sqrtPrice,feeRate:u.PoolUtil.getFeeRate(n.feeRate)}}}catch(t){const e=t.errorCode;l.calculatedEdgeQuotes[c]={success:!1,error:e};continue}}}function l(t,e,n,r,o,s,a,u){const c=[];for(let d=0;dd.length-1)continue;const f=a?0===s:s===d.length-1,p=i.AddressUtil.toStrings(d.map((t=>t.poolAddress)));f&&(u[l][r]={path:o,splitPercent:l,edgesPoolAddrs:p,calculatedEdgeQuotes:Array(d.length)});const m=u[l][r],g=p[s],y=a?m.calculatedEdgeQuotes[s-1]:m.calculatedEdgeQuotes[s+1];let b,w;if(f)b=h,w=a?t:e;else{if(!y?.success)continue;b=a?y.amountOut:y.amountIn,w=a?y.outputMint:y.inputMint}c.push({splitPercent:l,pathIndex:r,edgeIndex:s,quoteIndex:c.length,request:{whirlpool:g,tradeTokenMint:w,tokenAmount:b,amountSpecifiedIsInput:a}})}}return c}e.getQuoteMap=async function(t,e,n,r,a,u){const{percentIncrement:h,numTopPartialQuotes:f}=u,{tokenIn:p,tokenOut:m,tradeAmount:g}=t,{percents:y,amounts:b}=function(t,e=5){const n=[],r=[];for(let i=1;i<=100/e;i++)n.push(i*e),r.push(t.mul(new o.default(i*e)).div(new o.default(100)));return{percents:n,amounts:r}}(g,h),w=Math.max(...e.map((t=>t.edges.length)),0),_={};let v=Array.from(Array(w).keys());n||(v=v.reverse());try{for(const t of v){const o=l(p,m,e,y,b,t,n,_),u=await(0,c.batchBuildSwapQuoteParams)(o.map((t=>t.request)),i.AddressUtil.toPubKey(r),a,s.PREFER_CACHE);d(o,u,_)}}catch(t){throw t}return function(t,e,n){const r=Object.keys(t).map((t=>Number(t))),i={},o=new Set;for(let e=0;et&&t.success?t:[]));if(s.length===t.length){const[e,o]=[s[0].amountIn,s[s.length-1].amountOut];i[n].push({path:r,splitPercent:n,edgesPoolAddrs:t,amountIn:e,amountOut:o,calculatedEdgeQuotes:s});continue}const a=e.flatMap((t=>t&&!t?.success?t:[]));o.add(a[0].error)}}const s={},a=n?(t,e)=>e.amountOut.cmp(t.amountOut):(t,e)=>t.amountIn.cmp(e.amountIn);for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolRouterImpl=void 0;const r=n(66259),i=n(37392),o=n(37542),s=n(41786),a=n(74808),u=n(50303),c=n(94138),d=n(88359);e.WhirlpoolRouterImpl=class{constructor(t,e){this.ctx=t,this.poolGraph=e}async findAllRoutes(t,e,n){const{tokenIn:o,tokenOut:l,tradeAmount:h,amountSpecifiedIsInput:f}=t,p=this.poolGraph.getPath(o,l);if(0===p.length)return Promise.reject(new i.WhirlpoolsError(`Could not find route for ${o} -> ${l}`,i.RouteQueryErrorCode.RouteDoesNotExist));if(h.isZero())return Promise.reject(new i.WhirlpoolsError("findBestRoutes error - input amount is zero.",i.RouteQueryErrorCode.ZeroInputAmount));const m={...c.RouterUtils.getDefaultRouteOptions(),...e},{program:g,fetcher:y}=this.ctx,b=g.programId;await async function(t,e,n,i=s.PREFER_CACHE){const o=new Set;for(let e=0;et.toBase58())),o=Array.from(new Set(i));d.push(...o)}await n.getTickArrays(d,i)}(p,b,y,n);try{const[e,n]=await(0,d.getQuoteMap)(t,p,f,b,y,m),r=(0,u.getBestRoutesFromQuoteMap)(e,f,m);return 0===r.length&&n.has(i.SwapErrorCode.TickArraySequenceInvalid)?Promise.reject(new i.WhirlpoolsError("All swap quote generation failed on amount too high.",i.RouteQueryErrorCode.TradeAmountTooHigh)):r}catch(t){return Promise.reject(new i.WhirlpoolsError("Stack error received on quote generation.",i.RouteQueryErrorCode.General,t.stack))}}async findBestRoute(t,e,n,r){const i=await this.findAllRoutes(t,e,r),o={...c.RouterUtils.getDefaultSelectOptions(),...n};return await c.RouterUtils.selectFirstExecutableRoute(this.ctx,i,o)}async swap(t,e,n){return await(0,o.getSwapFromRoute)(this.ctx,{route:t,slippage:e,resolvedAtaAccounts:n,wallet:this.ctx.wallet.publicKey},s.IGNORE_CACHE)}}},26168:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WHIRLPOOL_ACCOUNT_SIZE=e.getAccountSize=e.WHIRLPOOL_CODER=e.WHIRLPOOL_IDL=e.AccountName=void 0;const i=n(78845),o=r(n(92220));var s;function a(t){return e.WHIRLPOOL_CODER.size(e.WHIRLPOOL_IDL.accounts.find((e=>e.name===t)))+u[t]}!function(t){t.WhirlpoolsConfig="WhirlpoolsConfig",t.Position="Position",t.TickArray="TickArray",t.Whirlpool="Whirlpool",t.FeeTier="FeeTier",t.PositionBundle="PositionBundle",t.WhirlpoolsConfigExtension="WhirlpoolsConfigExtension",t.TokenBadge="TokenBadge"}(s||(e.AccountName=s={})),e.WHIRLPOOL_IDL=o.default,e.WHIRLPOOL_CODER=new i.BorshAccountsCoder(e.WHIRLPOOL_IDL),e.getAccountSize=a;const u={[s.WhirlpoolsConfig]:2,[s.Position]:0,[s.TickArray]:0,[s.Whirlpool]:0,[s.FeeTier]:0,[s.PositionBundle]:64,[s.WhirlpoolsConfigExtension]:512,[s.TokenBadge]:128};e.WHIRLPOOL_ACCOUNT_SIZE=a(s.Whirlpool)},6273:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},38515:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WHIRLPOOL_NFT_UPDATE_AUTH=e.FEE_RATE_MUL_VALUE=e.PROTOCOL_FEE_RATE_MUL_VALUE=e.MAX_SWAP_TICK_ARRAYS=e.MEMO_PROGRAM_ADDRESS=e.METADATA_PROGRAM_ADDRESS=e.POSITION_BUNDLE_SIZE=e.TICK_ARRAY_SIZE=e.MAX_SQRT_PRICE_BN=e.MIN_SQRT_PRICE_BN=e.MIN_SQRT_PRICE=e.MAX_SQRT_PRICE=e.MIN_TICK_INDEX=e.MAX_TICK_INDEX=e.NUM_REWARDS=e.ORCA_SUPPORTED_TICK_SPACINGS=e.ORCA_WHIRLPOOLS_CONFIG_EXTENSION=e.ORCA_WHIRLPOOLS_CONFIG=e.ORCA_WHIRLPOOL_PROGRAM_ID=void 0;const r=n(78845),i=n(18245);e.ORCA_WHIRLPOOL_PROGRAM_ID=new i.PublicKey("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"),e.ORCA_WHIRLPOOLS_CONFIG=new i.PublicKey("2LecshUwdy9xi7meFgHtFJQNSKk4KdTrcpvaB56dP2NQ"),e.ORCA_WHIRLPOOLS_CONFIG_EXTENSION=new i.PublicKey("777H5H3Tp9U11uRVRzFwM8BinfiakbaLT8vQpeuhvEiH"),e.ORCA_SUPPORTED_TICK_SPACINGS=[1,2,4,8,16,64,128,256],e.NUM_REWARDS=3,e.MAX_TICK_INDEX=443636,e.MIN_TICK_INDEX=-443636,e.MAX_SQRT_PRICE="79226673515401279992447579055",e.MIN_SQRT_PRICE="4295048016",e.MIN_SQRT_PRICE_BN=new r.BN(e.MIN_SQRT_PRICE),e.MAX_SQRT_PRICE_BN=new r.BN(e.MAX_SQRT_PRICE),e.TICK_ARRAY_SIZE=88,e.POSITION_BUNDLE_SIZE=256,e.METADATA_PROGRAM_ADDRESS=new i.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),e.MEMO_PROGRAM_ADDRESS=new i.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),e.MAX_SWAP_TICK_ARRAYS=3,e.PROTOCOL_FEE_RATE_MUL_VALUE=new r.BN(1e4),e.FEE_RATE_MUL_VALUE=new r.BN(1e6),e.WHIRLPOOL_NFT_UPDATE_AUTH=new i.PublicKey("3axbTs2z5GBy6usVbNVoqEgZMng3vZvMnAoX29BFfwhr")},37917:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(26168),e),i(n(6273),e),i(n(38515),e),i(n(15438),e)},15438:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},48231:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTickArrayDataForPosition=void 0;const r=n(74808);e.getTickArrayDataForPosition=async function(t,e,n,i){const o=r.PDAUtil.getTickArrayFromTickIndex(e.tickLowerIndex,n.tickSpacing,e.whirlpool,t.program.programId).publicKey,s=r.PDAUtil.getTickArrayFromTickIndex(e.tickUpperIndex,n.tickSpacing,e.whirlpool,t.program.programId).publicKey;return await t.fetcher.getTickArrays([o,s],i)}},47178:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TOKEN_MINTS=void 0,e.TOKEN_MINTS={USDC:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",SOL:"So11111111111111111111111111111111111111112",USDT:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",USDH:"USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX",mSOL:"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",stSOL:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"}},45342:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AdjacencyListPoolGraph=void 0;const r=n(66259),i=n(6897);function o(t,e){return(e?t.slice().reverse():t).map((t=>({poolAddress:t})))}function s(t,e,n){const r={};return t.forEach((([t,i])=>{let o=[];const[s,u]=[t,i].sort(),c=a(s,u,!1),d=e[s]||[],l=e[u]||[];if(r[c])return;const h=d.filter((({address:t})=>l.some((e=>e.address===t)))).map((t=>[t.address]));o.push(...h),d.filter((({address:t})=>!l.some((e=>e.address===t)))).forEach((t=>{const e=t.otherToken;if(!n||n.indexOf(e)>-1){const n=l.filter((t=>t.otherToken===e)).map((e=>[t.address,e.address]));o.push(...n)}})),o.length>0&&(r[c]=o)})),r}function a(t,e,n=!0){const o=[r.AddressUtil.toString(t),r.AddressUtil.toString(e)],s=n?o.sort():o;return`${s[0]}${i.PoolGraphUtils.PATH_ID_DELIMITER}${s[1]}`}e.AdjacencyListPoolGraph=class{constructor(t){const[e,n]=function(t){const e={},n=new Set;return[t.reduce(((t,i)=>{const{address:o,tokenMintA:s,tokenMintB:a}=i,[u,c,d]=r.AddressUtil.toStrings([o,s,a]);n.add(c),n.add(d),void 0===t[c]&&(t[c]=[],e[c]=new Set),void 0===t[d]&&(t[d]=[],e[d]=new Set);const[l,h]=[e[c],e[d]];return l.has(u)||(t[c].push({address:u,otherToken:d}),l.add(u)),h.has(u)||(t[d].push({address:u,otherToken:c}),h.add(u)),t}),{}),n]}(t);this.graph=e,this.tokens=Array.from(n)}getPath(t,e,n){return this.getPathsForPairs([[t,e]],n)[0][1]}getPathsForPairs(t,e){const n=t.map((([t,e])=>[r.AddressUtil.toString(t),r.AddressUtil.toString(e)])),u=s(n.filter((([t,e])=>t!==e)),this.graph,e?.intermediateTokens.map((t=>r.AddressUtil.toString(t))));return n.map((([t,e])=>{const n=i.PoolGraphUtils.getSearchPathId(t,e),[r,s]=[t,e].sort(),c=a(r,s,!1),d=r!==t,l=u[c];return[n,l?l.map((n=>({startTokenMint:t,endTokenMint:e,edges:o(n,d)}))):[]]}))}getAllPaths(t){const e=function(t){const e=[];for(let n=0;n[t,e])),n=s(e.filter((([t,e])=>t!==e)),this.graph,t?.intermediateTokens.map((t=>r.AddressUtil.toString(t))));return e.reduce(((t,[e,r])=>{const s=i.PoolGraphUtils.getSearchPathId(e,r);if(e===r)return t.push([s,[]]),t;const[u,c]=[e,r].sort(),d=a(u,c,!1),l=u!==e,h=n[d],f=h?h.map((t=>({startTokenMint:e,endTokenMint:r,edges:o(t,l)}))):[];t.push([s,f]);const p=i.PoolGraphUtils.getSearchPathId(r,e),m=h?h.map((t=>({startTokenMint:r,endTokenMint:e,edges:o(t,!l)}))):[];return t.push([p,m]),t}),[])}}},75635:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(11740),e),i(n(32315),e),i(n(6897),e)},32315:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PoolGraphBuilder=void 0;const r=n(41786),i=n(45342);e.PoolGraphBuilder=class{static async buildPoolGraphWithFetch(t,e){const n=await e.getPools(t,r.PREFER_CACHE),o=Array.from(n.entries()).map((([t,e])=>e?{address:t,tokenMintA:e.tokenMintA,tokenMintB:e.tokenMintB}:null)).flatMap((t=>t||[]));return new i.AdjacencyListPoolGraph(o)}static buildPoolGraph(t){return new i.AdjacencyListPoolGraph(t)}}},6897:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PoolGraphUtils=void 0;const r=n(66259);class i{static getSearchPathId(t,e){return`${r.AddressUtil.toString(t)}${i.PATH_ID_DELIMITER}${r.AddressUtil.toString(e)}`}static deconstructPathId(t){const e=t.split(i.PATH_ID_DELIMITER);if(2!==e.length)throw new Error(`Invalid path id: ${t}`);const[n,r]=e;return[n,r]}}e.PoolGraphUtils=i,i.PATH_ID_DELIMITER="-"},11740:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},70706:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.openPositionAccounts=void 0;const s=o(n(78845)),a=n(29955),u=n(18245);e.openPositionAccounts=function(t){const{funder:e,owner:n,positionPda:r,positionMintAddress:i,positionTokenAccount:o,whirlpool:c}=t;return{funder:e,owner:n,position:r.publicKey,positionMint:i,positionTokenAccount:o,whirlpool:c,tokenProgram:a.TOKEN_PROGRAM_ID,systemProgram:u.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY,associatedTokenProgram:a.ASSOCIATED_TOKEN_PROGRAM_ID}}},60816:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BitMath=void 0;const r=n(78845),i=n(66259),o=n(37392);e.BitMath=class{static mul(t,e,n){const r=t.mul(e);if(this.isOverLimit(r,n))throw new o.WhirlpoolsError(`Mul result higher than u${n}`,o.MathErrorCode.MultiplicationOverflow);return r}static mulDiv(t,e,n,r){return this.mulDivRoundUpIf(t,e,n,!1,r)}static mulDivRoundUp(t,e,n,r){return this.mulDivRoundUpIf(t,e,n,!0,r)}static mulDivRoundUpIf(t,e,n,r,s){if(n.eq(i.ZERO))throw new o.WhirlpoolsError("mulDiv denominator is zero",o.MathErrorCode.DivideByZero);const a=this.mul(t,e,s),u=a.div(n);return r&&a.mod(n).gt(i.ZERO)?u.add(i.ONE):u}static checked_mul_shift_right(t,e,n){return this.checked_mul_shift_right_round_up_if(t,e,!1,n)}static checked_mul_shift_right_round_up_if(t,e,n,r){if(t.eq(i.ZERO)||e.eq(i.ZERO))return i.ZERO;const s=this.mul(t,e,r);if(this.isOverLimit(s,r))throw new o.WhirlpoolsError(`MulShiftRight overflowed u${r}.`,o.MathErrorCode.MultiplicationShiftRightOverflow);const a=i.MathUtil.fromX64_BN(s),u=n&&a.and(i.U64_MAX).gt(i.ZERO);if(u&&a.eq(i.U64_MAX))throw new o.WhirlpoolsError(`MulShiftRight overflowed u${r}.`,o.MathErrorCode.MultiplicationOverflow);return u?a.add(i.ONE):a}static isOverLimit(t,e){const n=i.TWO.pow(new r.BN(e)).sub(i.ONE);return t.gt(n)}static divRoundUp(t,e){return this.divRoundUpIf(t,e,!0)}static divRoundUpIf(t,e,n){if(e.eq(i.ZERO))throw new o.WhirlpoolsError("divRoundUpIf - divide by zero",o.MathErrorCode.DivideByZero);let r=t.div(e);return n&&t.mod(e).gt(i.ZERO)?r.add(i.ONE):r}}},17759:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.U64=void 0;const r=n(66259);e.U64=r.U64_MAX.add(r.ONE)},39634:(t,e)=>{"use strict";function n(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function r(t,e){return te?1:0}Object.defineProperty(e,"__esModule",{value:!0}),e.kSmallestPartition=void 0,e.kSmallestPartition=function t(e,i,o=0,s=e.length-1,a=r){for(;s>o;){if(s-o>600){const n=s-o+1,r=i-o+1,u=Math.log(n),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(n-c)/n)*(r-n/2<0?-1:1);t(e,i,Math.max(o,Math.floor(i-r*c/n+d)),Math.min(s,Math.floor(i+(n-r)*c/n+d)),a)}const r=e[i];let u=o,c=s;for(n(e,o,i),a(e[s],r)>0&&n(e,o,s);u0;)c--}0===a(e[o],r)?n(e,o,c):(c++,n(e,c,s)),c<=i&&(o=c+1),i<=c&&(s=c-1)}}},1922:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.computeSwapStep=void 0;const i=r(n(13550)),o=n(37917),s=n(60816),a=n(73936);function u(t,e,n,r,i){return i===r?(0,a.getAmountDeltaA)(t,e,n,r):(0,a.getAmountDeltaB)(t,e,n,r)}e.computeSwapStep=function(t,e,n,r,c,d,l){let h=u(r,c,n,d,l),f=t;d&&(f=s.BitMath.mulDiv(t,o.FEE_RATE_MUL_VALUE.sub(new i.default(e)),o.FEE_RATE_MUL_VALUE,128));let p=f.gte(h)?c:(0,a.getNextSqrtPrice)(r,n,f,d,l),m=p.eq(c),g=function(t,e,n,r,i){return i===r?(0,a.getAmountDeltaB)(t,e,n,!r):(0,a.getAmountDeltaA)(t,e,n,!r)}(r,p,n,d,l);m||(h=u(r,p,n,d,l));let y,b=d?h:g,w=d?g:h;if(!d&&w.gt(t)&&(w=t),d&&!m)y=t.sub(b);else{const t=new i.default(e);y=s.BitMath.mulDivRoundUp(b,t,o.FEE_RATE_MUL_VALUE.sub(t),128)}return{amountIn:b,amountOut:w,nextPrice:p,feeAmount:y}}},73936:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.adjustForSlippage=e.getNextSqrtPrice=e.getAmountDeltaB=e.getAmountDeltaA=void 0;const i=n(66259),o=r(n(13550)),s=n(37392),a=n(37917),u=n(60816);function c(t,e){return t.gt(e)?[e,t]:[t,e]}e.getAmountDeltaA=function(t,e,n,r){let[a,u]=c(t,e),d=u.sub(a),l=n.mul(d).shln(64),h=a.mul(u),f=l.div(h),p=l.mod(h),m=r&&!p.eq(i.ZERO)?f.add(new o.default(1)):f;if(m.gt(i.U64_MAX))throw new s.WhirlpoolsError("Results larger than U64",s.TokenErrorCode.TokenMaxExceeded);return m},e.getAmountDeltaB=function(t,e,n,r){let[i,o]=c(t,e),s=o.sub(i);return u.BitMath.checked_mul_shift_right_round_up_if(n,s,r,128)},e.getNextSqrtPrice=function(t,e,n,r,c){return r===c?function(t,e,n,r){if(n.eq(i.ZERO))return t;let c=u.BitMath.mul(t,n,256),d=u.BitMath.mul(e,t,256).shln(64);if(u.BitMath.isOverLimit(d,256))throw new s.WhirlpoolsError("getNextSqrtPriceFromARoundUp - numerator overflow u256",s.MathErrorCode.MultiplicationOverflow);let l=e.shln(64);if(!r&&l.lte(c))throw new s.WhirlpoolsError("getNextSqrtPriceFromARoundUp - Unable to divide currLiquidityX64 by product",s.MathErrorCode.DivideByZero);let h=r?l.add(c):l.sub(c),f=u.BitMath.divRoundUp(d,h);if(f.lt(new o.default(a.MIN_SQRT_PRICE)))throw new s.WhirlpoolsError("getNextSqrtPriceFromARoundUp - price less than min sqrt price",s.TokenErrorCode.TokenMinSubceeded);if(f.gt(new o.default(a.MAX_SQRT_PRICE)))throw new s.WhirlpoolsError("getNextSqrtPriceFromARoundUp - price less than max sqrt price",s.TokenErrorCode.TokenMaxExceeded);return f}(t,e,n,r):function(t,e,n,r){let i=n.shln(64),o=u.BitMath.divRoundUpIf(i,e,!r);return t=r?t.add(o):t.sub(o)}(t,e,n,r)},e.adjustForSlippage=function(t,{numerator:e,denominator:n},r){return r?t.mul(n.add(e)).div(n):t.mul(n).div(n.add(e))}},79468:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTokenBFromLiquidity=e.getTokenAFromLiquidity=e.getNextSqrtPrice=e.getAmountUnfixedDelta=e.getAmountFixedDelta=e.getLiquidityFromTokenB=e.getLiquidityFromTokenA=e.adjustAmountForSlippage=e.adjustForSlippage=e.PositionUtil=e.PositionStatus=e.AmountSpecified=e.SwapDirection=void 0;const r=n(66259),i=n(74808),o=n(99576);var s,a,u;function c(t,e,n,i){const[o,s]=l(e,n),a=t.mul(s.sub(o)).shln(64),u=s.mul(o);return i?r.MathUtil.divRoundUp(a,u):a.div(u)}function d(t,e,n,i){const[o,s]=l(e,n),a=t.mul(s.sub(o));return i?r.MathUtil.shiftRightRoundUp(a):a.shrn(64)}function l(t,e){return t.lt(e)?[t,e]:[e,t]}!function(t){t.AtoB="Swap A to B",t.BtoA="Swap B to A"}(s||(e.SwapDirection=s={})),function(t){t.Input="Specified input amount",t.Output="Specified output amount"}(a||(e.AmountSpecified=a={})),function(t){t[t.BelowRange=0]="BelowRange",t[t.InRange=1]="InRange",t[t.AboveRange=2]="AboveRange"}(u||(e.PositionStatus=u={})),e.PositionUtil=class{constructor(){}static getPositionStatus(t,e,n){return t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.toTx=void 0;const r=n(66259);e.toTx=function(t,e){return new r.TransactionBuilder(t.provider.connection,t.provider.wallet,t.txBuilderOpts).addInstruction(e)}},9471:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.PDAUtil=void 0;const i=n(78845),o=n(66259),s=n(37917),a=n(24018),u=n(33689),c="metadata";class d{static getWhirlpool(t,e,n,s,a){return o.AddressUtil.findProgramAddress([r.from("whirlpool"),e.toBuffer(),n.toBuffer(),s.toBuffer(),new i.BN(a).toArrayLike(r,"le",2)],t)}static getPosition(t,e){return o.AddressUtil.findProgramAddress([r.from("position"),e.toBuffer()],t)}static getPositionMetadata(t){return o.AddressUtil.findProgramAddress([r.from(c),s.METADATA_PROGRAM_ADDRESS.toBuffer(),t.toBuffer()],s.METADATA_PROGRAM_ADDRESS)}static getTickArray(t,e,n){return o.AddressUtil.findProgramAddress([r.from("tick_array"),e.toBuffer(),r.from(n.toString())],t)}static getTickArrayFromTickIndex(t,e,n,r,i=0){const s=u.TickUtil.getStartTickIndex(t,e,i);return d.getTickArray(o.AddressUtil.toPubKey(r),o.AddressUtil.toPubKey(n),s)}static getTickArrayFromSqrtPrice(t,e,n,r,i=0){const o=a.PriceMath.sqrtPriceX64ToTickIndex(t);return d.getTickArrayFromTickIndex(o,e,n,r,i)}static getFeeTier(t,e,n){return o.AddressUtil.findProgramAddress([r.from("fee_tier"),e.toBuffer(),new i.BN(n).toArrayLike(r,"le",2)],t)}static getOracle(t,e){return o.AddressUtil.findProgramAddress([r.from("oracle"),e.toBuffer()],t)}static getBundledPosition(t,e,n){return o.AddressUtil.findProgramAddress([r.from("bundled_position"),e.toBuffer(),r.from(n.toString())],t)}static getPositionBundle(t,e){return o.AddressUtil.findProgramAddress([r.from("position_bundle"),e.toBuffer()],t)}static getPositionBundleMetadata(t){return o.AddressUtil.findProgramAddress([r.from(c),s.METADATA_PROGRAM_ADDRESS.toBuffer(),t.toBuffer()],s.METADATA_PROGRAM_ADDRESS)}static getConfigExtension(t,e){return o.AddressUtil.findProgramAddress([r.from("config_extension"),e.toBuffer()],t)}static getTokenBadge(t,e,n){return o.AddressUtil.findProgramAddress([r.from("token_badge"),e.toBuffer(),n.toBuffer()],t)}}e.PDAUtil=d},1128:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTokenAmount=e.PoolUtil=void 0;const o=n(66259),s=n(18245),a=i(n(13550)),u=i(n(93776)),c=n(47178),d=n(24018),l=n(11603),h=n(40273),f=i(n(26018)),p=n(29955);e.PoolUtil=class{constructor(){}static isRewardInitialized(t){return!s.PublicKey.default.equals(t.mint)&&!s.PublicKey.default.equals(t.vault)}static getTokenType(t,e){return t.tokenMintA.equals(e)?l.TokenType.TokenA:t.tokenMintB.equals(e)?l.TokenType.TokenB:void 0}static getFeeRate(t){return o.Percentage.fromFraction(t,1e6)}static getProtocolFeeRate(t){return o.Percentage.fromFraction(t,1e4)}static orderMints(t,e){return this.compareMints(t,e)<0?[t,e]:[e,t]}static compareMints(t,e){return r.compare(o.AddressUtil.toPubKey(t).toBuffer(),o.AddressUtil.toPubKey(e).toBuffer())}static getTokenAmountsFromLiquidity(t,e,n,r,i){const s=new u.default(t.toString()),c=new u.default(e.toString()),d=new u.default(n.toString()),l=new u.default(r.toString());let h,f;return e.lt(n)?(h=o.MathUtil.toX64_Decimal(s).mul(l.sub(d)).div(d.mul(l)),f=new u.default(0)):e.lt(r)?(h=o.MathUtil.toX64_Decimal(s).mul(l.sub(c)).div(c.mul(l)),f=o.MathUtil.fromX64_Decimal(s.mul(c.sub(d)))):(h=new u.default(0),f=o.MathUtil.fromX64_Decimal(s.mul(l.sub(d)))),i?{tokenA:new a.default(h.ceil().toString()),tokenB:new a.default(f.ceil().toString())}:{tokenA:new a.default(h.floor().toString()),tokenB:new a.default(f.floor().toString())}}static estimateLiquidityFromTokenAmounts(t,e,n,r){if(n=n)return _(s,o,r.tokenB);if(t=0&&t{t&&e.push(n)})),e}static getUnoccupiedBundleIndexes(t){const e=[];return s.convertBitmapToArray(t).forEach(((t,n)=>{t||e.push(n)})),e}static findUnoccupiedBundleIndex(t){const e=s.getUnoccupiedBundleIndexes(t);return 0===e.length?null:e[0]}static convertBitmapToArray(t){const e=[];return t.positionBitmap.map((t=>{for(let n=0;n<8;n++)e.push(0!=(t&1<0?new i.BN(function(t){let e;return e=0!=(1&t)?new i.BN("79232123823359799118286999567"):new i.BN("79228162514264337593543950336"),0!=(2&t)&&(e=d(e.mul(new i.BN("79236085330515764027303304731")),96,256)),0!=(4&t)&&(e=d(e.mul(new i.BN("79244008939048815603706035061")),96,256)),0!=(8&t)&&(e=d(e.mul(new i.BN("79259858533276714757314932305")),96,256)),0!=(16&t)&&(e=d(e.mul(new i.BN("79291567232598584799939703904")),96,256)),0!=(32&t)&&(e=d(e.mul(new i.BN("79355022692464371645785046466")),96,256)),0!=(64&t)&&(e=d(e.mul(new i.BN("79482085999252804386437311141")),96,256)),0!=(128&t)&&(e=d(e.mul(new i.BN("79736823300114093921829183326")),96,256)),0!=(256&t)&&(e=d(e.mul(new i.BN("80248749790819932309965073892")),96,256)),0!=(512&t)&&(e=d(e.mul(new i.BN("81282483887344747381513967011")),96,256)),0!=(1024&t)&&(e=d(e.mul(new i.BN("83390072131320151908154831281")),96,256)),0!=(2048&t)&&(e=d(e.mul(new i.BN("87770609709833776024991924138")),96,256)),0!=(4096&t)&&(e=d(e.mul(new i.BN("97234110755111693312479820773")),96,256)),0!=(8192&t)&&(e=d(e.mul(new i.BN("119332217159966728226237229890")),96,256)),0!=(16384&t)&&(e=d(e.mul(new i.BN("179736315981702064433883588727")),96,256)),0!=(32768&t)&&(e=d(e.mul(new i.BN("407748233172238350107850275304")),96,256)),0!=(65536&t)&&(e=d(e.mul(new i.BN("2098478828474011932436660412517")),96,256)),0!=(131072&t)&&(e=d(e.mul(new i.BN("55581415166113811149459800483533")),96,256)),0!=(262144&t)&&(e=d(e.mul(new i.BN("38992368544603139932233054999993551")),96,256)),d(e,32,256)}(t)):new i.BN(function(t){let e,n=Math.abs(t);return e=0!=(1&n)?new i.BN("18445821805675392311"):new i.BN("18446744073709551616"),0!=(2&n)&&(e=d(e.mul(new i.BN("18444899583751176498")),64,256)),0!=(4&n)&&(e=d(e.mul(new i.BN("18443055278223354162")),64,256)),0!=(8&n)&&(e=d(e.mul(new i.BN("18439367220385604838")),64,256)),0!=(16&n)&&(e=d(e.mul(new i.BN("18431993317065449817")),64,256)),0!=(32&n)&&(e=d(e.mul(new i.BN("18417254355718160513")),64,256)),0!=(64&n)&&(e=d(e.mul(new i.BN("18387811781193591352")),64,256)),0!=(128&n)&&(e=d(e.mul(new i.BN("18329067761203520168")),64,256)),0!=(256&n)&&(e=d(e.mul(new i.BN("18212142134806087854")),64,256)),0!=(512&n)&&(e=d(e.mul(new i.BN("17980523815641551639")),64,256)),0!=(1024&n)&&(e=d(e.mul(new i.BN("17526086738831147013")),64,256)),0!=(2048&n)&&(e=d(e.mul(new i.BN("16651378430235024244")),64,256)),0!=(4096&n)&&(e=d(e.mul(new i.BN("15030750278693429944")),64,256)),0!=(8192&n)&&(e=d(e.mul(new i.BN("12247334978882834399")),64,256)),0!=(16384&n)&&(e=d(e.mul(new i.BN("8131365268884726200")),64,256)),0!=(32768&n)&&(e=d(e.mul(new i.BN("3584323654723342297")),64,256)),0!=(65536&n)&&(e=d(e.mul(new i.BN("696457651847595233")),64,256)),0!=(131072&n)&&(e=d(e.mul(new i.BN("26294789957452057")),64,256)),0!=(262144&n)&&(e=d(e.mul(new i.BN("37481735321082")),64,256)),e}(t))}static sqrtPriceX64ToTickIndex(t){if(t.gt(new i.BN(a.MAX_SQRT_PRICE))||t.lt(new i.BN(a.MIN_SQRT_PRICE)))throw new Error("Provided sqrtPrice is not within the supported sqrtPrice range.");const e=t.bitLength()-1,n=function(t,e,n){let r=t.toTwos(128).shln(32);return r.imaskn(129),r.fromTwos(128)}(new i.BN(e-64));let r=new i.BN("8000000000000000","hex"),o=0,s=new i.BN(0),u=e>=64?t.shrn(e-63):t.shln(63-e);for(;r.gt(new i.BN(0))&&o<14;){u=u.mul(u);let t=u.shrn(127);u=u.shrn(63+t.toNumber()),s=s.add(r.mul(t)),r=r.shrn(1),o+=1}const l=s.shrn(32),h=n.add(l).mul(new i.BN("59543866431248")),f=d(h.sub(new i.BN("184467440737095516")),64,128).toNumber(),p=d(h.add(new i.BN("15793534762490258745")),64,128).toNumber();return f==p?f:c.tickIndexToSqrtPriceX64(p).lte(t)?p:f}static tickIndexToPrice(t,e,n){return c.sqrtPriceX64ToPrice(c.tickIndexToSqrtPriceX64(t),e,n)}static priceToTickIndex(t,e,n){return c.sqrtPriceX64ToTickIndex(c.priceToSqrtPriceX64(t,e,n))}static priceToInitializableTickIndex(t,e,n,r){return u.TickUtil.getInitializableTickIndex(c.priceToTickIndex(t,e,n),r)}static invertPrice(t,e,n){const r=c.priceToTickIndex(t,e,n),i=u.TickUtil.invertTick(r);return c.tickIndexToPrice(i,n,e)}static invertSqrtPriceX64(t){const e=c.sqrtPriceX64ToTickIndex(t),n=u.TickUtil.invertTick(e);return c.tickIndexToSqrtPriceX64(n)}static getSlippageBoundForSqrtPrice(t,e){const n=o.DecimalUtil.fromBN(t),r=new s.default(e.numerator.toString()),u=new s.default(e.denominator.toString()),d=n.mul(u.sub(r).sqrt()).div(u.sqrt()).toDecimalPlaces(0),l=n.mul(u.add(r).sqrt()).div(u.sqrt()).toDecimalPlaces(0),h=i.BN.min(i.BN.max(new i.BN(d.toString()),a.MIN_SQRT_PRICE_BN),a.MAX_SQRT_PRICE_BN),f=i.BN.min(i.BN.max(new i.BN(l.toString()),a.MIN_SQRT_PRICE_BN),a.MAX_SQRT_PRICE_BN);return{lowerBound:[h,c.sqrtPriceX64ToTickIndex(h)],upperBound:[f,c.sqrtPriceX64ToTickIndex(f)]}}}function d(t,e,n){let r=t.toTwos(n).shrn(e);return r.imaskn(n-e+1),r.fromTwos(n-e)}e.PriceMath=c},81444:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SwapUtils=void 0;const i=n(66259),o=r(n(13550)),s=n(37917),a=n(73936),u=n(9471),c=n(1128),d=n(33689),l=n(11603);class h{static getDefaultSqrtPriceLimit(t){return new o.default(t?s.MIN_SQRT_PRICE:s.MAX_SQRT_PRICE)}static getDefaultOtherAmountThreshold(t){return t?i.ZERO:i.U64_MAX}static getSwapDirection(t,e,n){const r=c.PoolUtil.getTokenType(t,e);if(r)return r===l.TokenType.TokenA===n?l.SwapDirection.AtoB:l.SwapDirection.BtoA}static getTickArrayPublicKeys(t,e,n,r,i){const o=n?0:e;let a=0,c=[];for(let l=0;l{const[e,n]=t,r=i.slice(e,n),o=s.slice(e,n);return r.map(((t,e)=>({address:t,data:o[e]})))}))}static calculateSwapAmountsFromQuote(t,e,n,r,i){return i?{amount:t,otherAmountThreshold:(0,a.adjustForSlippage)(n,r,!1)}:{amount:t,otherAmountThreshold:(0,a.adjustForSlippage)(e,r,!0)}}static getSwapParamsFromQuote(t,e,n,r,i,o){const s=n.getData();return this.getSwapParamsFromQuoteKeys(t,e,n.getAddress(),s.tokenVaultA,s.tokenVaultB,r,i,o)}static getSwapParamsFromQuoteKeys(t,e,n,r,o,s,a,c){const d=t.aToB,[l,h]=i.AddressUtil.toPubKeys([s,a]);return{whirlpool:n,tokenOwnerAccountA:d?l:h,tokenOwnerAccountB:d?h:l,tokenVaultA:r,tokenVaultB:o,oracle:u.PDAUtil.getOracle(e.program.programId,n).publicKey,tokenAuthority:c,...t}}}e.SwapUtils=h},33689:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TickArrayUtil=e.TickUtil=void 0;const i=n(66259),o=r(n(26018)),s=n(37917),a=n(9471);var u;!function(t){t[t.Left=0]="Left",t[t.Right=1]="Right"}(u||(u={}));class c{constructor(){}static getOffsetIndex(t,e,n){return Math.floor((t-e)/n)}static getStartTickIndex(t,e,n=0){const r=(Math.floor(t/e/s.TICK_ARRAY_SIZE)+n)*e*s.TICK_ARRAY_SIZE,i=s.TICK_ARRAY_SIZE*e,a=s.MIN_TICK_INDEX-(s.MIN_TICK_INDEX%i+i);return(0,o.default)(r>=a,`startTickIndex is too small - - ${r}`),(0,o.default)(r<=s.MAX_TICK_INDEX,`startTickIndex is too large - ${r}`),r}static getInitializableTickIndex(t,e){return t-t%e}static getNextInitializableTickIndex(t,e){return c.getInitializableTickIndex(t,e)+e}static getPrevInitializableTickIndex(t,e){return c.getInitializableTickIndex(t,e)-e}static findPreviousInitializedTickIndex(t,e,n){return c.findInitializedTick(t,e,n,u.Left)}static findNextInitializedTickIndex(t,e,n){return c.findInitializedTick(t,e,n,u.Right)}static findInitializedTick(t,e,n,r){const i=l(t.startTickIndex,e,n),o=r===u.Right?1:-1;let s=r===u.Right?i+o:i;for(;s>=0&&s=s.MIN_TICK_INDEX}static isTickInitializable(t,e){return t%e==0}static invertTick(t){return-t}static getFullRangeTickIndex(t){return[Math.ceil(s.MIN_TICK_INDEX/t)*t,Math.floor(s.MAX_TICK_INDEX/t)*t]}static isFullRange(t,e,n){const[r,i]=c.getFullRangeTickIndex(t);return e===r&&n===i}}e.TickUtil=c;class d{static getTickFromArray(t,e,n){const r=l(t.startTickIndex,e,n),i=t.ticks[r];return(0,o.default)(!!i,`tick realIndex out of range - start - ${t.startTickIndex} index - ${e}, realIndex - ${r}`),i}static getTickArrayPDAs(t,e,n,r,i,o){let s=[...Array(n).keys()];return o&&(s=s.map((t=>-t))),s.map((n=>{const o=c.getStartTickIndex(t,e,n);return a.PDAUtil.getTickArray(r,i,o)}))}static async getUninitializedArraysString(t,e,n){const r=i.AddressUtil.toPubKeys(t),o=await e.getTickArrays(r,n);if(o){const t=d.getUninitializedArrays(o);if(t.length>0)return t.map((t=>r[t].toBase58())).join(", ")}return null}static async getUninitializedArraysPDAs(t,e,n,r,i,o){const s=t.map((t=>c.getStartTickIndex(t,r))),u=[...new Set(s)],l=u.map((t=>a.PDAUtil.getTickArray(e,n,t))),h=await i.getTickArrays(l.map((t=>t.publicKey)),o);return d.getUninitializedArrays(h).map((t=>({startIndex:u[t],pda:l[t]})))}static getUninitializedArrays(t){return t.map(((t,e)=>t?-1:e)).filter((t=>t>=0))}}function l(t,e,n){return Math.floor((e-t)/n)}function h(t,e,n){return t+e*n}e.TickArrayUtil=d},93018:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TokenExtensionUtil=e.NO_TOKEN_EXTENSION_CONTEXT=void 0;const o=n(29955),s=i(n(13550)),a=n(66259),u=n(40273),c=n(18245),d=n(6378),l={address:c.PublicKey.default,decimals:0,freezeAuthority:null,mintAuthority:null,isInitialized:!0,supply:0n,tlvData:r.from([]),tokenProgram:d.TOKEN_PROGRAM_ID};e.NO_TOKEN_EXTENSION_CONTEXT={currentEpoch:0,tokenMintWithProgramA:l,tokenMintWithProgramB:l,rewardTokenMintsWithProgram:[l,l,l]},e.TokenExtensionUtil=class{static calculateTransferFeeIncludedAmount(t,e,n){const r=(0,o.getTransferFeeConfig)(e);return null===r?{isFeeIncludedAmount:!0,amount:t,fee:a.ZERO}:function(t,e){const n=1e4,r=new s.default(t.maximumFee.toString());if(0===t.transferFeeBasisPoints)return{isFeeIncludedAmount:!0,amount:e,fee:a.ZERO};if(e.isZero())return{isFeeIncludedAmount:!0,amount:e,fee:a.ZERO};if(t.transferFeeBasisPoints===n){if(e.add(r).gt(a.U64_MAX))throw new Error("The total amount and fees overflow");return{isFeeIncludedAmount:!0,amount:e.add(r),fee:r}}const i=function(t,e){return t.add(e.subn(1)).div(e)}(e.muln(n),new s.default(n-t.transferFeeBasisPoints)),o=i.sub(e).gte(r)?{amount:e.add(r),fee:r}:{amount:i,fee:i.sub(e)};if(o.amount.gt(a.U64_MAX))throw new Error("The total amount and fees overflow");return{...o,isFeeIncludedAmount:!0}}((0,o.getEpochFee)(r,BigInt(n)),t)}static calculateTransferFeeExcludedAmount(t,e,n){const r=(0,o.getTransferFeeConfig)(e);return null===r?{isFeeIncludedAmount:!1,amount:t,fee:a.ZERO}:function(t,e){const n=(0,o.calculateFee)(t,BigInt(e.toString())),r=new s.default(n.toString());return{isFeeIncludedAmount:!1,amount:e.sub(r),fee:r}}((0,o.getEpochFee)(r,BigInt(n)),t)}static async buildTokenExtensionContext(t,e,n){const r=e.tokenMintA,i=e.tokenMintB,o=e.rewardInfos,[s,a]=await Promise.all([t.getMintInfos([r,i,...o.filter((t=>u.PoolUtil.isRewardInitialized(t))).map((t=>t.mint))],n),t.getEpoch()]),c=t=>s.get(t.toBase58());return{tokenMintWithProgramA:c(e.tokenMintA),tokenMintWithProgramB:c(e.tokenMintB),rewardTokenMintsWithProgram:[u.PoolUtil.isRewardInitialized(o[0])?c(o[0].mint):null,u.PoolUtil.isRewardInitialized(o[1])?c(o[1].mint):null,u.PoolUtil.isRewardInitialized(o[2])?c(o[2].mint):null],currentEpoch:a}}static async getExtraAccountMetasForTransferHook(t,e,n,r,i){const s=(0,o.getTransferHook)(e);if(!s)return;const a=new c.TransactionInstruction({programId:o.TOKEN_2022_PROGRAM_ID,keys:[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:e.address,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1}]});await(0,o.addExtraAccountMetasForExecute)(t,a,s.programId,n,e.address,r,i,0n,"confirmed");const u=a.keys.slice(5);return u.length>0?u:void 0}static isV2IxRequiredPool(t){return!!t.tokenMintWithProgramA.tokenProgram.equals(o.TOKEN_2022_PROGRAM_ID)||!!t.tokenMintWithProgramB.tokenProgram.equals(o.TOKEN_2022_PROGRAM_ID)}static isV2IxRequiredReward(t,e){return t.rewardTokenMintsWithProgram[e]?.tokenProgram.equals(o.TOKEN_2022_PROGRAM_ID)??!1}}},11603:(t,e)=>{"use strict";var n,r;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=e.SwapDirection=void 0,function(t){t.AtoB="aToB",t.BtoA="bToA"}(n||(e.SwapDirection=n={})),function(t){t[t.TokenA=1]="TokenA",t[t.TokenB=2]="TokenB"}(r||(e.TokenType=r={}))},60605:(t,e)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.RemainingAccountsBuilder=e.RemainingAccountsType=void 0,function(t){t.TransferHookA="transferHookA",t.TransferHookB="transferHookB",t.TransferHookReward="transferHookReward",t.TransferHookInput="transferHookInput",t.TransferHookIntermediate="transferHookIntermediate",t.TransferHookOutput="transferHookOutput"}(n||(e.RemainingAccountsType=n={})),e.RemainingAccountsBuilder=class{constructor(){this.remainingAccounts=[],this.slices=[]}addSlice(t,e){return e&&0!==e.length?(this.slices.push({accountsType:{[t]:{}},length:e.length}),this.remainingAccounts.push(...e),this):this}build(){return[{slices:this.slices},this.remainingAccounts.length>0?this.remainingAccounts:void 0]}}},99576:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getUpperSqrtPriceFromTokenB=e.getLowerSqrtPriceFromTokenB=e.getUpperSqrtPriceFromTokenA=e.getLowerSqrtPriceFromTokenA=void 0;const r=n(66259);e.getLowerSqrtPriceFromTokenA=function(t,e,n){const i=e.mul(n).shln(64),o=e.shln(64).add(t.mul(n));return r.MathUtil.divRoundUp(i,o)},e.getUpperSqrtPriceFromTokenA=function(t,e,n){const i=e.mul(n).shln(64),o=e.shln(64).sub(t.mul(n));return r.MathUtil.divRoundUp(i,o)},e.getLowerSqrtPriceFromTokenB=function(t,e,n){return n.sub(r.MathUtil.divRoundUp(t.shln(64),e))},e.getUpperSqrtPriceFromTokenB=function(t,e,n){return n.add(t.shln(64).div(e))}},51986:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleTransactionBuilderFactoryWithAccountResolver=e.contextOptionsToBuilderOptions=e.checkMergedTransactionSizeIsValid=e.filterNullObjects=e.convertListToMap=void 0;const r=n(66259),i=n(29955);async function o(t,e,n){const i=new r.TransactionBuilder(t.connection,t.wallet,t.txBuilderOpts);e.forEach((t=>i.addInstruction(t.compressIx(!0))));try{return await i.txnSize({latestBlockhash:n}),!0}catch(t){return!1}}e.convertListToMap=function(t,e){const n={};return t.forEach(((t,r)=>{if(t){const i=e[r];n[i]=t}})),n},e.filterNullObjects=function(t,e){const n=[],r=[];return t.forEach(((t,i)=>{null!==t&&(n.push(t),r.push(e[i]))})),[n,r]},e.checkMergedTransactionSizeIsValid=o,e.contextOptionsToBuilderOptions=function(t){return{defaultBuildOption:{...r.defaultTransactionBuilderOptions.defaultBuildOption,...t.userDefaultBuildOptions},defaultSendOption:{...r.defaultTransactionBuilderOptions.defaultSendOption,...t.userDefaultSendOptions},defaultConfirmationCommitment:t.userDefaultConfirmCommitment??r.defaultTransactionBuilderOptions.defaultConfirmationCommitment}},e.MultipleTransactionBuilderFactoryWithAccountResolver=class{constructor(t,e,n=t.wallet.publicKey,r=n){this.ctx=t,this.resolvedAtas=e,this.tokenOwner=n,this.payer=r,this.txBuilders=[],this.pendingTxBuilder=null,this.touchedMints=null,this.accountExemption=null}async addInstructions(t){null===this.accountExemption&&(this.accountExemption=await this.ctx.fetcher.getAccountRentExempt());for(let e=0;e<2;e++){this.pendingTxBuilder&&this.touchedMints||(this.pendingTxBuilder=new r.TransactionBuilder(this.ctx.connection,this.ctx.wallet,this.ctx.txBuilderOpts),this.touchedMints=new Set,this.resolvedAtas[i.NATIVE_MINT.toBase58()]=r.TokenUtil.createWrappedNativeAccountInstruction(this.tokenOwner,r.ZERO,this.accountExemption,this.payer,this.tokenOwner,this.ctx.accountResolverOpts.createWrappedSolAccountMethod));const n=new r.TransactionBuilder(this.ctx.connection,this.ctx.wallet,this.ctx.txBuilderOpts),s=t=>(this.touchedMints.has(t)||(n.addInstruction(this.resolvedAtas[t]),this.touchedMints.add(t)),this.resolvedAtas[t].address),a=await t(s.bind(this));if(n.addInstructions(a),await o(this.ctx,[this.pendingTxBuilder,n],r.MEASUREMENT_BLOCKHASH)){this.pendingTxBuilder.addInstruction(n.compressIx(!1));break}if(0!==e)throw new Error("instruction is too large.");this.txBuilders.push(this.pendingTxBuilder),this.pendingTxBuilder=null,this.touchedMints=null}}build(){return this.pendingTxBuilder?[...this.txBuilders,this.pendingTxBuilder]:[...this.txBuilders]}}},88459:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isWalletConnected=void 0;const r=n(18245);e.isWalletConnected=function(t){return null!==t&&!t.publicKey.equals(r.PublicKey.default)}},25367:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.addNativeMintHandlingIx=e.resolveAtaForMints=e.getTokenMintsFromWhirlpools=e.TokenMintTypes=void 0;const r=n(66259),i=n(29955),o=n(18245),s=n(40273),a=n(51986);var u;!function(t){t.ALL="ALL",t.POOL_ONLY="POOL_ONLY",t.REWARD_ONLY="REWARDS_ONLY"}(u||(e.TokenMintTypes=u={})),e.getTokenMintsFromWhirlpools=function(t,e=u.ALL){let n=!1;return{mintMap:Array.from(t.reduce(((t,i)=>{if(i){if(e===u.ALL||e===u.POOL_ONLY){const{tokenMintA:e,tokenMintB:o}=i;r.TokenUtil.isNativeMint(e)?n=!0:t.add(e.toBase58()),r.TokenUtil.isNativeMint(o)?n=!0:t.add(o.toBase58())}e!==u.ALL&&e!==u.REWARD_ONLY||i.rewardInfos.forEach((e=>{r.TokenUtil.isNativeMint(e.mint)&&(n=!0),s.PoolUtil.isRewardInitialized(e)&&t.add(e.mint.toBase58())}))}return t}),new Set)).map((t=>new o.PublicKey(t))),hasNativeMint:n}},e.resolveAtaForMints=async function(t,e){const{mints:n,receiver:i,payer:o,accountExemption:s}=e,u=i??t.wallet.publicKey,c=o??t.wallet.publicKey,d=await(0,r.resolveOrCreateATAs)(t.connection,u,n.map((t=>({tokenMint:t}))),(async()=>s),c,void 0,t.accountResolverOpts.allowPDAOwnerAddress,t.accountResolverOpts.createWrappedSolAccountMethod),{resolveAtaIxs:l,resolvedAtas:h}=d.reduce(((t,e)=>{const{address:n,...r}=e;return t.resolvedAtas.push(n),r.instructions.length&&t.resolveAtaIxs.push(r),t}),{resolvedAtas:[],resolveAtaIxs:[]});return{ataTokenAddresses:(0,a.convertListToMap)(h,n.map((t=>t.toBase58()))),resolveAtaIxs:l}},e.addNativeMintHandlingIx=function(t,e,n,o,s){let{address:a,...u}=r.TokenUtil.createWrappedNativeAccountInstruction(n,r.ZERO,o,void 0,void 0,s);e[i.NATIVE_MINT.toBase58()]=a,t.prependInstruction(u)}},63273:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.buildWhirlpoolClient=void 0;const r=n(4263);e.buildWhirlpoolClient=function(t){return new r.WhirlpoolClientImpl(t)}},68716:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Account:()=>Qe,AddressLookupTableAccount:()=>cr,AddressLookupTableInstruction:()=>so,AddressLookupTableProgram:()=>ao,Authorized:()=>wo,BLOCKHASH_CACHE_TIMEOUT_MS:()=>mr,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>tn,BPF_LOADER_PROGRAM_ID:()=>Gn,BpfLoader:()=>Zn,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>co,ComputeBudgetInstruction:()=>uo,ComputeBudgetProgram:()=>lo,Connection:()=>ro,Ed25519Program:()=>fo,Enum:()=>He,EpochSchedule:()=>rr,FeeCalculatorLayout:()=>zn,Keypair:()=>io,LAMPORTS_PER_SOL:()=>Yo,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>oo,Loader:()=>Vn,Lockup:()=>_o,MAX_SEED_LENGTH:()=>Ge,Message:()=>yn,MessageAccountKeys:()=>un,MessageV0:()=>bn,NONCE_ACCOUNT_LENGTH:()=>jn,NonceAccount:()=>Yn,PACKET_DATA_SIZE:()=>en,PUBLIC_KEY_LENGTH:()=>Ze,PublicKey:()=>Je,SIGNATURE_LENGTH_IN_BYTES:()=>rn,SOLANA_SCHEMA:()=>Ke,STAKE_CONFIG_ID:()=>bo,STAKE_INSTRUCTION_LAYOUTS:()=>ko,SYSTEM_INSTRUCTION_LAYOUTS:()=>Hn,SYSVAR_CLOCK_PUBKEY:()=>In,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>xn,SYSVAR_INSTRUCTIONS_PUBKEY:()=>En,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>Tn,SYSVAR_RENT_PUBKEY:()=>Pn,SYSVAR_REWARDS_PUBKEY:()=>Bn,SYSVAR_SLOT_HASHES_PUBKEY:()=>Ln,SYSVAR_SLOT_HISTORY_PUBKEY:()=>$n,SYSVAR_STAKE_HISTORY_PUBKEY:()=>Rn,Secp256k1Program:()=>go,SendTransactionError:()=>ir,SolanaJSONRPCError:()=>sr,SolanaJSONRPCErrorCode:()=>or,StakeAuthorizationLayout:()=>Mo,StakeInstruction:()=>vo,StakeProgram:()=>Ao,Struct:()=>We,SystemInstruction:()=>Wn,SystemProgram:()=>Kn,Transaction:()=>Mn,TransactionExpiredBlockheightExceededError:()=>on,TransactionExpiredNonceInvalidError:()=>an,TransactionExpiredTimeoutError:()=>sn,TransactionInstruction:()=>kn,TransactionMessage:()=>An,TransactionStatus:()=>_n,VALIDATOR_INFO_KEY:()=>Po,VERSION_PREFIX_MASK:()=>nn,VOTE_PROGRAM_ID:()=>$o,ValidatorInfo:()=>Lo,VersionedMessage:()=>wn,VersionedTransaction:()=>Sn,VoteAccount:()=>Oo,VoteAuthorizationLayout:()=>Eo,VoteInit:()=>So,VoteInstruction:()=>Io,VoteProgram:()=>To,clusterApiUrl:()=>Uo,sendAndConfirmRawTransaction:()=>jo,sendAndConfirmTransaction:()=>On});var r={};n.r(r),n.d(r,{dQ:()=>Z,ci:()=>z,bytesToNumberBE:()=>W,ty:()=>H,eV:()=>G,n$:()=>Q,ql:()=>V,hexToBytes:()=>F,_t:()=>C,tL:()=>K,S5:()=>q,FF:()=>et});var i=n(48764);function o(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function s(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){s(t);const n=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),h=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function f(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function p(t){if("string"==typeof t&&(t=f(t)),!d(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function m(...t){let e=0;for(let n=0;nt().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function b(t=32){if(c&&"function"==typeof c.getRandomValues)return c.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class w extends g{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=l(this.buffer)}update(t){a(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=p(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=l(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t>v&_)}:{h:0|Number(t>>v&_),l:0|Number(t&_)}}function M(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it<>>32-n,S=(t,e,n)=>e<>>32-n,I=(t,e,n)=>e<>>64-n,x=(t,e,n)=>t<>>64-n,E={fromBig:k,split:M,toBig:(t,e)=>BigInt(t>>>0)<>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:A,rotlSL:S,rotlBH:I,rotlBL:x,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[T,P]=(()=>E.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),B=new Uint32Array(80),L=new Uint32Array(80);class $ extends w{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)B[n]=t.getUint32(e),L[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|B[t-15],n=0|L[t-15],r=E.rotrSH(e,n,1)^E.rotrSH(e,n,8)^E.shrSH(e,n,7),i=E.rotrSL(e,n,1)^E.rotrSL(e,n,8)^E.shrSL(e,n,7),o=0|B[t-2],s=0|L[t-2],a=E.rotrSH(o,s,19)^E.rotrBH(o,s,61)^E.shrSH(o,s,6),u=E.rotrSL(o,s,19)^E.rotrBL(o,s,61)^E.shrSL(o,s,6),c=E.add4L(i,u,L[t-7],L[t-16]),d=E.add4H(c,r,a,B[t-7],B[t-16]);B[t]=0|d,L[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=E.rotrSH(d,l,14)^E.rotrSH(d,l,18)^E.rotrBH(d,l,41),b=E.rotrSL(d,l,14)^E.rotrSL(d,l,18)^E.rotrBL(d,l,41),w=d&h^~d&p,_=l&f^~l&m,v=E.add5L(y,b,_,P[t],L[t]),k=E.add5H(v,g,e,w,T[t],B[t]),M=0|v,A=E.rotrSH(n,r,28)^E.rotrBH(n,r,34)^E.rotrBH(n,r,39),S=E.rotrSL(n,r,28)^E.rotrBL(n,r,34)^E.rotrBL(n,r,39),I=n&i^n&s^i&s,x=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|d,f=0|l,({h:d,l}=E.add(0|u,0|c,0|k,0|M)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const $=E.add3L(M,S,x);n=E.add3H($,k,A,I),r=0|$}({h:n,l:r}=E.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=E.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=E.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=E.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=E.add(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=E.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=E.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=E.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y)}roundClean(){B.fill(0),L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const R=y((()=>new $)),O=(BigInt(0),BigInt(1)),D=BigInt(2);function C(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const N=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function z(t){if(!C(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n=j._0&&t<=j._9?t-j._0:t>=j._A&&t<=j._F?t-(j._A-10):t>=j._a&&t<=j._f?t-(j._a-10):void 0}function F(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(D<new Uint8Array(t),J=t=>Uint8Array.from(t);function Q(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=X(t),i=X(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=X())=>{i=a(J([0]),t),r=a(),0!==t.length&&(i=a(J([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const tt={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||C(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function et(t,e,n={}){const r=(e,n,r)=>{const i=tt[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const nt=BigInt(0),rt=BigInt(1),it=BigInt(2),ot=BigInt(3),st=BigInt(4),at=BigInt(5),ut=BigInt(8);function ct(t,e){const n=t%e;return n>=nt?n:e+n}function dt(t,e,n){if(n<=nt||e 0");if(n===rt)return nt;let r=rt;for(;e>nt;)e&rt&&(r=r*t%n),t=t*t%n,e>>=rt;return r}function lt(t,e,n){let r=t;for(;e-- >nt;)r*=r,r%=n;return r}function ht(t,e){if(t===nt||e<=nt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=ct(t,e),r=e,i=nt,o=rt,s=rt,a=nt;for(;n!==nt;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==rt)throw new Error("invert: does not exist");return ct(i,e)}BigInt(9),BigInt(16);const ft=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function mt(t,e,n=!1,r={}){if(t<=nt)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=pt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%st===ot){const e=(t+rt)/st;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%ut===at){const e=(t-at)/ut;return function(t,n){const r=t.mul(n,it),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,it),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-rt)/it;let n,r,i;for(n=t-rt,r=0;n%it===nt;n/=it,r++);for(i=it;ict(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return nt<=e&&et===nt,isOdd:t=>(t&rt)===rt,neg:e=>ct(-e,t),eql:(t,e)=>t===e,sqr:e=>ct(e*e,t),add:(e,n)=>ct(e+n,t),sub:(e,n)=>ct(e-n,t),mul:(e,n)=>ct(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===nt)return t.ONE;if(n===rt)return e;let r=t.ONE,i=e;for(;n>nt;)n&rt&&(r=t.mul(r,i)),i=t.sqr(i),n>>=rt;return r}(a,t,e),div:(e,n)=>ct(e*ht(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>ht(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?q(t,o):K(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?H(t):W(t)}});return Object.freeze(a)}function gt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function yt(t){const e=gt(t);return e+Math.ceil(e/2)}const bt=BigInt(0),wt=BigInt(1);function _t(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>bt;)n&wt&&(r=r.add(i)),i=i.double(),n>>=wt;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=wt);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function vt(t){return et(t.Fp,ft.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),et(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const kt=BigInt(0),Mt=BigInt(1),At=BigInt(2),St=BigInt(8),It={zip215:!0};function xt(t){const e=function(t){const e=vt(t);return et(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=At<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:kt}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&ktp(t)&&p(e)&&tt===kt||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===kt?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,Mt,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(At*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===kt)return this.double();const r=d(s*At*h),f=d(a*At*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===kt?M:this.equals(M)||e===Mt?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?St:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:kt,y:Mt};if(u!==Mt)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===Mt?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=V("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=H(a);h===kt||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-Mt),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&Mt)===Mt,_=0!=(128&u);if(!r&&b===kt&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return x(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=q(e,n.BYTES);return r[r.length-1]|=t&Mt?128:0,r}toHex(){return z(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,Mt,d(e.Gx*e.Gy)),v.ZERO=new v(kt,Mt,Mt,kt);const{BASE:k,ZERO:M}=v,A=_t(v,8*a);function S(t){return ct(t,r)}function I(t){return S(H(t))}function x(t){const e=a;t=V("private key",t,e);const n=V("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function E(t=new Uint8Array,...e){const n=G(...e);return I(o(f(n,V("context",t),!!i)))}const T=It;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return x(t).pointBytes},sign:function(t,e,r={}){t=V("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=x(e),c=E(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+E(r.context,d,u,t)*s);return b(l),V("result",G(d,q(l,n.BYTES)),2*a)},verify:function(t,e,r,o=T){const{context:s,zip215:a}=o,u=n.BYTES;t=V("signature",t,2*u),e=V("message",e),i&&(e=i(e));const c=H(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=E(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const Et=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Tt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Pt=(BigInt(0),BigInt(1)),Bt=BigInt(2),Lt=BigInt(5),$t=BigInt(10),Rt=BigInt(20),Ot=BigInt(40),Dt=BigInt(80);const Ct=mt(Et,void 0,!0),Nt={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ct,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:R,randomBytes:b,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=Et,r=ct(e*e*e,n),i=ct(r*r*e,n);let o=ct(t*r*function(t){const e=Et,n=t*t%e*t%e,r=lt(n,Bt,e)*n%e,i=lt(r,Pt,e)*t%e,o=lt(i,Lt,e)*i%e,s=lt(o,$t,e)*o%e,a=lt(s,Rt,e)*s%e,u=lt(a,Ot,e)*a%e,c=lt(u,Dt,e)*u%e,d=lt(c,Dt,e)*u%e,l=lt(d,$t,e)*o%e;return{pow_p_5_8:lt(l,Bt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=ct(e*o*o,n),a=o,u=ct(o*Tt,n),c=s===t,d=s===ct(-t,n),l=s===ct(-t*Tt,n);return c&&(o=a),(d||l)&&(o=u),(ct(o,n)&rt)===rt&&(o=ct(-o,n)),{isValid:c||d,value:o}}},zt=xt(Nt);const Ut=(Ct.ORDER+BigInt(3))/BigInt(8);Ct.pow(Bt,Ut),Ct.sqrt(Ct.neg(Ct.ONE)),Ct.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(Ct,Ct.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var jt=n(13550),Yt=n.n(jt),Ft=n(77191),Wt=n.n(Ft);const Ht=(t,e,n)=>t&e^t&n^e&n,Kt=new Uint32Array([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]),qt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Vt=new Uint32Array(64);class Gt extends w{constructor(){super(64,32,8,!1),this.A=0|qt[0],this.B=0|qt[1],this.C=0|qt[2],this.D=0|qt[3],this.E=0|qt[4],this.F=0|qt[5],this.G=0|qt[6],this.H=0|qt[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Vt[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Vt[t-15],n=Vt[t-2],r=h(e,7)^h(e,18)^e>>>3,i=h(n,17)^h(n,19)^n>>>10;Vt[t]=i+Vt[t-7]+r+Vt[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(h(s,6)^h(s,11)^h(s,25))+((d=s)&a^~d&u)+Kt[t]+Vt[t]|0,l=(h(n,2)^h(n,13)^h(n,22))+Ht(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){Vt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Zt=y((()=>new Gt));var Xt=n(25532),Jt=n(39386),Qt=n(40475),te=n(53471),ee=n(31198),ne=n.n(ee),re=n(54654),ie=n(31991);const[oe,se,ae]=[[],[],[]],ue=BigInt(0),ce=BigInt(1),de=BigInt(2),le=BigInt(7),he=BigInt(256),fe=BigInt(113);for(let t=0,e=ce,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],oe.push(2*(5*r+n)),se.push((t+1)*(t+2)/2%64);let i=ue;for(let t=0;t<7;t++)e=(e<>le)*fe)%he,e&de&&(i^=ce<<(ce<n>32?I(t,e,n):A(t,e,n),ye=(t,e,n)=>n>32?x(t,e,n):S(t,e,n);class be extends g{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,o(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=ge(o,s,1)^n[r],u=ye(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=se[n],o=ge(e,i,r),s=ye(e,i,r),a=oe[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=pe[r],t[1]^=me[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){a(this);const{blockLen:e,state:n}=this,r=(t=p(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return o(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(u(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new be(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const we=((t,e,n)=>y((()=>new be(e,t,n))))(1,136,32);class _e extends g{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(t.outputLen),o(t.blockLen)}(t);const n=p(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew _e(t,e).update(n).digest();ve.create=(t,e)=>new _e(t,e);const{bytesToNumberBE:ke,hexToBytes:Me}=r,Ae={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=Ae;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:ke(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Ae,n="string"==typeof t?Me(t):t;if(!C(n))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=Ae._parseInt(n.subarray(2)),{d:s,l:a}=Ae._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},Se=BigInt(0),Ie=BigInt(1),xe=(BigInt(2),BigInt(3));function Ee(t){const e=function(t){const e=vt(t);return et(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return ct(t,r)}function a(t){return ht(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=vt(t);et(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return G(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&Sen.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(V("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,xe),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,xe);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===Se)return r;if(a(t),t===Ie)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>Se||c>Se;)s&Ie&&(d=d.add(p)),c&Ie&&(h=h.add(p)),p=p.double(),s>>=Ie,c>>=Ie;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==Se&&e!==Ie&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Ie)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Ie?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return z(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=_t(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=G;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=W(s);if(!(Se<(a=t)&&az(K(t,e.nByteLength));function f(t){return t>r>>Ie}const p=(t,e,n)=>W(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=V("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=Ae.toSig(V("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(V("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return F(this.toDERHex())}toDERHex(){return Ae.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return F(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=yt(e.n);return function(t,e,n=!1){const r=t.length,i=gt(e),o=yt(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=ct(n?W(t):H(t),e-rt)+rt;return n?q(s,i):K(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=C(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=W(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=Z(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(Se<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return K(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=V("msgHash",t),p&&(t=V("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g){const t=!0===g?d(n.BYTES):g;M.push(V("extraEntropy",t))}const A=G(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===Se)return;const o=s(n*s(S+i*_));if(o===Se)return;let c=(r.x===i?0:2)|Number(r.y&Ie),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return Q(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=V("msgHash",n),r=V("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||C(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof Ae.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function Te(t){return{hash:t,hmac:(e,...n)=>ve(t,e,m(...n)),randomBytes:b}}BigInt(4);const Pe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Be=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Le=BigInt(1),$e=BigInt(2),Re=(t,e)=>(t+e/$e)/e;const Oe=mt(Pe,void 0,void 0,{sqrt:function(t){const e=Pe,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=lt(d,n,e)*d%e,h=lt(l,n,e)*d%e,f=lt(h,$e,e)*c%e,p=lt(f,i,e)*f%e,m=lt(p,o,e)*p%e,g=lt(m,a,e)*m%e,y=lt(g,u,e)*g%e,b=lt(y,a,e)*m%e,w=lt(b,n,e)*d%e,_=lt(w,s,e)*p%e,v=lt(_,r,e)*c%e,k=lt(v,$e,e);if(!Oe.eql(Oe.sqr(k),t))throw new Error("Cannot find square root");return k}}),De=function(t,e){const n=e=>Ee({...t,...Te(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Oe,n:Be,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Be,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Le*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=Re(o*t,e),u=Re(-r*t,e);let c=ct(t-a*n-u*i,e),d=ct(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},Zt);BigInt(0),De.ProjectivePoint;const Ce=zt.utils.randomPrivateKey,Ne=()=>{const t=zt.utils.randomPrivateKey(),e=ze(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},ze=zt.getPublicKey;function Ue(t){try{return zt.ExtendedPoint.fromHex(t),!0}catch{return!1}}const je=(t,e)=>zt.sign(t,e.slice(0,32)),Ye=zt.verify,Fe=t=>i.Buffer.isBuffer(t)?t:t instanceof Uint8Array?i.Buffer.from(t.buffer,t.byteOffset,t.byteLength):i.Buffer.from(t);class We{constructor(t){Object.assign(this,t)}encode(){return i.Buffer.from((0,Xt.serialize)(Ke,this))}static decode(t){return(0,Xt.deserialize)(Ke,this,t)}static decodeUnchecked(t){return(0,Xt.deserializeUnchecked)(Ke,this,t)}}class He extends We{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}}const Ke=new Map;var qe;let Ve;const Ge=32,Ze=32;let Xe=1;Ve=Symbol.toStringTag;class Je extends We{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Wt().decode(t);if(e.length!=Ze)throw new Error("Invalid public key input");this._bn=new(Yt())(e)}else this._bn=new(Yt())(t);if(this._bn.byteLength()>Ze)throw new Error("Invalid public key input")}}static unique(){const t=new Je(Xe);return Xe+=1,new Je(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Wt().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(i.Buffer);if(t.length===Ze)return t;const e=i.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Ve](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=i.Buffer.concat([t.toBuffer(),i.Buffer.from(e),n.toBuffer()]),o=Zt(r);return new Je(o)}static createProgramAddressSync(t,e){let n=i.Buffer.alloc(0);t.forEach((function(t){if(t.length>Ge)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Fe(t)])})),n=i.Buffer.concat([n,e.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=Zt(n);if(Ue(r))throw new Error("Invalid seeds, address must fall off the curve");return new Je(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const o=t.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return Ue(new Je(t).toBytes())}}qe=Je,Je.default=new qe("11111111111111111111111111111111"),Ke.set(Je,{kind:"struct",fields:[["_bn","u256"]]});class Qe{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=Fe(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Fe(Ce()),this._publicKey=Fe(ze(this._secretKey))}get publicKey(){return new Je(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const tn=new Je("BPFLoader1111111111111111111111111111111111"),en=1232,nn=127,rn=64;class on extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(on.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class sn extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(sn.prototype,"name",{value:"TransactionExpiredTimeoutError"});class an extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(an.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class un{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const cn=(t="publicKey")=>Jt.blob(32,t),dn=(t="signature")=>Jt.blob(64,t),ln=(t="string")=>{const e=Jt.struct([Jt.u32("length"),Jt.u32("lengthPadding"),Jt.blob(Jt.offset(Jt.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),o=e;return o.decode=(t,e)=>n(t,e).chars.toString(),o.encode=(t,e,n)=>{const o={chars:i.Buffer.from(t,"utf8")};return r(o,e,n)},o.alloc=t=>Jt.u32().span+Jt.u32().span+i.Buffer.from(t,"utf8").length,o};function hn(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return hn({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function fn(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function pn(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function mn(t,e){if(!t)throw new Error(e||"Assertion failed")}class gn{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new gn(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];mn(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{mn(e.length>0,"Expected at least one writable signer key");const[t]=e[0];mn(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Je(t))),...n.map((([t])=>new Je(t))),...r.map((([t])=>new Je(t))),...i.map((([t])=>new Je(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Je(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(mn(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}class yn{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Je(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Wt().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new un(this.staticAccountKeys)}static compile(t){const e=gn.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new un(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Wt().encode(t.data)})));return new yn({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];pn(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Wt().decode(t.data));let o=[];pn(o,e.length);let s=[];return pn(s,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:e,dataLength:i.Buffer.from(s),data:r}}));let r=[];pn(r,n.length);let o=i.Buffer.alloc(en);i.Buffer.from(r).copy(o);let s=r.length;n.forEach((t=>{const e=Jt.struct([Jt.u8("programIdIndex"),Jt.blob(t.keyIndicesCount.length,"keyIndicesCount"),Jt.seq(Jt.u8("keyIndex"),t.keyIndices.length,"keyIndices"),Jt.blob(t.dataLength.length,"dataLength"),Jt.seq(Jt.u8("userdatum"),t.data.length,"data")]).encode(t,o,s);s+=e})),o=o.slice(0,s);const a=Jt.struct([Jt.blob(1,"numRequiredSignatures"),Jt.blob(1,"numReadonlySignedAccounts"),Jt.blob(1,"numReadonlyUnsignedAccounts"),Jt.blob(e.length,"keyCount"),Jt.seq(cn("key"),t,"keys"),cn("recentBlockhash")]),u={numRequiredSignatures:i.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:i.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:i.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:i.Buffer.from(e),keys:this.accountKeys.map((t=>Fe(t.toBytes()))),recentBlockhash:Wt().decode(this.recentBlockhash)};let c=i.Buffer.alloc(2048);const d=a.encode(u,c);return o.copy(c,d),c.slice(0,d+o.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&nn))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=e.shift(),o=e.shift(),s=fn(e);let a=[];for(let t=0;t0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new un(this.staticAccountKeys,e)}isAccountSigner(t){return t=n?t-nt+e.writableIndexes.length),0):t>=this.header.numRequiredSignatures?t-et.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const t of n.writableIndexes){if(!(tt.toBytes())),recentBlockhash:Wt().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let t=0;const e=new Uint8Array(en);for(const n of this.compiledInstructions){const r=Array();pn(r,n.accountKeyIndexes.length);const i=Array();pn(i,n.data.length),t+=Jt.struct([Jt.u8("programIdIndex"),Jt.blob(r.length,"encodedAccountKeyIndexesLength"),Jt.seq(Jt.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),Jt.blob(i.length,"encodedDataLength"),Jt.blob(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(en);for(const n of this.addressTableLookups){const r=Array();pn(r,n.writableIndexes.length);const i=Array();pn(i,n.readonlyIndexes.length),t+=Jt.struct([cn("accountKey"),Jt.blob(r.length,"encodedWritableIndexesLength"),Jt.seq(Jt.u8(),n.writableIndexes.length,"writableIndexes"),Jt.blob(i.length,"encodedReadonlyIndexesLength"),Jt.seq(Jt.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),r=n&nn;mn(n!==r,"Expected versioned message but received legacy message"),mn(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},o=[],s=fn(e);for(let t=0;t{const e=wn.deserializeMessageVersion(t);if("legacy"===e)return yn.from(t);if(0===e)return bn.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let _n=function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t}({});const vn=i.Buffer.alloc(rn).fill(0);class kn{constructor(t){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class Mn{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new kn(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Je(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Wt().encode(e)}}));return f.forEach((t=>{mn(t.programIdIndex>=0),t.accounts.forEach((t=>mn(t>=0)))})),new yn({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=je(n,t.secretKey);this._addSignature(t.publicKey,Fe(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){mn(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=i.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):Ye(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];pn(n,e.length);const r=n.length+64*e.length+t.length,o=i.Buffer.alloc(r);return mn(e.length<256),i.Buffer.from(n).copy(o,0),e.forEach((({signature:t},e)=>{null!==t&&(mn(64===t.length,"signature has invalid length"),i.Buffer.from(t).copy(o,n.length+64*e))})),t.copy(o,n.length+64*e.length),mn(o.length<=en,`Transaction too large: ${o.length} > ${en}`),o}get keys(){return mn(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return mn(1===this.instructions.length),this.instructions[0].programId}get data(){return mn(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=fn(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Wt().encode(vn)?null:Wt().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new kn({keys:r,programId:t.accountKeys[e.programIdIndex],data:Wt().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}class An{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:r,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;mn(u>0,"Message header is invalid");const c=t.staticAccountKeys.length-o-a;mn(c>=0,"Message header is invalid");const d=t.getAccountKeys(e),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const t of r){const e=[];for(const r of t.accountKeyIndexes){const t=d.get(r);if(void 0===t)throw new Error(`Failed to find key for account key index ${r}`);let i;i=rt.equals(r.publicKey)));mn(t>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[t]=je(e,r.secretKey)}}addSignature(t,e){mn(64===e.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((e=>e.equals(t)));mn(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const In=new Je("SysvarC1ock11111111111111111111111111111111"),xn=new Je("SysvarEpochSchedu1e111111111111111111111111"),En=new Je("Sysvar1nstructions1111111111111111111111111"),Tn=new Je("SysvarRecentB1ockHashes11111111111111111111"),Pn=new Je("SysvarRent111111111111111111111111111111111"),Bn=new Je("SysvarRewards111111111111111111111111111111"),Ln=new Je("SysvarS1otHashes111111111111111111111111111"),$n=new Je("SysvarS1otHistory11111111111111111111111111"),Rn=new Je("SysvarStakeHistory1111111111111111111111111");async function On(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function Dn(t){return new Promise((e=>setTimeout(e,t)))}function Cn(t,e){const n=t.layout.span>=0?t.layout.span:hn(t,e),r=i.Buffer.alloc(n),o=Object.assign({instruction:t.index},e);return t.layout.encode(o,r),r}function Nn(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const zn=Jt.nu64("lamportsPerSignature"),Un=Jt.struct([Jt.u32("version"),Jt.u32("state"),cn("authorizedPubkey"),cn("nonce"),Jt.struct([zn],"feeCalculator")]),jn=Un.span;class Yn{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=Un.decode(Fe(t),0);return new Yn({authorizedPubkey:new Je(e.authorizedPubkey),nonce:new Je(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const Fn=(8,t=>{const e=(0,Jt.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return(0,Qt.toBigIntLE)(i.Buffer.from(n))},o.encode=(t,e,r)=>{const i=(0,Qt.toBufferLE)(t,8);return n(i,e,r)},o});class Wn{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Hn))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=Nn(Hn.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new Je(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=Nn(Hn.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=Nn(Hn.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new Je(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=Nn(Hn.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=Nn(Hn.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Je(e),seed:n,space:r,programId:new Je(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=Nn(Hn.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new Je(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=Nn(Hn.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Je(e),seed:n,programId:new Je(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=Nn(Hn.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new Je(e),seed:n,lamports:r,space:i,programId:new Je(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=Nn(Hn.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new Je(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(Hn.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Nn(Hn.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=Nn(Hn.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new Je(e)}}static checkProgramId(t){if(!t.equals(Kn.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length0?i:1,space:o.length,programId:r}));null!==a&&await On(t,a,[e,n],{commitment:"confirmed"})}const s=Jt.struct([Jt.u32("instruction"),Jt.u32("offset"),Jt.u32("bytesLength"),Jt.u32("bytesLengthPadding"),Jt.seq(Jt.u8("byte"),Jt.offset(Jt.u32(),-8),"bytes")]),a=Vn.chunkSize;let u=0,c=o,d=[];for(;c.length>0;){const o=c.slice(0,a),l=i.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:o,bytesLength:0,bytesLengthPadding:0},l);const h=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push(On(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await Dn(1e3/t)}u+=a,c=c.slice(a)}await Promise.all(d);{const o=Jt.struct([Jt.u32("instruction")]),s=i.Buffer.alloc(o.span);o.encode({instruction:1},s);const a=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1}],programId:r,data:s}),u="processed",c=await t.sendTransaction(a,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}Vn.chunkSize=qn;const Gn=new Je("BPFLoader2111111111111111111111111111111111");class Zn{static getMinNumSignatures(t){return Vn.getMinNumSignatures(t)}static load(t,e,n,r,i){return Vn.load(t,e,n,i,r)}}function Xn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jn=Object.prototype.toString,Qn=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function tr(t,e){var n,r,i,o,s,a,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return tr(t.toJSON(),e);if("[object Array]"===(u=Jn.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=tr(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Qn(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}class rr{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32)))-nr(32)-1;return[n,t-(this.getSlotsInEpoch(n)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}var e}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const n=(0,ie.Z)(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in n?n.socket:n,n}),t,e,n),this.underlyingSocket=void 0}call(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class cr{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${t.index}`);return n}(dr,t),n=t.length-56;mn(n>=0,"lookup table is invalid"),mn(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=Jt.struct([Jt.seq(cn(),r,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new Je(e.authority[0]):void 0,addresses:i.map((t=>new Je(t)))}}}const dr={index:1,layout:Jt.struct([Jt.u32("typeIndex"),Fn("deactivationSlot"),Jt.nu64("lastExtendedSlot"),Jt.u8("lastExtendedStartIndex"),Jt.u8(),Jt.seq(cn(),Jt.offset(Jt.u8(),-1),"authority")])},lr=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,hr=(0,te.oQ)((0,te.eE)(Je),(0,te.Z_)(),(t=>new Je(t))),fr=(0,te.bc)([(0,te.Z_)(),(0,te.i0)("base64")]),pr=(0,te.oQ)((0,te.eE)(i.Buffer),fr,(t=>i.Buffer.from(t[0],"base64"))),mr=3e4;function gr(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function yr(t){return(0,te.G0)([(0,te.dt)({jsonrpc:(0,te.i0)("2.0"),id:(0,te.Z_)(),result:t}),(0,te.dt)({jsonrpc:(0,te.i0)("2.0"),id:(0,te.Z_)(),error:(0,te.dt)({code:(0,te._4)(),message:(0,te.Z_)(),data:(0,te.jt)((0,te.Yj)())})})])}const br=yr((0,te._4)());function wr(t){return(0,te.oQ)(yr(t),br,(e=>"error"in e?e:{...e,result:(0,te.Ue)(e.result,t)}))}function _r(t){return wr((0,te.dt)({context:(0,te.dt)({slot:(0,te.Rx)()}),value:t}))}function vr(t){return(0,te.dt)({context:(0,te.dt)({slot:(0,te.Rx)()}),value:t})}function kr(t,e){return 0===t?new bn({header:e.header,staticAccountKeys:e.accountKeys.map((t=>new Je(t))),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Wt().decode(t.data)}))),addressTableLookups:e.addressTableLookups}):new yn(e)}const Mr=(0,te.dt)({foundation:(0,te.Rx)(),foundationTerm:(0,te.Rx)(),initial:(0,te.Rx)(),taper:(0,te.Rx)(),terminal:(0,te.Rx)()}),Ar=wr((0,te.IX)((0,te.AG)((0,te.dt)({epoch:(0,te.Rx)(),effectiveSlot:(0,te.Rx)(),amount:(0,te.Rx)(),postBalance:(0,te.Rx)(),commission:(0,te.jt)((0,te.AG)((0,te.Rx)()))})))),Sr=(0,te.IX)((0,te.dt)({slot:(0,te.Rx)(),prioritizationFee:(0,te.Rx)()})),Ir=(0,te.dt)({total:(0,te.Rx)(),validator:(0,te.Rx)(),foundation:(0,te.Rx)(),epoch:(0,te.Rx)()}),xr=(0,te.dt)({epoch:(0,te.Rx)(),slotIndex:(0,te.Rx)(),slotsInEpoch:(0,te.Rx)(),absoluteSlot:(0,te.Rx)(),blockHeight:(0,te.jt)((0,te.Rx)()),transactionCount:(0,te.jt)((0,te.Rx)())}),Er=(0,te.dt)({slotsPerEpoch:(0,te.Rx)(),leaderScheduleSlotOffset:(0,te.Rx)(),warmup:(0,te.O7)(),firstNormalEpoch:(0,te.Rx)(),firstNormalSlot:(0,te.Rx)()}),Tr=(0,te.IM)((0,te.Z_)(),(0,te.IX)((0,te.Rx)())),Pr=(0,te.AG)((0,te.G0)([(0,te.dt)({}),(0,te.Z_)()])),Br=(0,te.dt)({err:Pr}),Lr=(0,te.i0)("receivedSignature"),$r=(0,te.dt)({"solana-core":(0,te.Z_)(),"feature-set":(0,te.jt)((0,te.Rx)())}),Rr=_r((0,te.dt)({err:(0,te.AG)((0,te.G0)([(0,te.dt)({}),(0,te.Z_)()])),logs:(0,te.AG)((0,te.IX)((0,te.Z_)())),accounts:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.AG)((0,te.dt)({executable:(0,te.O7)(),owner:(0,te.Z_)(),lamports:(0,te.Rx)(),data:(0,te.IX)((0,te.Z_)()),rentEpoch:(0,te.jt)((0,te.Rx)())}))))),unitsConsumed:(0,te.jt)((0,te.Rx)()),returnData:(0,te.jt)((0,te.AG)((0,te.dt)({programId:(0,te.Z_)(),data:(0,te.bc)([(0,te.Z_)(),(0,te.i0)("base64")])})))})),Or=_r((0,te.dt)({byIdentity:(0,te.IM)((0,te.Z_)(),(0,te.IX)((0,te.Rx)())),range:(0,te.dt)({firstSlot:(0,te.Rx)(),lastSlot:(0,te.Rx)()})})),Dr=wr(Mr),Cr=wr(Ir),Nr=wr(Sr),zr=wr(xr),Ur=wr(Er),jr=wr(Tr),Yr=wr((0,te.Rx)()),Fr=_r((0,te.dt)({total:(0,te.Rx)(),circulating:(0,te.Rx)(),nonCirculating:(0,te.Rx)(),nonCirculatingAccounts:(0,te.IX)(hr)})),Wr=(0,te.dt)({amount:(0,te.Z_)(),uiAmount:(0,te.AG)((0,te.Rx)()),decimals:(0,te.Rx)(),uiAmountString:(0,te.jt)((0,te.Z_)())}),Hr=_r((0,te.IX)((0,te.dt)({address:hr,amount:(0,te.Z_)(),uiAmount:(0,te.AG)((0,te.Rx)()),decimals:(0,te.Rx)(),uiAmountString:(0,te.jt)((0,te.Z_)())}))),Kr=_r((0,te.IX)((0,te.dt)({pubkey:hr,account:(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:pr,rentEpoch:(0,te.Rx)()})}))),qr=(0,te.dt)({program:(0,te.Z_)(),parsed:(0,te._4)(),space:(0,te.Rx)()}),Vr=_r((0,te.IX)((0,te.dt)({pubkey:hr,account:(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:qr,rentEpoch:(0,te.Rx)()})}))),Gr=_r((0,te.IX)((0,te.dt)({lamports:(0,te.Rx)(),address:hr}))),Zr=(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:pr,rentEpoch:(0,te.Rx)()}),Xr=(0,te.dt)({pubkey:hr,account:Zr}),Jr=(0,te.oQ)((0,te.G0)([(0,te.eE)(i.Buffer),qr]),(0,te.G0)([fr,qr]),(t=>Array.isArray(t)?(0,te.Ue)(t,pr):t)),Qr=(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:Jr,rentEpoch:(0,te.Rx)()}),ti=(0,te.dt)({pubkey:hr,account:Qr}),ei=(0,te.dt)({state:(0,te.G0)([(0,te.i0)("active"),(0,te.i0)("inactive"),(0,te.i0)("activating"),(0,te.i0)("deactivating")]),active:(0,te.Rx)(),inactive:(0,te.Rx)()}),ni=wr((0,te.IX)((0,te.dt)({signature:(0,te.Z_)(),slot:(0,te.Rx)(),err:Pr,memo:(0,te.AG)((0,te.Z_)()),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)()))}))),ri=wr((0,te.IX)((0,te.dt)({signature:(0,te.Z_)(),slot:(0,te.Rx)(),err:Pr,memo:(0,te.AG)((0,te.Z_)()),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)()))}))),ii=(0,te.dt)({subscription:(0,te.Rx)(),result:vr(Zr)}),oi=(0,te.dt)({pubkey:hr,account:Zr}),si=(0,te.dt)({subscription:(0,te.Rx)(),result:vr(oi)}),ai=(0,te.dt)({parent:(0,te.Rx)(),slot:(0,te.Rx)(),root:(0,te.Rx)()}),ui=(0,te.dt)({subscription:(0,te.Rx)(),result:ai}),ci=(0,te.G0)([(0,te.dt)({type:(0,te.G0)([(0,te.i0)("firstShredReceived"),(0,te.i0)("completed"),(0,te.i0)("optimisticConfirmation"),(0,te.i0)("root")]),slot:(0,te.Rx)(),timestamp:(0,te.Rx)()}),(0,te.dt)({type:(0,te.i0)("createdBank"),parent:(0,te.Rx)(),slot:(0,te.Rx)(),timestamp:(0,te.Rx)()}),(0,te.dt)({type:(0,te.i0)("frozen"),slot:(0,te.Rx)(),timestamp:(0,te.Rx)(),stats:(0,te.dt)({numTransactionEntries:(0,te.Rx)(),numSuccessfulTransactions:(0,te.Rx)(),numFailedTransactions:(0,te.Rx)(),maxTransactionsPerEntry:(0,te.Rx)()})}),(0,te.dt)({type:(0,te.i0)("dead"),slot:(0,te.Rx)(),timestamp:(0,te.Rx)(),err:(0,te.Z_)()})]),di=(0,te.dt)({subscription:(0,te.Rx)(),result:ci}),li=(0,te.dt)({subscription:(0,te.Rx)(),result:vr((0,te.G0)([Br,Lr]))}),hi=(0,te.dt)({subscription:(0,te.Rx)(),result:(0,te.Rx)()}),fi=(0,te.dt)({pubkey:(0,te.Z_)(),gossip:(0,te.AG)((0,te.Z_)()),tpu:(0,te.AG)((0,te.Z_)()),rpc:(0,te.AG)((0,te.Z_)()),version:(0,te.AG)((0,te.Z_)())}),pi=(0,te.dt)({votePubkey:(0,te.Z_)(),nodePubkey:(0,te.Z_)(),activatedStake:(0,te.Rx)(),epochVoteAccount:(0,te.O7)(),epochCredits:(0,te.IX)((0,te.bc)([(0,te.Rx)(),(0,te.Rx)(),(0,te.Rx)()])),commission:(0,te.Rx)(),lastVote:(0,te.Rx)(),rootSlot:(0,te.AG)((0,te.Rx)())}),mi=wr((0,te.dt)({current:(0,te.IX)(pi),delinquent:(0,te.IX)(pi)})),gi=(0,te.G0)([(0,te.i0)("processed"),(0,te.i0)("confirmed"),(0,te.i0)("finalized")]),yi=(0,te.dt)({slot:(0,te.Rx)(),confirmations:(0,te.AG)((0,te.Rx)()),err:Pr,confirmationStatus:(0,te.jt)(gi)}),bi=_r((0,te.IX)((0,te.AG)(yi))),wi=wr((0,te.Rx)()),_i=(0,te.dt)({accountKey:hr,writableIndexes:(0,te.IX)((0,te.Rx)()),readonlyIndexes:(0,te.IX)((0,te.Rx)())}),vi=(0,te.dt)({signatures:(0,te.IX)((0,te.Z_)()),message:(0,te.dt)({accountKeys:(0,te.IX)((0,te.Z_)()),header:(0,te.dt)({numRequiredSignatures:(0,te.Rx)(),numReadonlySignedAccounts:(0,te.Rx)(),numReadonlyUnsignedAccounts:(0,te.Rx)()}),instructions:(0,te.IX)((0,te.dt)({accounts:(0,te.IX)((0,te.Rx)()),data:(0,te.Z_)(),programIdIndex:(0,te.Rx)()})),recentBlockhash:(0,te.Z_)(),addressTableLookups:(0,te.jt)((0,te.IX)(_i))})}),ki=(0,te.dt)({pubkey:hr,signer:(0,te.O7)(),writable:(0,te.O7)(),source:(0,te.jt)((0,te.G0)([(0,te.i0)("transaction"),(0,te.i0)("lookupTable")]))}),Mi=(0,te.dt)({accountKeys:(0,te.IX)(ki),signatures:(0,te.IX)((0,te.Z_)())}),Ai=(0,te.dt)({parsed:(0,te._4)(),program:(0,te.Z_)(),programId:hr}),Si=(0,te.dt)({accounts:(0,te.IX)(hr),data:(0,te.Z_)(),programId:hr}),Ii=(0,te.G0)([Si,Ai]),xi=(0,te.G0)([(0,te.dt)({parsed:(0,te._4)(),program:(0,te.Z_)(),programId:(0,te.Z_)()}),(0,te.dt)({accounts:(0,te.IX)((0,te.Z_)()),data:(0,te.Z_)(),programId:(0,te.Z_)()})]),Ei=(0,te.oQ)(Ii,xi,(t=>"accounts"in t?(0,te.Ue)(t,Si):(0,te.Ue)(t,Ai))),Ti=(0,te.dt)({signatures:(0,te.IX)((0,te.Z_)()),message:(0,te.dt)({accountKeys:(0,te.IX)(ki),instructions:(0,te.IX)(Ei),recentBlockhash:(0,te.Z_)(),addressTableLookups:(0,te.jt)((0,te.AG)((0,te.IX)(_i)))})}),Pi=(0,te.dt)({accountIndex:(0,te.Rx)(),mint:(0,te.Z_)(),owner:(0,te.jt)((0,te.Z_)()),uiTokenAmount:Wr}),Bi=(0,te.dt)({writable:(0,te.IX)(hr),readonly:(0,te.IX)(hr)}),Li=(0,te.dt)({err:Pr,fee:(0,te.Rx)(),innerInstructions:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.dt)({index:(0,te.Rx)(),instructions:(0,te.IX)((0,te.dt)({accounts:(0,te.IX)((0,te.Rx)()),data:(0,te.Z_)(),programIdIndex:(0,te.Rx)()}))})))),preBalances:(0,te.IX)((0,te.Rx)()),postBalances:(0,te.IX)((0,te.Rx)()),logMessages:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.Z_)()))),preTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),postTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),loadedAddresses:(0,te.jt)(Bi),computeUnitsConsumed:(0,te.jt)((0,te.Rx)())}),$i=(0,te.dt)({err:Pr,fee:(0,te.Rx)(),innerInstructions:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.dt)({index:(0,te.Rx)(),instructions:(0,te.IX)(Ei)})))),preBalances:(0,te.IX)((0,te.Rx)()),postBalances:(0,te.IX)((0,te.Rx)()),logMessages:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.Z_)()))),preTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),postTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),loadedAddresses:(0,te.jt)(Bi),computeUnitsConsumed:(0,te.jt)((0,te.Rx)())}),Ri=(0,te.G0)([(0,te.i0)(0),(0,te.i0)("legacy")]),Oi=(0,te.dt)({pubkey:(0,te.Z_)(),lamports:(0,te.Rx)(),postBalance:(0,te.AG)((0,te.Rx)()),rewardType:(0,te.AG)((0,te.Z_)()),commission:(0,te.jt)((0,te.AG)((0,te.Rx)()))}),Di=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:vi,meta:(0,te.AG)(Li),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ci=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ni=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Mi,meta:(0,te.AG)(Li),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),zi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Ti,meta:(0,te.AG)($i),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ui=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Mi,meta:(0,te.AG)($i),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),ji=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Yi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:vi,meta:(0,te.AG)(Li)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)())}))),Fi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),signatures:(0,te.IX)((0,te.Z_)()),blockTime:(0,te.AG)((0,te.Rx)())}))),Wi=wr((0,te.AG)((0,te.dt)({slot:(0,te.Rx)(),meta:(0,te.AG)(Li),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)())),transaction:vi,version:(0,te.jt)(Ri)}))),Hi=wr((0,te.AG)((0,te.dt)({slot:(0,te.Rx)(),transaction:Ti,meta:(0,te.AG)($i),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)())),version:(0,te.jt)(Ri)}))),Ki=_r((0,te.dt)({blockhash:(0,te.Z_)(),feeCalculator:(0,te.dt)({lamportsPerSignature:(0,te.Rx)()})})),qi=_r((0,te.dt)({blockhash:(0,te.Z_)(),lastValidBlockHeight:(0,te.Rx)()})),Vi=_r((0,te.O7)()),Gi=(0,te.dt)({slot:(0,te.Rx)(),numTransactions:(0,te.Rx)(),numSlots:(0,te.Rx)(),samplePeriodSecs:(0,te.Rx)()}),Zi=wr((0,te.IX)(Gi)),Xi=_r((0,te.AG)((0,te.dt)({feeCalculator:(0,te.dt)({lamportsPerSignature:(0,te.Rx)()})}))),Ji=wr((0,te.Z_)()),Qi=wr((0,te.Z_)()),to=(0,te.dt)({err:Pr,logs:(0,te.IX)((0,te.Z_)()),signature:(0,te.Z_)()}),eo=(0,te.dt)({result:vr(to),subscription:(0,te.Rx)()}),no={"solana-client":"js/0.0.0-development"};class ro{constructor(t,e){let n,r,i,o,s,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const t={};return async e=>{const{commitment:n,config:r}=gr(e),i=this._buildArgs([],n,void 0,r),o=er(i);return t[o]=t[o]??(async()=>{try{const t=await this._rpcRequest("getBlockHeight",i),e=(0,te.Ue)(t,wr((0,te.Rx)()));if("error"in e)throw new sr(e.error,"failed to get block height information");return e.result}finally{delete t[o]}})(),await t[o]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,n=e.wsEndpoint,r=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=n||function(t){const e=t.match(lr);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);const[n,r,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(t),this._rpcClient=function(t,e,n,r,i,o){const s=n||ar;let a;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(t,e)=>{const n=await new Promise(((n,i)=>{try{r(t,e,((t,e)=>n([t,e])))}catch(t){i(t)}}));return await s(...n)}),new(ne())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},no)};try{let e,n=5,u=500;for(;e=a?await a(t,o):await s(t,o),429===e.status&&!0!==i&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await Dn(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{})}(t,r,i,o,s,a),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new ur(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=await this._rpcRequest("getBalance",i),s=(0,te.Ue)(o,_r((0,te.Rx)()));if("error"in s)throw new sr(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=await this._rpcRequest("getBlockTime",[t]),n=(0,te.Ue)(e,wr((0,te.AG)((0,te.Rx)())));if("error"in n)throw new sr(n.error,`failed to get block time for slot ${t}`);return n.result}async getMinimumLedgerSlot(){const t=await this._rpcRequest("minimumLedgerSlot",[]),e=(0,te.Ue)(t,wr((0,te.Rx)()));if("error"in e)throw new sr(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const t=await this._rpcRequest("getFirstAvailableBlock",[]),e=(0,te.Ue)(t,Yr);if("error"in e)throw new sr(e.error,"failed to get first available block");return e.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=await this._rpcRequest("getSupply",[e]),r=(0,te.Ue)(n,Fr);if("error"in r)throw new sr(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenSupply",n),i=(0,te.Ue)(r,_r(Wr));if("error"in i)throw new sr(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenAccountBalance",n),i=(0,te.Ue)(r,_r(Wr));if("error"in i)throw new sr(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=gr(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=await this._rpcRequest("getTokenAccountsByOwner",s),u=(0,te.Ue)(a,Kr);if("error"in u)throw new sr(u.error,`failed to get token accounts owned by account ${t.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",i),s=(0,te.Ue)(o,Vr);if("error"in s)throw new sr(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=await this._rpcRequest("getLargestAccounts",n),i=(0,te.Ue)(r,Gr);if("error"in i)throw new sr(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenLargestAccounts",n),i=(0,te.Ue)(r,Hr);if("error"in i)throw new sr(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,te.Ue)(o,_r((0,te.AG)(Zr)));if("error"in s)throw new sr(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,te.Ue)(o,_r((0,te.AG)(Qr)));if("error"in s)throw new sr(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,te.Ue)(s,_r((0,te.IX)((0,te.AG)(Qr))));if("error"in a)throw new sr(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,te.Ue)(s,_r((0,te.IX)((0,te.AG)(Zr))));if("error"in a)throw new sr(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=gr(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),s=await this._rpcRequest("getStakeActivation",o),a=(0,te.Ue)(s,wr(ei));if("error"in a)throw new sr(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=gr(e),{encoding:i,...o}=r||{},s=this._buildArgs([t.toBase58()],n,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=(0,te.IX)(Xr),c=!0===o.withContext?(0,te.Ue)(a,_r(u)):(0,te.Ue)(a,wr(u));if("error"in c)throw new sr(c.error,`failed to get accounts owned by program ${t.toBase58()}`);return c.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getProgramAccounts",i),s=(0,te.Ue)(o,wr((0,te.IX)(ti)));if("error"in s)throw new sr(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{const e=t;if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);n=e.signature}try{r=Wt().decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}return mn(64===r.length,"signature has invalid length"),"string"==typeof t?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise(((e,n)=>{null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(()=>{n(t.reason)})))}))}getTransactionConfirmationPromise({commitment:t,signature:e}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,s)=>{try{n=this.onSignature(e,((t,e)=>{n=void 0;const r={context:e,value:t};o({__type:_n.PROCESSED,response:r})}),t);const a=new Promise((t=>{null==n?t():r=this._onSubscriptionStateChange(n,(e=>{"subscribed"===e&&t()}))}));(async()=>{if(await a,i)return;const n=await this.getSignatureStatus(e);if(i)return;if(null==n)return;const{context:r,value:u}=n;if(null!=u)if(u?.err)s(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,o({__type:_n.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((e=>{const r=async()=>{try{return await this.getBlockHeight(t)}catch(t){return-1}};(async()=>{let t=await r();if(!i){for(;t<=n;){if(await Dn(1e3),i)return;if(t=await r(),i)return}e({__type:_n.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:t,signature:r}),u=this.getCancellationPromise(e);let c;try{const t=await Promise.race([u,a,o]);if(t.__type!==_n.PROCESSED)throw new on(r);c=t.response}finally{i=!0,s()}return c}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let s=!1;const a=new Promise((e=>{let o=i,a=null;const u=async()=>{try{const{context:e,value:i}=await this.getNonceAndContext(r,{commitment:t,minContextSlot:n});return a=e.slot,i?.nonce}catch(t){return o}};(async()=>{if(o=await u(),!s)for(;;){if(i!==o)return void e({__type:_n.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await Dn(2e3),s)return;if(o=await u(),s)return}})()})),{abortConfirmation:u,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(e);let l;try{const e=await Promise.race([d,c,a]);if(e.__type===_n.PROCESSED)l=e.response;else{let r;for(;;){const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(e.slotInWhichNonceDidAdvance??n))){r=t;break}await Dn(400)}if(!r?.value)throw new an(o);{const e=t||"finalized",{confirmationStatus:n}=r.value;switch(e){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new an(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new an(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new an(o)}l={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,u()}return l}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let n;const r=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>e({__type:_n.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});let s;try{const t=await Promise.race([o,r]);if(t.__type!==_n.PROCESSED)throw new sn(e,t.timeoutMs/1e3);s=t.response}finally{clearTimeout(n),i()}return s}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),e=(0,te.Ue)(t,wr((0,te.IX)(fi)));if("error"in e)throw new sr(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getVoteAccounts",e),r=(0,te.Ue)(n,mi);if("error"in r)throw new sr(r.error,"failed to get vote accounts");return r.result}async getSlot(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlot",r),o=(0,te.Ue)(i,wr((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get slot");return o.result}async getSlotLeader(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlotLeader",r),o=(0,te.Ue)(i,wr((0,te.Z_)()));if("error"in o)throw new sr(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(t,e){const n=[t,e],r=await this._rpcRequest("getSlotLeaders",n),i=(0,te.Ue)(r,wr((0,te.IX)(hr)));if("error"in i)throw new sr(i.error,"failed to get slot leaders");return i.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);return mn(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=await this._rpcRequest("getSignatureStatuses",n),i=(0,te.Ue)(r,bi);if("error"in i)throw new sr(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getTransactionCount",r),o=(0,te.Ue)(i,wr((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get transaction count");return o.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getInflationGovernor",e),r=(0,te.Ue)(n,Dr);if("error"in r)throw new sr(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=gr(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:i?.epoch}),s=await this._rpcRequest("getInflationReward",o),a=(0,te.Ue)(s,Ar);if("error"in a)throw new sr(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){const t=await this._rpcRequest("getInflationRate",[]),e=(0,te.Ue)(t,Cr);if("error"in e)throw new sr(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getEpochInfo",r),o=(0,te.Ue)(i,zr);if("error"in o)throw new sr(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){const t=await this._rpcRequest("getEpochSchedule",[]),e=(0,te.Ue)(t,Ur);if("error"in e)throw new sr(e.error,"failed to get epoch schedule");const n=e.result;return new rr(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),e=(0,te.Ue)(t,jr);if("error"in e)throw new sr(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getMinimumBalanceForRentExemption",n),i=(0,te.Ue)(r,wi);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getRecentBlockhash",e),r=(0,te.Ue)(n,Ki);if("error"in r)throw new sr(r.error,"failed to get recent blockhash");return r.result}async getRecentPerformanceSamples(t){const e=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),n=(0,te.Ue)(e,Zi);if("error"in n)throw new sr(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getFeeCalculatorForBlockhash",n),i=(0,te.Ue)(r,Xi);if("error"in i)throw new sr(i.error,"failed to get fee calculator");const{context:o,value:s}=i.result;return{context:o,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){const n=Fe(t.serialize()).toString("base64"),r=this._buildArgs([n],e),i=await this._rpcRequest("getFeeForMessage",r),o=(0,te.Ue)(i,_r((0,te.AG)((0,te.Rx)())));if("error"in o)throw new sr(o.error,"failed to get fee for message");if(null===o.result)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(t){const e=t?.lockedWritableAccounts?.map((t=>t.toBase58())),n=e?.length?[e]:[],r=await this._rpcRequest("getRecentPrioritizationFees",n),i=(0,te.Ue)(r,Nr);if("error"in i)throw new sr(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getLatestBlockhash",r),o=(0,te.Ue)(i,qi);if("error"in o)throw new sr(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t],n,void 0,r),o=await this._rpcRequest("isBlockhashValid",i),s=(0,te.Ue)(o,Vi);if("error"in s)throw new sr(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){const t=await this._rpcRequest("getVersion",[]),e=(0,te.Ue)(t,wr($r));if("error"in e)throw new sr(e.error,"failed to get version");return e.result}async getGenesisHash(){const t=await this._rpcRequest("getGenesisHash",[]),e=(0,te.Ue)(t,wr((0,te.Z_)()));if("error"in e)throw new sr(e.error,"failed to get genesis hash");return e.result}async getBlock(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,te.Ue)(o,Ni);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,te.Ue)(o,Ci);if("error"in t)throw t.error;return t.result}default:{const t=(0,te.Ue)(o,Di);if("error"in t)throw t.error;const{result:e}=t;return e?{...e,transactions:e.transactions.map((({transaction:t,meta:e,version:n})=>({meta:e,transaction:{...t,message:kr(n,t.message)},version:n})))}:null}}}catch(t){throw new sr(t,"failed to get confirmed block")}}async getParsedBlock(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,te.Ue)(o,Ui);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,te.Ue)(o,ji);if("error"in t)throw t.error;return t.result}default:{const t=(0,te.Ue)(o,zi);if("error"in t)throw t.error;return t.result}}}catch(t){throw new sr(t,"failed to get block")}}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=await this._rpcRequest("getBlockProduction",r),o=(0,te.Ue)(i,Or);if("error"in o)throw new sr(o.error,"failed to get block production information");return o.result}async getTransaction(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getTransaction",i),s=(0,te.Ue)(o,Wi);if("error"in s)throw new sr(s.error,"failed to get transaction");const a=s.result;return a?{...a,transaction:{...a.transaction,message:kr(a.version,a.transaction.message)}}:a}async getParsedTransaction(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getTransaction",i),s=(0,te.Ue)(o,Hi);if("error"in s)throw new sr(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,te.Ue)(t,Hi);if("error"in e)throw new sr(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,te.Ue)(t,Wi);if("error"in e)throw new sr(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:kr(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,te.Ue)(r,Yi);if("error"in i)throw new sr(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");const s={...o,transactions:o.transactions.map((({transaction:t,meta:e})=>{const n=new yn(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...s,transactions:s.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:Mn.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=await this._rpcRequest("getBlocks",r),o=(0,te.Ue)(i,wr((0,te.IX)((0,te.Rx)())));if("error"in o)throw new sr(o.error,"failed to get blocks");return o.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),i=(0,te.Ue)(r,Fi);if("error"in i)throw new sr(i.error,"failed to get block");const o=i.result;if(!o)throw new Error("Block "+t+" not found");return o}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,te.Ue)(r,Fi);if("error"in i)throw new sr(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");return o}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,te.Ue)(r,Wi);if("error"in i)throw new sr(i.error,"failed to get transaction");const o=i.result;if(!o)return o;const s=new yn(o.transaction.message),a=o.transaction.signatures;return{...o,transaction:Mn.populate(s,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,te.Ue)(r,Hi);if("error"in i)throw new sr(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=(0,te.Ue)(t,Hi);if("error"in e)throw new sr(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getConfirmedSignaturesForAddress2",r),o=(0,te.Ue)(i,ni);if("error"in o)throw new sr(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getSignaturesForAddress",r),o=(0,te.Ue)(i,ri);if("error"in o)throw new sr(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=new cr({key:t,state:cr.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=Yn.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),r=(0,te.Ue)(n,Ji);if("error"in r)throw new sr(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await Dn(100);const t=Date.now()-this._blockhashInfo.lastFetch>=mr;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await Dn(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,"base64",n),i=await this._rpcRequest("getStakeMinimumDelegation",r),o=(0,te.Ue)(i,_r((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(t,e,n){if("message"in t){const r=t.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(e)||void 0!==n)throw new Error("Invalid arguments");const s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment);const a=[o,s],u=await this._rpcRequest("simulateTransaction",a),c=(0,te.Ue)(u,Rr);if("error"in c)throw new Error("failed to simulate transaction: "+c.error.message);return c.result}let r;if(t instanceof Mn){let e=t;r=new Mn,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=Mn.populate(t),r._message=r._json=void 0;if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid arguments");const o=e;if(r.nonceInfo&&o)r.sign(...o);else{let t=this._disableBlockhashCaching;for(;;){const e=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=e.lastValidBlockHeight,r.recentBlockhash=e.blockhash,!o)break;if(r.sign(...o),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}t=!0}}const s=r._compile(),a=s.serialize(),u=r._serialize(a).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:s.nonProgramIds()).map((t=>t.toBase58()));c.accounts={encoding:"base64",addresses:t}}o&&(c.sigVerify=!0);const d=[u,c],l=await this._rpcRequest("simulateTransaction",d),h=(0,te.Ue)(l,Rr);if("error"in h){let t;if("data"in h.error&&(t=h.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(h.error.message,n)}throw new ir("failed to simulate transaction: "+h.error.message,t)}return h.result}async sendTransaction(t,e,n){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const n=t.serialize();return await this.sendRawTransaction(n,e)}if(void 0===e||!Array.isArray(e))throw new Error("Invalid arguments");const r=e;if(t.nonceInfo)t.sign(...r);else{let e=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(e);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...r),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}e=!0}}const i=t.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(t,e){const n=Fe(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],s=await this._rpcRequest("sendTransaction",o),a=(0,te.Ue)(s,Qi);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new ir("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(t,e){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,n!==e.state){const n=this._subscriptionStateChangeCallbacksByHash[t];n&&n.forEach((t=>{try{t(e.state)}catch{}}))}}_onSubscriptionStateChange(t,e){const n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(e),()=>{r.delete(e),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const e=await this._rpcWebSocket.call(i,r);this._setSubscription(t,{...n,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,ii);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=er([t.method,e],!0),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];mn(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,si);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,eo);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,ui);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,di);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,li);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),s=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,hi);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class io{constructor(t){this._keypair=void 0,this._keypair=t??Ne()}static generate(){return new io(Ne())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=ze(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new io({publicKey:n,secretKey:t})}static fromSeed(t){const e=ze(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new io({publicKey:e,secretKey:n})}get publicKey(){return new Je(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const oo=Object.freeze({CreateLookupTable:{index:0,layout:Jt.struct([Jt.u32("instruction"),Fn("recentSlot"),Jt.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Jt.struct([Jt.u32("instruction")])},ExtendLookupTable:{index:2,layout:Jt.struct([Jt.u32("instruction"),Fn(),Jt.seq(cn(),Jt.offset(Jt.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Jt.struct([Jt.u32("instruction")])},CloseLookupTable:{index:4,layout:Jt.struct([Jt.u32("instruction")])}});class so{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(oo))if(r.index==e){n=t;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);const{recentSlot:e}=Nn(oo.CreateLookupTable,t.data);return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error(`invalid instruction; found ${t.keys.length} keys, expected at least 2`);const{addresses:e}=Nn(oo.ExtendLookupTable,t.data);return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((t=>new Je(t)))}}static decodeCloseLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}static decodeFreezeLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static decodeDeactivateLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(ao.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(t,e){if(t.lengtht.toBytes()))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Kn.programId,isSigner:!1,isWritable:!1}),new kn({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=Cn(oo.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new kn({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=Cn(oo.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new kn({programId:this.programId,keys:n,data:e})}}ao.programId=new Je("AddressLookupTab1e1111111111111111111111111");class uo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u8("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(co))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=Nn(co.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=Nn(co.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=Nn(co.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=Nn(co.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(lo.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const co=Object.freeze({RequestUnits:{index:0,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("units"),Jt.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("units")])},SetComputeUnitPrice:{index:3,layout:Jt.struct([Jt.u8("instruction"),Fn("microLamports")])}});class lo{constructor(){}static requestUnits(t){const e=Cn(co.RequestUnits,t);return new kn({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=Cn(co.RequestHeapFrame,t);return new kn({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=Cn(co.SetComputeUnitLimit,t);return new kn({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=Cn(co.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new kn({keys:[],programId:this.programId,data:e})}}lo.programId=new Je("ComputeBudget111111111111111111111111111111");const ho=Jt.struct([Jt.u8("numSignatures"),Jt.u8("padding"),Jt.u16("signatureOffset"),Jt.u16("signatureInstructionIndex"),Jt.u16("publicKeyOffset"),Jt.u16("publicKeyInstructionIndex"),Jt.u16("messageDataOffset"),Jt.u16("messageDataSize"),Jt.u16("messageInstructionIndex")]);class fo{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:o}=t;mn(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),mn(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const s=ho.span,a=s+e.length,u=a+r.length,c=i.Buffer.alloc(u+n.length),d=null==o?65535:o;return ho.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,s),c.fill(r,a),c.fill(n,u),new kn({keys:[],programId:fo.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;mn(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=io.fromSecretKey(e),i=t.publicKey.toBytes(),o=je(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}fo.programId=new Je("Ed25519SigVerify111111111111111111111111111"),De.utils.isValidPrivateKey;const po=De.getPublicKey,mo=Jt.struct([Jt.u8("numSignatures"),Jt.u16("signatureOffset"),Jt.u8("signatureInstructionIndex"),Jt.u16("ethAddressOffset"),Jt.u8("ethAddressInstructionIndex"),Jt.u16("messageDataOffset"),Jt.u16("messageDataSize"),Jt.u8("messageInstructionIndex"),Jt.blob(20,"ethAddress"),Jt.blob(64,"signature"),Jt.u8("recoveryId")]);class go{constructor(){}static publicKeyToEthAddress(t){mn(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return i.Buffer.from(we(Fe(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return go.createInstructionWithEthAddress({ethAddress:go.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:o,instructionIndex:s=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?i.Buffer.from(e.substr(2),"hex"):i.Buffer.from(e,"hex"):e,mn(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,c=u+r.length+1,d=i.Buffer.alloc(mo.span+n.length);return mo.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:s,signature:Fe(r),ethAddress:Fe(a),recoveryId:o},d),d.fill(Fe(n),mo.span),new kn({keys:[],programId:go.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;mn(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=Fe(e),o=po(t,!1).slice(1),s=i.Buffer.from(we(Fe(n))),[a,u]=((t,e)=>{const n=De.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(s,t);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var yo;go.programId=new Je("KeccakSecp256k11111111111111111111111111111");const bo=new Je("StakeConfig11111111111111111111111111111111");class wo{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class _o{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}yo=_o,_o.default=new yo(0,0,Je.default);class vo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ko))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=Nn(ko.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new wo(new Je(e.staker),new Je(e.withdrawer)),lockup:new _o(n.unixTimestamp,n.epoch,new Je(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),Nn(ko.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=Nn(ko.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Je(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Nn(ko.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new Je(i),newAuthorizedPubkey:new Je(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Nn(ko.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(ko.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Nn(ko.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(ko.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(Ao.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.lengthJt.struct([cn("staker"),cn("withdrawer")],t))(),((t="lockup")=>Jt.struct([Jt.ns64("unixTimestamp"),Jt.ns64("epoch"),cn("custodian")],t))()])},Authorize:{index:1,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:Jt.struct([Jt.u32("instruction")])},Split:{index:3,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},Withdraw:{index:4,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},Deactivate:{index:5,layout:Jt.struct([Jt.u32("instruction")])},Merge:{index:7,layout:Jt.struct([Jt.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("stakeAuthorizationType"),ln("authoritySeed"),cn("authorityOwner")])}}),Mo=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Ao{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||_o.default,o=Cn(ko.Initialize,{authorized:{staker:Fe(n.staker.toBuffer()),withdrawer:Fe(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Fe(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new kn(s)}static createAccountWithSeed(t){const e=new Mn;e.add(Kn.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new Mn;e.add(Kn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=Cn(ko.Delegate);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:bo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=Cn(ko.Authorize,{newAuthorized:Fe(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=Cn(ko.AuthorizeWithSeed,{newAuthorized:Fe(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:Fe(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new Mn).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=Cn(ko.Split,{lamports:i});return new kn({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new Mn;return e.add(Kn.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:s}=t,a=new Mn;return a.add(Kn.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),a.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:s}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=Cn(ko.Merge);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=Cn(ko.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=Cn(ko.Deactivate);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}Ao.programId=new Je("Stake11111111111111111111111111111111111111"),Ao.space=200;class So{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}class Io{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(xo))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=Nn(xo.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new So(new Je(e.nodePubkey),new Je(e.authorizedVoter),new Je(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=Nn(xo.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Je(e),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:e,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Nn(xo.AuthorizeWithSeed,t.data);return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new Je(e),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new Je(r),voteAuthorizationType:{index:i},votePubkey:t.keys[0].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Nn(xo.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(To.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.lengthJt.struct([cn("nodePubkey"),cn("authorizedVoter"),cn("authorizedWithdrawer"),Jt.u8("commission")],t))()])},Authorize:{index:1,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},AuthorizeWithSeed:{index:10,layout:Jt.struct([Jt.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>Jt.struct([Jt.u32("voteAuthorizationType"),cn("currentAuthorityDerivedKeyOwnerPubkey"),ln("currentAuthorityDerivedKeySeed"),cn("newAuthorized")],t))()])}}),Eo=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class To{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=Cn(xo.InitializeAccount,{voteInit:{nodePubkey:Fe(r.nodePubkey.toBuffer()),authorizedVoter:Fe(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Fe(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new kn(o)}static createAccount(t){const e=new Mn;return e.add(Kn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=Cn(xo.Authorize,{newAuthorized:Fe(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=Cn(xo.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Fe(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Fe(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=Cn(xo.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return To.withdraw(t)}}To.programId=new Je("Vote111111111111111111111111111111111111111"),To.space=3731;const Po=new Je("Va1idator1nfo111111111111111111111111111111"),Bo=(0,te.dt)({name:(0,te.Z_)(),website:(0,te.jt)((0,te.Z_)()),details:(0,te.jt)((0,te.Z_)()),keybaseUsername:(0,te.jt)((0,te.Z_)())});class Lo{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==fn(e))return null;const n=[];for(let t=0;t<2;t++){const t=new Je(e.slice(0,Ze));e=e.slice(Ze);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(Po)&&n[1].isSigner){const t=ln().decode(i.Buffer.from(e)),r=JSON.parse(t);return(0,te.hu)(r,Bo),new Lo(n[1].publicKey,r)}return null}}const $o=new Je("Vote111111111111111111111111111111111111111"),Ro=Jt.struct([cn("nodePubkey"),cn("authorizedWithdrawer"),Jt.u8("commission"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("slot"),Jt.u32("confirmationCount")]),Jt.offset(Jt.u32(),-8),"votes"),Jt.u8("rootSlotValid"),Jt.nu64("rootSlot"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("epoch"),cn("authorizedVoter")]),Jt.offset(Jt.u32(),-8),"authorizedVoters"),Jt.struct([Jt.seq(Jt.struct([cn("authorizedPubkey"),Jt.nu64("epochOfLastAuthorizedSwitch"),Jt.nu64("targetEpoch")]),32,"buf"),Jt.nu64("idx"),Jt.u8("isEmpty")],"priorVoters"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("epoch"),Jt.nu64("credits"),Jt.nu64("prevCredits")]),Jt.offset(Jt.u32(),-8),"epochCredits"),Jt.struct([Jt.nu64("slot"),Jt.nu64("timestamp")],"lastTimestamp")]);class Oo{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=Ro.decode(Fe(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Oo({nodePubkey:new Je(e.nodePubkey),authorizedWithdrawer:new Je(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(Do),priorVoters:No(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function Do({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new Je(t)}}function Co({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new Je(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function No({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(Co),...t.slice(0,e).map(Co)]}const zo={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Uo(t,e){const n=!1===e?"http":"https";if(!t)return zo[n].devnet;const r=zo[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r}async function jo(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await t.sendRawTransaction(e,s),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(a,u),d=(await c).value;if(d.err)throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`);return a}const Yo=1e9},54654:(t,e,n)=>{"use strict";var r=n(48764).Buffer,i=n(64836);e.Z=void 0;var o=i(n(64687)),s=i(n(17156)),a=i(n(18698)),u=i(n(56690)),c=i(n(89728)),d=i(n(61655)),l=i(n(94993)),h=i(n(73808)),f=n(26729),p=n(77758);var m=function(t){(0,d.default)(b,t);var e,n,i,f,m,g,y=(m=b,g=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=(0,h.default)(m);if(g){var n=(0,h.default)(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return(0,l.default)(this,t)});function b(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;(0,u.default)(this,b);var s=r.autoconnect,a=void 0===s||s,c=r.reconnect,d=void 0===c||c,l=r.reconnect_interval,h=void 0===l?1e3:l,f=r.max_reconnects,m=void 0===f?5:f,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);in.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),b}(f.EventEmitter);e.Z=m},31991:(t,e,n)=>{"use strict";var r=n(64836);e.Z=function(t,e){return new c(t,e)};var i=r(n(56690)),o=r(n(89728)),s=r(n(61655)),a=r(n(94993)),u=r(n(73808));var c=function(t){(0,s.default)(c,t);var e,n,r=(e=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=(0,u.default)(e);if(n){var i=(0,u.default)(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return(0,a.default)(this,t)});function c(t,e,n){var o;return(0,i.default)(this,c),(o=r.call(this)).socket=new window.WebSocket(t,n),o.socket.onopen=function(){return o.emit("open")},o.socket.onmessage=function(t){return o.emit("message",t.data)},o.socket.onerror=function(t){return o.emit("error",t)},o.socket.onclose=function(t){o.emit("close",t.code,t.reason)},o}return(0,o.default)(c,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),c}(n(26729).EventEmitter)},77758:(t,e,n)=>{"use strict";var r=n(64836);Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDataPack=void 0,e.createError=function(t,e){var n={code:t,message:s.get(t)||"Internal Server Error"};return e&&(n.data=e),n};var i=r(n(56690)),o=r(n(89728)),s=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),a=function(){function t(){(0,i.default)(this,t)}return(0,o.default)(t,[{key:"encode",value:function(t){return JSON.stringify(t)}},{key:"decode",value:function(t){return JSON.parse(t)}}]),t}();e.DefaultDataPack=a},39386:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.s16=e.s8=e.nu64be=e.u48be=e.u40be=e.u32be=e.u24be=e.u16be=e.nu64=e.u48=e.u40=e.u32=e.u24=e.u16=e.u8=e.offset=e.greedy=e.Constant=e.UTF8=e.CString=e.Blob=e.Boolean=e.BitField=e.BitStructure=e.VariantLayout=e.Union=e.UnionLayoutDiscriminator=e.UnionDiscriminator=e.Structure=e.Sequence=e.DoubleBE=e.Double=e.FloatBE=e.Float=e.NearInt64BE=e.NearInt64=e.NearUInt64BE=e.NearUInt64=e.IntBE=e.Int=e.UIntBE=e.UInt=e.OffsetLayout=e.GreedyCount=e.ExternalLayout=e.bindConstructorLayout=e.nameWithProperty=e.Layout=e.uint8ArrayToBuffer=e.checkUint8Array=void 0,e.constant=e.utf8=e.cstr=e.blob=e.unionLayoutDiscriminator=e.union=e.seq=e.bits=e.struct=e.f64be=e.f64=e.f32be=e.f32=e.ns64be=e.s48be=e.s40be=e.s32be=e.s24be=e.s16be=e.ns64=e.s48=e.s40=e.s32=e.s24=void 0;const r=n(48764);function i(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function o(t){return i(t),r.Buffer.from(t.buffer,t.byteOffset,t.length)}e.checkUint8Array=i,e.uint8ArrayToBuffer=o;class s{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function a(t,e){return e.property?t+"["+e.property+"]":t}e.Layout=s,e.nameWithProperty=a,e.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof s))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,n)=>e.decode(t,n),writable:!0})};class u extends s{isCount(){throw new Error("ExternalLayout is abstract")}}e.ExternalLayout=u;class c extends u{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){i(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}e.GreedyCount=c;class d extends u{constructor(t,e=0,n){if(!(t instanceof s))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof l||this.layout instanceof h}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}e.OffsetLayout=d;class l extends s{constructor(t,e){if(super(t,e),6t+r.encode(i,e,n+t)),0);return this.count instanceof u&&this.count.encode(t.length,e,n),i}}e.Sequence=I;class x extends s{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof s),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e=0){i(t);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}e.Structure=x;class E{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}e.UnionDiscriminator=E;class T extends E{constructor(t,e){if(!(t instanceof u&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}e.UnionLayoutDiscriminator=T;class P extends s{constructor(t,e,n){let r;if(t instanceof l||t instanceof h)r=new T(new d(t));else if(t instanceof u&&t.isCount())r=new T(t);else{if(!(t instanceof E))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");r=t}if(void 0===e&&(e=null),!(null===e||e instanceof s))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof l||t instanceof h)&&(i+=r.layout.span)),super(i,n),this.discriminator=r,this.usesPrefixDiscriminator=t instanceof l||t instanceof h,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const r=this.discriminator,i=r.decode(t,e),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=o.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n=0){const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new B(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}e.Union=P;class B extends s{constructor(t,e,n,r){if(!(t instanceof P))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof s))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let r=0;return this.layout&&(r=this.layout.getSpan(t,e+n)),n+r}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function L(t){return 0>t&&(t+=4294967296),t}e.VariantLayout=B;class $ extends s{constructor(t,e,n){if(!(t instanceof l||t instanceof h))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==L(t&this.valueMask))throw new TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=L(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),o(t).slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof u&&(r=t.length),!(t instanceof Uint8Array&&r===t.length))throw new TypeError(a("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>e.length)throw new RangeError("encoding overruns Uint8Array");const i=o(t);return o(e).write(i.toString("hex"),n,r,"hex"),this.length instanceof u&&this.length.encode(r,e,n),r}}e.Blob=D;class C extends s{constructor(t){super(-1,t)}getSpan(t,e=0){i(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const a=o(e);return i.copy(a,n),a[n+s]=0,s+1}}e.CString=C;class N extends s{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return i(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return i.copy(o(e),n),s}}e.UTF8=N;class z extends s{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}e.Constant=z,e.greedy=(t,e)=>new c(t,e),e.offset=(t,e,n)=>new d(t,e,n),e.u8=t=>new l(1,t),e.u16=t=>new l(2,t),e.u24=t=>new l(3,t),e.u32=t=>new l(4,t),e.u40=t=>new l(5,t),e.u48=t=>new l(6,t),e.nu64=t=>new b(t),e.u16be=t=>new h(2,t),e.u24be=t=>new h(3,t),e.u32be=t=>new h(4,t),e.u40be=t=>new h(5,t),e.u48be=t=>new h(6,t),e.nu64be=t=>new w(t),e.s8=t=>new f(1,t),e.s16=t=>new f(2,t),e.s24=t=>new f(3,t),e.s32=t=>new f(4,t),e.s40=t=>new f(5,t),e.s48=t=>new f(6,t),e.ns64=t=>new _(t),e.s16be=t=>new p(2,t),e.s24be=t=>new p(3,t),e.s32be=t=>new p(4,t),e.s40be=t=>new p(5,t),e.s48be=t=>new p(6,t),e.ns64be=t=>new v(t),e.f32=t=>new k(t),e.f32be=t=>new M(t),e.f64=t=>new A(t),e.f64be=t=>new S(t),e.struct=(t,e,n)=>new x(t,e,n),e.bits=(t,e,n)=>new $(t,e,n),e.seq=(t,e,n)=>new I(t,e,n),e.union=(t,e,n)=>new P(t,e,n),e.unionLayoutDiscriminator=(t,e)=>new T(t,e),e.blob=(t,e)=>new D(t,e),e.cstr=t=>new C(t),e.utf8=(t,e)=>new N(t,e),e.constant=(t,e)=>new z(t,e)},18245:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Account:()=>Oe,AddressLookupTableAccount:()=>Vn,AddressLookupTableInstruction:()=>Hi,AddressLookupTableProgram:()=>Ki,Authorized:()=>ro,BLOCKHASH_CACHE_TIMEOUT_MS:()=>tr,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>De,BPF_LOADER_PROGRAM_ID:()=>Rn,BpfLoader:()=>On,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>Vi,ComputeBudgetInstruction:()=>qi,ComputeBudgetProgram:()=>Gi,Connection:()=>Yi,Ed25519Program:()=>Xi,Enum:()=>Ee,EpochSchedule:()=>Yn,FeeCalculatorLayout:()=>An,Keypair:()=>Fi,LAMPORTS_PER_SOL:()=>xo,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>Wi,Loader:()=>$n,Lockup:()=>io,MAX_SEED_LENGTH:()=>Be,Message:()=>en,MessageAccountKeys:()=>Fe,MessageV0:()=>nn,NONCE_ACCOUNT_LENGTH:()=>In,NonceAccount:()=>xn,PACKET_DATA_SIZE:()=>Ce,PUBLIC_KEY_LENGTH:()=>Le,PublicKey:()=>Re,SIGNATURE_LENGTH_IN_BYTES:()=>ze,SOLANA_SCHEMA:()=>Te,STAKE_CONFIG_ID:()=>no,STAKE_INSTRUCTION_LAYOUTS:()=>so,SYSTEM_INSTRUCTION_LAYOUTS:()=>Pn,SYSVAR_CLOCK_PUBKEY:()=>ln,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>hn,SYSVAR_INSTRUCTIONS_PUBKEY:()=>fn,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>pn,SYSVAR_RENT_PUBKEY:()=>mn,SYSVAR_REWARDS_PUBKEY:()=>gn,SYSVAR_SLOT_HASHES_PUBKEY:()=>yn,SYSVAR_SLOT_HISTORY_PUBKEY:()=>bn,SYSVAR_STAKE_HISTORY_PUBKEY:()=>wn,Secp256k1Program:()=>to,SendTransactionError:()=>Fn,SolanaJSONRPCError:()=>Hn,SolanaJSONRPCErrorCode:()=>Wn,StakeAuthorizationLayout:()=>ao,StakeInstruction:()=>oo,StakeProgram:()=>uo,Struct:()=>xe,SystemInstruction:()=>Tn,SystemProgram:()=>Bn,Transaction:()=>un,TransactionExpiredBlockheightExceededError:()=>Ue,TransactionExpiredNonceInvalidError:()=>Ye,TransactionExpiredTimeoutError:()=>je,TransactionInstruction:()=>an,TransactionMessage:()=>cn,TransactionStatus:()=>on,VALIDATOR_INFO_KEY:()=>mo,VERSION_PREFIX_MASK:()=>Ne,VOTE_PROGRAM_ID:()=>bo,ValidatorInfo:()=>yo,VersionedMessage:()=>rn,VersionedTransaction:()=>dn,VoteAccount:()=>_o,VoteAuthorizationLayout:()=>fo,VoteInit:()=>co,VoteInstruction:()=>lo,VoteProgram:()=>po,clusterApiUrl:()=>So,sendAndConfirmRawTransaction:()=>Io,sendAndConfirmTransaction:()=>_n});var r={};n.r(r),n.d(r,{gk:()=>S,dQ:()=>N,ci:()=>x,bytesToNumberBE:()=>L,ty:()=>$,eV:()=>C,n$:()=>j,ql:()=>D,hexToBytes:()=>B,_t:()=>A,tL:()=>R,S5:()=>O,FF:()=>F});var i=n(48764),o=n(4359);const s=BigInt(2**32-1),a=BigInt(32);function u(t,e=!1){return e?{h:Number(t&s),l:Number(t>>a&s)}:{h:0|Number(t>>a&s),l:0|Number(t&s)}}function c(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it<>>32-n,l=(t,e,n)=>e<>>32-n,h=(t,e,n)=>e<>>64-n,f=(t,e,n)=>t<>>64-n,p={fromBig:u,split:c,toBig:(t,e)=>BigInt(t>>>0)<>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:d,rotlSL:l,rotlBH:h,rotlBL:f,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)};var m=n(23486);const[g,y]=(()=>p.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),b=new Uint32Array(80),w=new Uint32Array(80);class _ extends o.VR{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)b[n]=t.getUint32(e),w[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|b[t-15],n=0|w[t-15],r=p.rotrSH(e,n,1)^p.rotrSH(e,n,8)^p.shrSH(e,n,7),i=p.rotrSL(e,n,1)^p.rotrSL(e,n,8)^p.shrSL(e,n,7),o=0|b[t-2],s=0|w[t-2],a=p.rotrSH(o,s,19)^p.rotrBH(o,s,61)^p.shrSH(o,s,6),u=p.rotrSL(o,s,19)^p.rotrBL(o,s,61)^p.shrSL(o,s,6),c=p.add4L(i,u,w[t-7],w[t-16]),d=p.add4H(c,r,a,b[t-7],b[t-16]);b[t]=0|d,w[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:m,Gl:_,Hh:v,Hl:k}=this;for(let t=0;t<80;t++){const e=p.rotrSH(d,l,14)^p.rotrSH(d,l,18)^p.rotrBH(d,l,41),M=p.rotrSL(d,l,14)^p.rotrSL(d,l,18)^p.rotrBL(d,l,41),A=d&h^~d&m,S=l&f^~l&_,I=p.add5L(k,M,S,y[t],w[t]),x=p.add5H(I,v,e,A,g[t],b[t]),E=0|I,T=p.rotrSH(n,r,28)^p.rotrBH(n,r,34)^p.rotrBH(n,r,39),P=p.rotrSL(n,r,28)^p.rotrBL(n,r,34)^p.rotrBL(n,r,39),B=n&i^n&s^i&s,L=r&o^r&a^o&a;v=0|m,k=0|_,m=0|h,_=0|f,h=0|d,f=0|l,({h:d,l}=p.add(0|u,0|c,0|x,0|E)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const $=p.add3L(E,P,L);n=p.add3H($,x,T,B),r=0|$}({h:n,l:r}=p.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=p.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=p.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=p.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=p.add(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=p.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:m,l:_}=p.add(0|this.Gh,0|this.Gl,0|m,0|_)),({h:v,l:k}=p.add(0|this.Hh,0|this.Hl,0|v,0|k)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,m,_,v,k)}roundClean(){b.fill(0),w.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const v=(0,m.hE)((()=>new _)),k=(BigInt(0),BigInt(1)),M=BigInt(2);function A(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}function S(t){if(!A(t))throw new Error("Uint8Array expected")}const I=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function x(t){S(t);let e="";for(let n=0;n=T._0&&t<=T._9?t-T._0:t>=T._A&&t<=T._F?t-(T._A-10):t>=T._a&&t<=T._f?t-(T._a-10):void 0}function B(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(M<new Uint8Array(t),U=t=>Uint8Array.from(t);function j(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=z(t),i=z(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=z())=>{i=a(U([0]),t),r=a(),0!==t.length&&(i=a(U([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const Y={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||A(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function F(t,e,n={}){const r=(e,n,r)=>{const i=Y[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const W=BigInt(0),H=BigInt(1),K=BigInt(2),q=BigInt(3),V=BigInt(4),G=BigInt(5),Z=BigInt(8);function X(t,e){const n=t%e;return n>=W?n:e+n}function J(t,e,n){if(n<=W||e 0");if(n===H)return W;let r=H;for(;e>W;)e&H&&(r=r*t%n),t=t*t%n,e>>=H;return r}function Q(t,e,n){let r=t;for(;e-- >W;)r*=r,r%=n;return r}function tt(t,e){if(t===W||e<=W)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=X(t,e),r=e,i=W,o=H,s=H,a=W;for(;n!==W;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==H)throw new Error("invert: does not exist");return X(i,e)}BigInt(9),BigInt(16);const et=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function nt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function rt(t,e,n=!1,r={}){if(t<=W)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=nt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%V===q){const e=(t+H)/V;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%Z===G){const e=(t-G)/Z;return function(t,n){const r=t.mul(n,K),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,K),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-H)/K;let n,r,i;for(n=t-H,r=0;n%K===W;n/=K,r++);for(i=K;iX(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return W<=e&&et===W,isOdd:t=>(t&H)===H,neg:e=>X(-e,t),eql:(t,e)=>t===e,sqr:e=>X(e*e,t),add:(e,n)=>X(e+n,t),sub:(e,n)=>X(e-n,t),mul:(e,n)=>X(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===W)return t.ONE;if(n===H)return e;let r=t.ONE,i=e;for(;n>W;)n&H&&(r=t.mul(r,i)),i=t.sqr(i),n>>=H;return r}(a,t,e),div:(e,n)=>X(e*tt(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>tt(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?O(t,o):R(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?$(t):L(t)}});return Object.freeze(a)}function it(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function ot(t){const e=it(t);return e+Math.ceil(e/2)}const st=BigInt(0),at=BigInt(1);function ut(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>st;)n&at&&(r=r.add(i)),i=i.double(),n>>=at;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=at);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function ct(t){return F(t.Fp,et.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),F(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const dt=BigInt(0),lt=BigInt(1),ht=BigInt(2),ft=BigInt(8),pt={zip215:!0};function mt(t){const e=function(t){const e=ct(t);return F(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=ht<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:dt}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&dtp(t)&&p(e)&&tt===dt||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===dt?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,lt,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(ht*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===dt)return this.double();const r=d(s*ht*h),f=d(a*ht*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===dt?M:this.equals(M)||e===lt?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?ft:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:dt,y:lt};if(u!==lt)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===lt?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=D("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=$(a);h===dt||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-lt),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b<)===lt,_=0!=(128&u);if(!r&&b===dt&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return E(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=O(e,n.BYTES);return r[r.length-1]|=t<?128:0,r}toHex(){return x(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,lt,d(e.Gx*e.Gy)),v.ZERO=new v(dt,lt,lt,dt);const{BASE:k,ZERO:M}=v,A=ut(v,8*a);function S(t){return X(t,r)}function I(t){return S($(t))}function E(t){const e=a;t=D("private key",t,e);const n=D("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function T(t=new Uint8Array,...e){const n=C(...e);return I(o(f(n,D("context",t),!!i)))}const P=pt;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return E(t).pointBytes},sign:function(t,e,r={}){t=D("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=E(e),c=T(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+T(r.context,d,u,t)*s);return b(l),D("result",C(d,O(l,n.BYTES)),2*a)},verify:function(t,e,r,o=P){const{context:s,zip215:a}=o,u=n.BYTES;t=D("signature",t,2*u),e=D("message",e),i&&(e=i(e));const c=$(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=T(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:E,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const gt=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),yt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),bt=(BigInt(0),BigInt(1)),wt=BigInt(2),_t=BigInt(5),vt=BigInt(10),kt=BigInt(20),Mt=BigInt(40),At=BigInt(80);const St=rt(gt,void 0,!0),It=mt({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:St,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:v,randomBytes:m.O6,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=gt,r=X(e*e*e,n),i=X(r*r*e,n);let o=X(t*r*function(t){const e=gt,n=t*t%e*t%e,r=Q(n,wt,e)*n%e,i=Q(r,bt,e)*t%e,o=Q(i,_t,e)*i%e,s=Q(o,vt,e)*o%e,a=Q(s,kt,e)*s%e,u=Q(a,Mt,e)*a%e,c=Q(u,At,e)*u%e,d=Q(c,At,e)*u%e,l=Q(d,vt,e)*o%e;return{pow_p_5_8:Q(l,wt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=X(e*o*o,n),a=o,u=X(o*yt,n),c=s===t,d=s===X(-t,n),l=s===X(-t*yt,n);return c&&(o=a),(d||l)&&(o=u),(X(o,n)&H)===H&&(o=X(-o,n)),{isValid:c||d,value:o}}});const xt=(St.ORDER+BigInt(3))/BigInt(8);St.pow(wt,xt),St.sqrt(St.neg(St.ONE)),St.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(St,St.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Et=n(13550),Tt=n.n(Et),Pt=n(77191),Bt=n.n(Pt),Lt=n(17748),$t=n(25532),Rt=n(39386),Ot=n(40475),Dt=n(53471),Ct=n(31198),Nt=n.n(Ct),zt=n(66855),Ut=n(89062),jt=n(93527);const Yt=[],Ft=[],Wt=[],Ht=BigInt(0),Kt=BigInt(1),qt=BigInt(2),Vt=BigInt(7),Gt=BigInt(256),Zt=BigInt(113);for(let t=0,e=Kt,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],Yt.push(2*(5*r+n)),Ft.push((t+1)*(t+2)/2%64);let i=Ht;for(let t=0;t<7;t++)e=(e<>Vt)*Zt)%Gt,e&qt&&(i^=Kt<<(Kt<n>32?h(t,e,n):d(t,e,n),te=(t,e,n)=>n>32?f(t,e,n):l(t,e,n);class ee extends m.kb{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,jt.Rx)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,m.Jq)(this.state)}keccak(){m.iA||(0,m.l1)(this.state32),function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=Qt(o,s,1)^n[r],u=te(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=Ft[n],o=Qt(e,i,r),s=te(e,i,r),a=Yt[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=Xt[r],t[1]^=Jt[r]}n.fill(0)}(this.state32,this.rounds),m.iA||(0,m.l1)(this.state32),this.posOut=0,this.pos=0}update(t){(0,jt.Gg)(this);const{blockLen:e,state:n}=this,r=(t=(0,m.O0)(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,jt.Rx)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,jt.J8)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new ee(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const ne=((t,e,n)=>(0,m.hE)((()=>new ee(e,t,n))))(1,136,32);class re extends m.kb{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,jt.vp)(t);const n=(0,m.O0)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew re(t,e).update(n).digest();ie.create=(t,e)=>new re(t,e);const{bytesToNumberBE:oe,hexToBytes:se}=r,ae={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=ae;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:oe(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=ae,n="string"==typeof t?se(t):t;S(n);let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=ae._parseInt(n.subarray(2)),{d:s,l:a}=ae._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},ue=BigInt(0),ce=BigInt(1),de=(BigInt(2),BigInt(3));function le(t){const e=function(t){const e=ct(t);return F(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return X(t,r)}function a(t){return tt(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=ct(t);F(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return C(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&uen.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(D("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,de),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,de);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===ue)return r;if(a(t),t===ce)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>ue||c>ue;)s&ce&&(d=d.add(p)),c&ce&&(h=h.add(p)),p=p.double(),s>>=ce,c>>=ce;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==ue&&e!==ce&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===ce)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===ce?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return x(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=ut(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=C;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=L(s);if(!(ue<(a=t)&&ax(R(t,e.nByteLength));function f(t){return t>r>>ce}const p=(t,e,n)=>L(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=D("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=ae.toSig(D("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(D("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return B(this.toDERHex())}toDERHex(){return ae.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return B(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=ot(e.n);return function(t,e,n=!1){const r=t.length,i=it(e),o=ot(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=X(n?L(t):$(t),e-H)+H;return n?O(s,i):R(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=A(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=L(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=N(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(ue<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return R(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=D("msgHash",t),p&&(t=D("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g&&!1!==g){const t=!0===g?d(n.BYTES):g;M.push(D("extraEntropy",t))}const A=C(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===ue)return;const o=s(n*s(S+i*_));if(o===ue)return;let c=(r.x===i?0:2)|Number(r.y&ce),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return j(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=D("msgHash",n),r=D("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||A(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof ae.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function he(t){return{hash:t,hmac:(e,...n)=>ie(t,e,(0,m.eV)(...n)),randomBytes:m.O6}}BigInt(4);const fe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),pe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),me=BigInt(1),ge=BigInt(2),ye=(t,e)=>(t+e/ge)/e;const be=rt(fe,void 0,void 0,{sqrt:function(t){const e=fe,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=Q(d,n,e)*d%e,h=Q(l,n,e)*d%e,f=Q(h,ge,e)*c%e,p=Q(f,i,e)*f%e,m=Q(p,o,e)*p%e,g=Q(m,a,e)*m%e,y=Q(g,u,e)*g%e,b=Q(y,a,e)*m%e,w=Q(b,n,e)*d%e,_=Q(w,s,e)*p%e,v=Q(_,r,e)*c%e,k=Q(v,ge,e);if(!be.eql(be.sqr(k),t))throw new Error("Cannot find square root");return k}}),we=function(t,e){const n=e=>le({...t,...he(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:be,n:pe,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=pe,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-me*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=ye(o*t,e),u=ye(-r*t,e);let c=X(t-a*n-u*i,e),d=X(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},Lt.J);BigInt(0),we.ProjectivePoint;const _e=It.utils.randomPrivateKey,ve=()=>{const t=It.utils.randomPrivateKey(),e=ke(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},ke=It.getPublicKey;function Me(t){try{return It.ExtendedPoint.fromHex(t),!0}catch{return!1}}const Ae=(t,e)=>It.sign(t,e.slice(0,32)),Se=It.verify,Ie=t=>i.Buffer.isBuffer(t)?t:t instanceof Uint8Array?i.Buffer.from(t.buffer,t.byteOffset,t.byteLength):i.Buffer.from(t);class xe{constructor(t){Object.assign(this,t)}encode(){return i.Buffer.from((0,$t.serialize)(Te,this))}static decode(t){return(0,$t.deserialize)(Te,this,t)}static decodeUnchecked(t){return(0,$t.deserializeUnchecked)(Te,this,t)}}class Ee extends xe{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}}const Te=new Map;var Pe;const Be=32,Le=32;let $e=1;class Re extends xe{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Bt().decode(t);if(e.length!=Le)throw new Error("Invalid public key input");this._bn=new(Tt())(e)}else this._bn=new(Tt())(t);if(this._bn.byteLength()>Le)throw new Error("Invalid public key input")}}static unique(){const t=new Re($e);return $e+=1,new Re(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Bt().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(i.Buffer);if(t.length===Le)return t;const e=i.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=i.Buffer.concat([t.toBuffer(),i.Buffer.from(e),n.toBuffer()]),o=(0,Lt.J)(r);return new Re(o)}static createProgramAddressSync(t,e){let n=i.Buffer.alloc(0);t.forEach((function(t){if(t.length>Be)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Ie(t)])})),n=i.Buffer.concat([n,e.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=(0,Lt.J)(n);if(Me(r))throw new Error("Invalid seeds, address must fall off the curve");return new Re(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const o=t.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return Me(new Re(t).toBytes())}}Pe=Re,Re.default=new Pe("11111111111111111111111111111111"),Te.set(Re,{kind:"struct",fields:[["_bn","u256"]]});class Oe{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=Ie(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Ie(_e()),this._publicKey=Ie(ke(this._secretKey))}get publicKey(){return new Re(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const De=new Re("BPFLoader1111111111111111111111111111111111"),Ce=1232,Ne=127,ze=64;class Ue extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Ue.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class je extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(je.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Ye extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Ye.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class Fe{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const We=(t="publicKey")=>Rt.blob(32,t),He=(t="signature")=>Rt.blob(64,t),Ke=(t="string")=>{const e=Rt.struct([Rt.u32("length"),Rt.u32("lengthPadding"),Rt.blob(Rt.offset(Rt.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),o=e;return o.decode=(t,e)=>n(t,e).chars.toString(),o.encode=(t,e,n)=>{const o={chars:i.Buffer.from(t,"utf8")};return r(o,e,n)},o.alloc=t=>Rt.u32().span+Rt.u32().span+i.Buffer.from(t,"utf8").length,o};function qe(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return qe({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function Ve(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function Ge(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function Ze(t,e){if(!t)throw new Error(e||"Assertion failed")}class Xe{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new Xe(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];Ze(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{Ze(e.length>0,"Expected at least one writable signer key");const[t]=e[0];Ze(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Re(t))),...n.map((([t])=>new Re(t))),...r.map((([t])=>new Re(t))),...i.map((([t])=>new Re(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Re(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(Ze(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}const Je="Reached end of buffer unexpectedly";function Qe(t){if(0===t.length)throw new Error(Je);return t.shift()}function tn(t,...e){const[n]=e;if(2===e.length?n+(e[1]??0)>t.length:n>=t.length)throw new Error(Je);return t.splice(...e)}class en{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Re(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Bt().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new Fe(this.staticAccountKeys)}static compile(t){const e=Xe.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new Fe(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Bt().encode(t.data)})));return new en({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];Ge(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Bt().decode(t.data));let o=[];Ge(o,e.length);let s=[];return Ge(s,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:e,dataLength:i.Buffer.from(s),data:r}}));let r=[];Ge(r,n.length);let o=i.Buffer.alloc(Ce);i.Buffer.from(r).copy(o);let s=r.length;n.forEach((t=>{const e=Rt.struct([Rt.u8("programIdIndex"),Rt.blob(t.keyIndicesCount.length,"keyIndicesCount"),Rt.seq(Rt.u8("keyIndex"),t.keyIndices.length,"keyIndices"),Rt.blob(t.dataLength.length,"dataLength"),Rt.seq(Rt.u8("userdatum"),t.data.length,"data")]).encode(t,o,s);s+=e})),o=o.slice(0,s);const a=Rt.struct([Rt.blob(1,"numRequiredSignatures"),Rt.blob(1,"numReadonlySignedAccounts"),Rt.blob(1,"numReadonlyUnsignedAccounts"),Rt.blob(e.length,"keyCount"),Rt.seq(We("key"),t,"keys"),We("recentBlockhash")]),u={numRequiredSignatures:i.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:i.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:i.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:i.Buffer.from(e),keys:this.accountKeys.map((t=>Ie(t.toBytes()))),recentBlockhash:Bt().decode(this.recentBlockhash)};let c=i.Buffer.alloc(2048);const d=a.encode(u,c);return o.copy(c,d),c.slice(0,d+o.length)}static from(t){let e=[...t];const n=Qe(e);if(n!==(n&Ne))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=Qe(e),o=Qe(e),s=Ve(e);let a=[];for(let t=0;t0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Fe(this.staticAccountKeys,e)}isAccountSigner(t){return t=n?t-nt+e.writableIndexes.length),0):t>=this.header.numRequiredSignatures?t-et.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const t of n.writableIndexes){if(!(tt.toBytes())),recentBlockhash:Bt().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let t=0;const e=new Uint8Array(Ce);for(const n of this.compiledInstructions){const r=Array();Ge(r,n.accountKeyIndexes.length);const i=Array();Ge(i,n.data.length),t+=Rt.struct([Rt.u8("programIdIndex"),Rt.blob(r.length,"encodedAccountKeyIndexesLength"),Rt.seq(Rt.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),Rt.blob(i.length,"encodedDataLength"),Rt.blob(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(Ce);for(const n of this.addressTableLookups){const r=Array();Ge(r,n.writableIndexes.length);const i=Array();Ge(i,n.readonlyIndexes.length),t+=Rt.struct([We("accountKey"),Rt.blob(r.length,"encodedWritableIndexesLength"),Rt.seq(Rt.u8(),n.writableIndexes.length,"writableIndexes"),Rt.blob(i.length,"encodedReadonlyIndexesLength"),Rt.seq(Rt.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=Qe(e),r=n&Ne;Ze(n!==r,"Expected versioned message but received legacy message"),Ze(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:Qe(e),numReadonlySignedAccounts:Qe(e),numReadonlyUnsignedAccounts:Qe(e)},o=[],s=Ve(e);for(let t=0;t{const e=rn.deserializeMessageVersion(t);if("legacy"===e)return en.from(t);if(0===e)return nn.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let on=function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t}({});const sn=i.Buffer.alloc(ze).fill(0);class an{constructor(t){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class un{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new an(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Re(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Bt().encode(e)}}));return f.forEach((t=>{Ze(t.programIdIndex>=0),t.accounts.forEach((t=>Ze(t>=0)))})),new en({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=Ae(n,t.secretKey);this._addSignature(t.publicKey,Ie(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){Ze(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=i.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):Se(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];Ge(n,e.length);const r=n.length+64*e.length+t.length,o=i.Buffer.alloc(r);return Ze(e.length<256),i.Buffer.from(n).copy(o,0),e.forEach((({signature:t},e)=>{null!==t&&(Ze(64===t.length,"signature has invalid length"),i.Buffer.from(t).copy(o,n.length+64*e))})),t.copy(o,n.length+64*e.length),Ze(o.length<=Ce,`Transaction too large: ${o.length} > ${Ce}`),o}get keys(){return Ze(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return Ze(1===this.instructions.length),this.instructions[0].programId}get data(){return Ze(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=Ve(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Bt().encode(sn)?null:Bt().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new an({keys:r,programId:t.accountKeys[e.programIdIndex],data:Bt().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}class cn{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:r,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;Ze(u>0,"Message header is invalid");const c=t.staticAccountKeys.length-o-a;Ze(c>=0,"Message header is invalid");const d=t.getAccountKeys(e),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const t of r){const e=[];for(const r of t.accountKeyIndexes){const t=d.get(r);if(void 0===t)throw new Error(`Failed to find key for account key index ${r}`);let i;i=rt.equals(r.publicKey)));Ze(t>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[t]=Ae(e,r.secretKey)}}addSignature(t,e){Ze(64===e.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((e=>e.equals(t)));Ze(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const ln=new Re("SysvarC1ock11111111111111111111111111111111"),hn=new Re("SysvarEpochSchedu1e111111111111111111111111"),fn=new Re("Sysvar1nstructions1111111111111111111111111"),pn=new Re("SysvarRecentB1ockHashes11111111111111111111"),mn=new Re("SysvarRent111111111111111111111111111111111"),gn=new Re("SysvarRewards111111111111111111111111111111"),yn=new Re("SysvarS1otHashes111111111111111111111111111"),bn=new Re("SysvarS1otHistory11111111111111111111111111"),wn=new Re("SysvarStakeHistory1111111111111111111111111");async function _n(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function vn(t){return new Promise((e=>setTimeout(e,t)))}function kn(t,e){const n=t.layout.span>=0?t.layout.span:qe(t,e),r=i.Buffer.alloc(n),o=Object.assign({instruction:t.index},e);return t.layout.encode(o,r),r}function Mn(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const An=Rt.nu64("lamportsPerSignature"),Sn=Rt.struct([Rt.u32("version"),Rt.u32("state"),We("authorizedPubkey"),We("nonce"),Rt.struct([An],"feeCalculator")]),In=Sn.span;class xn{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=Sn.decode(Ie(t),0);return new xn({authorizedPubkey:new Re(e.authorizedPubkey),nonce:new Re(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const En=(8,t=>{const e=(0,Rt.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return(0,Ot.toBigIntLE)(i.Buffer.from(n))},o.encode=(t,e,r)=>{const i=(0,Ot.toBufferLE)(t,8);return n(i,e,r)},o});class Tn{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Pn))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=Mn(Pn.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new Re(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=Mn(Pn.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=Mn(Pn.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new Re(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=Mn(Pn.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=Mn(Pn.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Re(e),seed:n,space:r,programId:new Re(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=Mn(Pn.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new Re(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=Mn(Pn.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Re(e),seed:n,programId:new Re(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=Mn(Pn.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new Re(e),seed:n,lamports:r,space:i,programId:new Re(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=Mn(Pn.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new Re(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Mn(Pn.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Mn(Pn.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=Mn(Pn.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new Re(e)}}static checkProgramId(t){if(!t.equals(Bn.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length0?i:1,space:o.length,programId:r}));null!==a&&await _n(t,a,[e,n],{commitment:"confirmed"})}const s=Rt.struct([Rt.u32("instruction"),Rt.u32("offset"),Rt.u32("bytesLength"),Rt.u32("bytesLengthPadding"),Rt.seq(Rt.u8("byte"),Rt.offset(Rt.u32(),-8),"bytes")]),a=$n.chunkSize;let u=0,c=o,d=[];for(;c.length>0;){const o=c.slice(0,a),l=i.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:o,bytesLength:0,bytesLengthPadding:0},l);const h=(new un).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push(_n(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await vn(1e3/t)}u+=a,c=c.slice(a)}await Promise.all(d);{const o=Rt.struct([Rt.u32("instruction")]),s=i.Buffer.alloc(o.span);o.encode({instruction:1},s);const a=(new un).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:mn,isSigner:!1,isWritable:!1}],programId:r,data:s}),u="processed",c=await t.sendTransaction(a,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}$n.chunkSize=Ln;const Rn=new Re("BPFLoader2111111111111111111111111111111111");class On{static getMinNumSignatures(t){return $n.getMinNumSignatures(t)}static load(t,e,n,r,i){return $n.load(t,e,n,i,r)}}function Dn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cn=Object.prototype.toString,Nn=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function zn(t,e){var n,r,i,o,s,a,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return zn(t.toJSON(),e);if("[object Array]"===(u=Cn.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=zn(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Nn(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}class Yn{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32)))-jn(32)-1;return[n,t-(this.getSlotsInEpoch(n)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}var e}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const n=(0,Ut.Z)(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in n?n.socket:n,n}),t,e,n),this.underlyingSocket=void 0}call(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class Vn{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${t.index}`);return n}(Gn,t),n=t.length-56;Ze(n>=0,"lookup table is invalid"),Ze(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=Rt.struct([Rt.seq(We(),r,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new Re(e.authority[0]):void 0,addresses:i.map((t=>new Re(t)))}}}const Gn={index:1,layout:Rt.struct([Rt.u32("typeIndex"),En("deactivationSlot"),Rt.nu64("lastExtendedSlot"),Rt.u8("lastExtendedStartIndex"),Rt.u8(),Rt.seq(We(),Rt.offset(Rt.u8(),-1),"authority")])},Zn=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,Xn=(0,Dt.oQ)((0,Dt.eE)(Re),(0,Dt.Z_)(),(t=>new Re(t))),Jn=(0,Dt.bc)([(0,Dt.Z_)(),(0,Dt.i0)("base64")]),Qn=(0,Dt.oQ)((0,Dt.eE)(i.Buffer),Jn,(t=>i.Buffer.from(t[0],"base64"))),tr=3e4;function er(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function nr(t){return(0,Dt.G0)([(0,Dt.dt)({jsonrpc:(0,Dt.i0)("2.0"),id:(0,Dt.Z_)(),result:t}),(0,Dt.dt)({jsonrpc:(0,Dt.i0)("2.0"),id:(0,Dt.Z_)(),error:(0,Dt.dt)({code:(0,Dt._4)(),message:(0,Dt.Z_)(),data:(0,Dt.jt)((0,Dt.Yj)())})})])}const rr=nr((0,Dt._4)());function ir(t){return(0,Dt.oQ)(nr(t),rr,(e=>"error"in e?e:{...e,result:(0,Dt.Ue)(e.result,t)}))}function or(t){return ir((0,Dt.dt)({context:(0,Dt.dt)({slot:(0,Dt.Rx)()}),value:t}))}function sr(t){return(0,Dt.dt)({context:(0,Dt.dt)({slot:(0,Dt.Rx)()}),value:t})}function ar(t,e){return 0===t?new nn({header:e.header,staticAccountKeys:e.accountKeys.map((t=>new Re(t))),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Bt().decode(t.data)}))),addressTableLookups:e.addressTableLookups}):new en(e)}const ur=(0,Dt.dt)({foundation:(0,Dt.Rx)(),foundationTerm:(0,Dt.Rx)(),initial:(0,Dt.Rx)(),taper:(0,Dt.Rx)(),terminal:(0,Dt.Rx)()}),cr=ir((0,Dt.IX)((0,Dt.AG)((0,Dt.dt)({epoch:(0,Dt.Rx)(),effectiveSlot:(0,Dt.Rx)(),amount:(0,Dt.Rx)(),postBalance:(0,Dt.Rx)(),commission:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)()))})))),dr=(0,Dt.IX)((0,Dt.dt)({slot:(0,Dt.Rx)(),prioritizationFee:(0,Dt.Rx)()})),lr=(0,Dt.dt)({total:(0,Dt.Rx)(),validator:(0,Dt.Rx)(),foundation:(0,Dt.Rx)(),epoch:(0,Dt.Rx)()}),hr=(0,Dt.dt)({epoch:(0,Dt.Rx)(),slotIndex:(0,Dt.Rx)(),slotsInEpoch:(0,Dt.Rx)(),absoluteSlot:(0,Dt.Rx)(),blockHeight:(0,Dt.jt)((0,Dt.Rx)()),transactionCount:(0,Dt.jt)((0,Dt.Rx)())}),fr=(0,Dt.dt)({slotsPerEpoch:(0,Dt.Rx)(),leaderScheduleSlotOffset:(0,Dt.Rx)(),warmup:(0,Dt.O7)(),firstNormalEpoch:(0,Dt.Rx)(),firstNormalSlot:(0,Dt.Rx)()}),pr=(0,Dt.IM)((0,Dt.Z_)(),(0,Dt.IX)((0,Dt.Rx)())),mr=(0,Dt.AG)((0,Dt.G0)([(0,Dt.dt)({}),(0,Dt.Z_)()])),gr=(0,Dt.dt)({err:mr}),yr=(0,Dt.i0)("receivedSignature"),br=(0,Dt.dt)({"solana-core":(0,Dt.Z_)(),"feature-set":(0,Dt.jt)((0,Dt.Rx)())}),wr=or((0,Dt.dt)({err:(0,Dt.AG)((0,Dt.G0)([(0,Dt.dt)({}),(0,Dt.Z_)()])),logs:(0,Dt.AG)((0,Dt.IX)((0,Dt.Z_)())),accounts:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.AG)((0,Dt.dt)({executable:(0,Dt.O7)(),owner:(0,Dt.Z_)(),lamports:(0,Dt.Rx)(),data:(0,Dt.IX)((0,Dt.Z_)()),rentEpoch:(0,Dt.jt)((0,Dt.Rx)())}))))),unitsConsumed:(0,Dt.jt)((0,Dt.Rx)()),returnData:(0,Dt.jt)((0,Dt.AG)((0,Dt.dt)({programId:(0,Dt.Z_)(),data:(0,Dt.bc)([(0,Dt.Z_)(),(0,Dt.i0)("base64")])})))})),_r=or((0,Dt.dt)({byIdentity:(0,Dt.IM)((0,Dt.Z_)(),(0,Dt.IX)((0,Dt.Rx)())),range:(0,Dt.dt)({firstSlot:(0,Dt.Rx)(),lastSlot:(0,Dt.Rx)()})})),vr=ir(ur),kr=ir(lr),Mr=ir(dr),Ar=ir(hr),Sr=ir(fr),Ir=ir(pr),xr=ir((0,Dt.Rx)()),Er=or((0,Dt.dt)({total:(0,Dt.Rx)(),circulating:(0,Dt.Rx)(),nonCirculating:(0,Dt.Rx)(),nonCirculatingAccounts:(0,Dt.IX)(Xn)})),Tr=(0,Dt.dt)({amount:(0,Dt.Z_)(),uiAmount:(0,Dt.AG)((0,Dt.Rx)()),decimals:(0,Dt.Rx)(),uiAmountString:(0,Dt.jt)((0,Dt.Z_)())}),Pr=or((0,Dt.IX)((0,Dt.dt)({address:Xn,amount:(0,Dt.Z_)(),uiAmount:(0,Dt.AG)((0,Dt.Rx)()),decimals:(0,Dt.Rx)(),uiAmountString:(0,Dt.jt)((0,Dt.Z_)())}))),Br=or((0,Dt.IX)((0,Dt.dt)({pubkey:Xn,account:(0,Dt.dt)({executable:(0,Dt.O7)(),owner:Xn,lamports:(0,Dt.Rx)(),data:Qn,rentEpoch:(0,Dt.Rx)()})}))),Lr=(0,Dt.dt)({program:(0,Dt.Z_)(),parsed:(0,Dt._4)(),space:(0,Dt.Rx)()}),$r=or((0,Dt.IX)((0,Dt.dt)({pubkey:Xn,account:(0,Dt.dt)({executable:(0,Dt.O7)(),owner:Xn,lamports:(0,Dt.Rx)(),data:Lr,rentEpoch:(0,Dt.Rx)()})}))),Rr=or((0,Dt.IX)((0,Dt.dt)({lamports:(0,Dt.Rx)(),address:Xn}))),Or=(0,Dt.dt)({executable:(0,Dt.O7)(),owner:Xn,lamports:(0,Dt.Rx)(),data:Qn,rentEpoch:(0,Dt.Rx)()}),Dr=(0,Dt.dt)({pubkey:Xn,account:Or}),Cr=(0,Dt.oQ)((0,Dt.G0)([(0,Dt.eE)(i.Buffer),Lr]),(0,Dt.G0)([Jn,Lr]),(t=>Array.isArray(t)?(0,Dt.Ue)(t,Qn):t)),Nr=(0,Dt.dt)({executable:(0,Dt.O7)(),owner:Xn,lamports:(0,Dt.Rx)(),data:Cr,rentEpoch:(0,Dt.Rx)()}),zr=(0,Dt.dt)({pubkey:Xn,account:Nr}),Ur=(0,Dt.dt)({state:(0,Dt.G0)([(0,Dt.i0)("active"),(0,Dt.i0)("inactive"),(0,Dt.i0)("activating"),(0,Dt.i0)("deactivating")]),active:(0,Dt.Rx)(),inactive:(0,Dt.Rx)()}),jr=ir((0,Dt.IX)((0,Dt.dt)({signature:(0,Dt.Z_)(),slot:(0,Dt.Rx)(),err:mr,memo:(0,Dt.AG)((0,Dt.Z_)()),blockTime:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)()))}))),Yr=ir((0,Dt.IX)((0,Dt.dt)({signature:(0,Dt.Z_)(),slot:(0,Dt.Rx)(),err:mr,memo:(0,Dt.AG)((0,Dt.Z_)()),blockTime:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)()))}))),Fr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:sr(Or)}),Wr=(0,Dt.dt)({pubkey:Xn,account:Or}),Hr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:sr(Wr)}),Kr=(0,Dt.dt)({parent:(0,Dt.Rx)(),slot:(0,Dt.Rx)(),root:(0,Dt.Rx)()}),qr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:Kr}),Vr=(0,Dt.G0)([(0,Dt.dt)({type:(0,Dt.G0)([(0,Dt.i0)("firstShredReceived"),(0,Dt.i0)("completed"),(0,Dt.i0)("optimisticConfirmation"),(0,Dt.i0)("root")]),slot:(0,Dt.Rx)(),timestamp:(0,Dt.Rx)()}),(0,Dt.dt)({type:(0,Dt.i0)("createdBank"),parent:(0,Dt.Rx)(),slot:(0,Dt.Rx)(),timestamp:(0,Dt.Rx)()}),(0,Dt.dt)({type:(0,Dt.i0)("frozen"),slot:(0,Dt.Rx)(),timestamp:(0,Dt.Rx)(),stats:(0,Dt.dt)({numTransactionEntries:(0,Dt.Rx)(),numSuccessfulTransactions:(0,Dt.Rx)(),numFailedTransactions:(0,Dt.Rx)(),maxTransactionsPerEntry:(0,Dt.Rx)()})}),(0,Dt.dt)({type:(0,Dt.i0)("dead"),slot:(0,Dt.Rx)(),timestamp:(0,Dt.Rx)(),err:(0,Dt.Z_)()})]),Gr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:Vr}),Zr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:sr((0,Dt.G0)([gr,yr]))}),Xr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:(0,Dt.Rx)()}),Jr=(0,Dt.dt)({pubkey:(0,Dt.Z_)(),gossip:(0,Dt.AG)((0,Dt.Z_)()),tpu:(0,Dt.AG)((0,Dt.Z_)()),rpc:(0,Dt.AG)((0,Dt.Z_)()),version:(0,Dt.AG)((0,Dt.Z_)())}),Qr=(0,Dt.dt)({votePubkey:(0,Dt.Z_)(),nodePubkey:(0,Dt.Z_)(),activatedStake:(0,Dt.Rx)(),epochVoteAccount:(0,Dt.O7)(),epochCredits:(0,Dt.IX)((0,Dt.bc)([(0,Dt.Rx)(),(0,Dt.Rx)(),(0,Dt.Rx)()])),commission:(0,Dt.Rx)(),lastVote:(0,Dt.Rx)(),rootSlot:(0,Dt.AG)((0,Dt.Rx)())}),ti=ir((0,Dt.dt)({current:(0,Dt.IX)(Qr),delinquent:(0,Dt.IX)(Qr)})),ei=(0,Dt.G0)([(0,Dt.i0)("processed"),(0,Dt.i0)("confirmed"),(0,Dt.i0)("finalized")]),ni=(0,Dt.dt)({slot:(0,Dt.Rx)(),confirmations:(0,Dt.AG)((0,Dt.Rx)()),err:mr,confirmationStatus:(0,Dt.jt)(ei)}),ri=or((0,Dt.IX)((0,Dt.AG)(ni))),ii=ir((0,Dt.Rx)()),oi=(0,Dt.dt)({accountKey:Xn,writableIndexes:(0,Dt.IX)((0,Dt.Rx)()),readonlyIndexes:(0,Dt.IX)((0,Dt.Rx)())}),si=(0,Dt.dt)({signatures:(0,Dt.IX)((0,Dt.Z_)()),message:(0,Dt.dt)({accountKeys:(0,Dt.IX)((0,Dt.Z_)()),header:(0,Dt.dt)({numRequiredSignatures:(0,Dt.Rx)(),numReadonlySignedAccounts:(0,Dt.Rx)(),numReadonlyUnsignedAccounts:(0,Dt.Rx)()}),instructions:(0,Dt.IX)((0,Dt.dt)({accounts:(0,Dt.IX)((0,Dt.Rx)()),data:(0,Dt.Z_)(),programIdIndex:(0,Dt.Rx)()})),recentBlockhash:(0,Dt.Z_)(),addressTableLookups:(0,Dt.jt)((0,Dt.IX)(oi))})}),ai=(0,Dt.dt)({pubkey:Xn,signer:(0,Dt.O7)(),writable:(0,Dt.O7)(),source:(0,Dt.jt)((0,Dt.G0)([(0,Dt.i0)("transaction"),(0,Dt.i0)("lookupTable")]))}),ui=(0,Dt.dt)({accountKeys:(0,Dt.IX)(ai),signatures:(0,Dt.IX)((0,Dt.Z_)())}),ci=(0,Dt.dt)({parsed:(0,Dt._4)(),program:(0,Dt.Z_)(),programId:Xn}),di=(0,Dt.dt)({accounts:(0,Dt.IX)(Xn),data:(0,Dt.Z_)(),programId:Xn}),li=(0,Dt.G0)([di,ci]),hi=(0,Dt.G0)([(0,Dt.dt)({parsed:(0,Dt._4)(),program:(0,Dt.Z_)(),programId:(0,Dt.Z_)()}),(0,Dt.dt)({accounts:(0,Dt.IX)((0,Dt.Z_)()),data:(0,Dt.Z_)(),programId:(0,Dt.Z_)()})]),fi=(0,Dt.oQ)(li,hi,(t=>"accounts"in t?(0,Dt.Ue)(t,di):(0,Dt.Ue)(t,ci))),pi=(0,Dt.dt)({signatures:(0,Dt.IX)((0,Dt.Z_)()),message:(0,Dt.dt)({accountKeys:(0,Dt.IX)(ai),instructions:(0,Dt.IX)(fi),recentBlockhash:(0,Dt.Z_)(),addressTableLookups:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(oi)))})}),mi=(0,Dt.dt)({accountIndex:(0,Dt.Rx)(),mint:(0,Dt.Z_)(),owner:(0,Dt.jt)((0,Dt.Z_)()),uiTokenAmount:Tr}),gi=(0,Dt.dt)({writable:(0,Dt.IX)(Xn),readonly:(0,Dt.IX)(Xn)}),yi=(0,Dt.dt)({err:mr,fee:(0,Dt.Rx)(),innerInstructions:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.dt)({index:(0,Dt.Rx)(),instructions:(0,Dt.IX)((0,Dt.dt)({accounts:(0,Dt.IX)((0,Dt.Rx)()),data:(0,Dt.Z_)(),programIdIndex:(0,Dt.Rx)()}))})))),preBalances:(0,Dt.IX)((0,Dt.Rx)()),postBalances:(0,Dt.IX)((0,Dt.Rx)()),logMessages:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.Z_)()))),preTokenBalances:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(mi))),postTokenBalances:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(mi))),loadedAddresses:(0,Dt.jt)(gi),computeUnitsConsumed:(0,Dt.jt)((0,Dt.Rx)())}),bi=(0,Dt.dt)({err:mr,fee:(0,Dt.Rx)(),innerInstructions:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.dt)({index:(0,Dt.Rx)(),instructions:(0,Dt.IX)(fi)})))),preBalances:(0,Dt.IX)((0,Dt.Rx)()),postBalances:(0,Dt.IX)((0,Dt.Rx)()),logMessages:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.Z_)()))),preTokenBalances:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(mi))),postTokenBalances:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(mi))),loadedAddresses:(0,Dt.jt)(gi),computeUnitsConsumed:(0,Dt.jt)((0,Dt.Rx)())}),wi=(0,Dt.G0)([(0,Dt.i0)(0),(0,Dt.i0)("legacy")]),_i=(0,Dt.dt)({pubkey:(0,Dt.Z_)(),lamports:(0,Dt.Rx)(),postBalance:(0,Dt.AG)((0,Dt.Rx)()),rewardType:(0,Dt.AG)((0,Dt.Z_)()),commission:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)()))}),vi=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:si,meta:(0,Dt.AG)(yi),version:(0,Dt.jt)(wi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),ki=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),Mi=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:ui,meta:(0,Dt.AG)(yi),version:(0,Dt.jt)(wi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),Ai=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:pi,meta:(0,Dt.AG)(bi),version:(0,Dt.jt)(wi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),Si=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:ui,meta:(0,Dt.AG)(bi),version:(0,Dt.jt)(wi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),Ii=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),xi=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:si,meta:(0,Dt.AG)(yi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)())}))),Ei=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),signatures:(0,Dt.IX)((0,Dt.Z_)()),blockTime:(0,Dt.AG)((0,Dt.Rx)())}))),Ti=ir((0,Dt.AG)((0,Dt.dt)({slot:(0,Dt.Rx)(),meta:(0,Dt.AG)(yi),blockTime:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)())),transaction:si,version:(0,Dt.jt)(wi)}))),Pi=ir((0,Dt.AG)((0,Dt.dt)({slot:(0,Dt.Rx)(),transaction:pi,meta:(0,Dt.AG)(bi),blockTime:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)())),version:(0,Dt.jt)(wi)}))),Bi=or((0,Dt.dt)({blockhash:(0,Dt.Z_)(),feeCalculator:(0,Dt.dt)({lamportsPerSignature:(0,Dt.Rx)()})})),Li=or((0,Dt.dt)({blockhash:(0,Dt.Z_)(),lastValidBlockHeight:(0,Dt.Rx)()})),$i=or((0,Dt.O7)()),Ri=(0,Dt.dt)({slot:(0,Dt.Rx)(),numTransactions:(0,Dt.Rx)(),numSlots:(0,Dt.Rx)(),samplePeriodSecs:(0,Dt.Rx)()}),Oi=ir((0,Dt.IX)(Ri)),Di=or((0,Dt.AG)((0,Dt.dt)({feeCalculator:(0,Dt.dt)({lamportsPerSignature:(0,Dt.Rx)()})}))),Ci=ir((0,Dt.Z_)()),Ni=ir((0,Dt.Z_)()),zi=(0,Dt.dt)({err:mr,logs:(0,Dt.IX)((0,Dt.Z_)()),signature:(0,Dt.Z_)()}),Ui=(0,Dt.dt)({result:sr(zi),subscription:(0,Dt.Rx)()}),ji={"solana-client":"js/0.0.0-development"};class Yi{constructor(t,e){let n,r,i,o,s,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const t={};return async e=>{const{commitment:n,config:r}=er(e),i=this._buildArgs([],n,void 0,r),o=Un(i);return t[o]=t[o]??(async()=>{try{const t=await this._rpcRequest("getBlockHeight",i),e=(0,Dt.Ue)(t,ir((0,Dt.Rx)()));if("error"in e)throw new Hn(e.error,"failed to get block height information");return e.result}finally{delete t[o]}})(),await t[o]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,n=e.wsEndpoint,r=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=n||function(t){const e=t.match(Zn);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);const[n,r,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(t),this._rpcClient=function(t,e,n,r,i,o){const s=n||Kn;let a;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(t,e)=>{const n=await new Promise(((n,i)=>{try{r(t,e,((t,e)=>n([t,e])))}catch(t){i(t)}}));return await s(...n)}),new(Nt())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},ji)};try{let e,n=5,u=500;for(;e=a?await a(t,o):await s(t,o),429===e.status&&!0!==i&&(n-=1,0!==n);)console.error(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await vn(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{})}(t,r,i,o,s,a),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new qn(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=await this._rpcRequest("getBalance",i),s=(0,Dt.Ue)(o,or((0,Dt.Rx)()));if("error"in s)throw new Hn(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=await this._rpcRequest("getBlockTime",[t]),n=(0,Dt.Ue)(e,ir((0,Dt.AG)((0,Dt.Rx)())));if("error"in n)throw new Hn(n.error,`failed to get block time for slot ${t}`);return n.result}async getMinimumLedgerSlot(){const t=await this._rpcRequest("minimumLedgerSlot",[]),e=(0,Dt.Ue)(t,ir((0,Dt.Rx)()));if("error"in e)throw new Hn(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const t=await this._rpcRequest("getFirstAvailableBlock",[]),e=(0,Dt.Ue)(t,xr);if("error"in e)throw new Hn(e.error,"failed to get first available block");return e.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=await this._rpcRequest("getSupply",[e]),r=(0,Dt.Ue)(n,Er);if("error"in r)throw new Hn(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenSupply",n),i=(0,Dt.Ue)(r,or(Tr));if("error"in i)throw new Hn(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenAccountBalance",n),i=(0,Dt.Ue)(r,or(Tr));if("error"in i)throw new Hn(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=er(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=await this._rpcRequest("getTokenAccountsByOwner",s),u=(0,Dt.Ue)(a,Br);if("error"in u)throw new Hn(u.error,`failed to get token accounts owned by account ${t.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",i),s=(0,Dt.Ue)(o,$r);if("error"in s)throw new Hn(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=await this._rpcRequest("getLargestAccounts",n),i=(0,Dt.Ue)(r,Rr);if("error"in i)throw new Hn(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenLargestAccounts",n),i=(0,Dt.Ue)(r,Pr);if("error"in i)throw new Hn(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,Dt.Ue)(o,or((0,Dt.AG)(Or)));if("error"in s)throw new Hn(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,Dt.Ue)(o,or((0,Dt.AG)(Nr)));if("error"in s)throw new Hn(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){const{commitment:n,config:r}=er(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,Dt.Ue)(s,or((0,Dt.IX)((0,Dt.AG)(Nr))));if("error"in a)throw new Hn(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=er(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,Dt.Ue)(s,or((0,Dt.IX)((0,Dt.AG)(Or))));if("error"in a)throw new Hn(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=er(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),s=await this._rpcRequest("getStakeActivation",o),a=(0,Dt.Ue)(s,ir(Ur));if("error"in a)throw new Hn(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=er(e),{encoding:i,...o}=r||{},s=this._buildArgs([t.toBase58()],n,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=(0,Dt.IX)(Dr),c=!0===o.withContext?(0,Dt.Ue)(a,or(u)):(0,Dt.Ue)(a,ir(u));if("error"in c)throw new Hn(c.error,`failed to get accounts owned by program ${t.toBase58()}`);return c.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getProgramAccounts",i),s=(0,Dt.Ue)(o,ir((0,Dt.IX)(zr)));if("error"in s)throw new Hn(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{const e=t;if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);n=e.signature}try{r=Bt().decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}return Ze(64===r.length,"signature has invalid length"),"string"==typeof t?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise(((e,n)=>{null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(()=>{n(t.reason)})))}))}getTransactionConfirmationPromise({commitment:t,signature:e}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,s)=>{try{n=this.onSignature(e,((t,e)=>{n=void 0;const r={context:e,value:t};o({__type:on.PROCESSED,response:r})}),t);const a=new Promise((t=>{null==n?t():r=this._onSubscriptionStateChange(n,(e=>{"subscribed"===e&&t()}))}));(async()=>{if(await a,i)return;const n=await this.getSignatureStatus(e);if(i)return;if(null==n)return;const{context:r,value:u}=n;if(null!=u)if(u?.err)s(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,o({__type:on.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((e=>{const r=async()=>{try{return await this.getBlockHeight(t)}catch(t){return-1}};(async()=>{let t=await r();if(!i){for(;t<=n;){if(await vn(1e3),i)return;if(t=await r(),i)return}e({__type:on.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:t,signature:r}),u=this.getCancellationPromise(e);let c;try{const t=await Promise.race([u,a,o]);if(t.__type!==on.PROCESSED)throw new Ue(r);c=t.response}finally{i=!0,s()}return c}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let s=!1;const a=new Promise((e=>{let o=i,a=null;const u=async()=>{try{const{context:e,value:i}=await this.getNonceAndContext(r,{commitment:t,minContextSlot:n});return a=e.slot,i?.nonce}catch(t){return o}};(async()=>{if(o=await u(),!s)for(;;){if(i!==o)return void e({__type:on.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await vn(2e3),s)return;if(o=await u(),s)return}})()})),{abortConfirmation:u,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(e);let l;try{const e=await Promise.race([d,c,a]);if(e.__type===on.PROCESSED)l=e.response;else{let r;for(;;){const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(e.slotInWhichNonceDidAdvance??n))){r=t;break}await vn(400)}if(!r?.value)throw new Ye(o);{const e=t||"finalized",{confirmationStatus:n}=r.value;switch(e){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new Ye(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new Ye(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new Ye(o)}l={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,u()}return l}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let n;const r=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>e({__type:on.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});let s;try{const t=await Promise.race([o,r]);if(t.__type!==on.PROCESSED)throw new je(e,t.timeoutMs/1e3);s=t.response}finally{clearTimeout(n),i()}return s}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),e=(0,Dt.Ue)(t,ir((0,Dt.IX)(Jr)));if("error"in e)throw new Hn(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getVoteAccounts",e),r=(0,Dt.Ue)(n,ti);if("error"in r)throw new Hn(r.error,"failed to get vote accounts");return r.result}async getSlot(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlot",r),o=(0,Dt.Ue)(i,ir((0,Dt.Rx)()));if("error"in o)throw new Hn(o.error,"failed to get slot");return o.result}async getSlotLeader(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlotLeader",r),o=(0,Dt.Ue)(i,ir((0,Dt.Z_)()));if("error"in o)throw new Hn(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(t,e){const n=[t,e],r=await this._rpcRequest("getSlotLeaders",n),i=(0,Dt.Ue)(r,ir((0,Dt.IX)(Xn)));if("error"in i)throw new Hn(i.error,"failed to get slot leaders");return i.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);return Ze(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=await this._rpcRequest("getSignatureStatuses",n),i=(0,Dt.Ue)(r,ri);if("error"in i)throw new Hn(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getTransactionCount",r),o=(0,Dt.Ue)(i,ir((0,Dt.Rx)()));if("error"in o)throw new Hn(o.error,"failed to get transaction count");return o.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getInflationGovernor",e),r=(0,Dt.Ue)(n,vr);if("error"in r)throw new Hn(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=er(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:i?.epoch}),s=await this._rpcRequest("getInflationReward",o),a=(0,Dt.Ue)(s,cr);if("error"in a)throw new Hn(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){const t=await this._rpcRequest("getInflationRate",[]),e=(0,Dt.Ue)(t,kr);if("error"in e)throw new Hn(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getEpochInfo",r),o=(0,Dt.Ue)(i,Ar);if("error"in o)throw new Hn(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){const t=await this._rpcRequest("getEpochSchedule",[]),e=(0,Dt.Ue)(t,Sr);if("error"in e)throw new Hn(e.error,"failed to get epoch schedule");const n=e.result;return new Yn(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),e=(0,Dt.Ue)(t,Ir);if("error"in e)throw new Hn(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getMinimumBalanceForRentExemption",n),i=(0,Dt.Ue)(r,ii);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getRecentBlockhash",e),r=(0,Dt.Ue)(n,Bi);if("error"in r)throw new Hn(r.error,"failed to get recent blockhash");return r.result}async getRecentPerformanceSamples(t){const e=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),n=(0,Dt.Ue)(e,Oi);if("error"in n)throw new Hn(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getFeeCalculatorForBlockhash",n),i=(0,Dt.Ue)(r,Di);if("error"in i)throw new Hn(i.error,"failed to get fee calculator");const{context:o,value:s}=i.result;return{context:o,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){const n=Ie(t.serialize()).toString("base64"),r=this._buildArgs([n],e),i=await this._rpcRequest("getFeeForMessage",r),o=(0,Dt.Ue)(i,or((0,Dt.AG)((0,Dt.Rx)())));if("error"in o)throw new Hn(o.error,"failed to get fee for message");if(null===o.result)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(t){const e=t?.lockedWritableAccounts?.map((t=>t.toBase58())),n=e?.length?[e]:[],r=await this._rpcRequest("getRecentPrioritizationFees",n),i=(0,Dt.Ue)(r,Mr);if("error"in i)throw new Hn(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getLatestBlockhash",r),o=(0,Dt.Ue)(i,Li);if("error"in o)throw new Hn(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t],n,void 0,r),o=await this._rpcRequest("isBlockhashValid",i),s=(0,Dt.Ue)(o,$i);if("error"in s)throw new Hn(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){const t=await this._rpcRequest("getVersion",[]),e=(0,Dt.Ue)(t,ir(br));if("error"in e)throw new Hn(e.error,"failed to get version");return e.result}async getGenesisHash(){const t=await this._rpcRequest("getGenesisHash",[]),e=(0,Dt.Ue)(t,ir((0,Dt.Z_)()));if("error"in e)throw new Hn(e.error,"failed to get genesis hash");return e.result}async getBlock(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,Dt.Ue)(o,Mi);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,Dt.Ue)(o,ki);if("error"in t)throw t.error;return t.result}default:{const t=(0,Dt.Ue)(o,vi);if("error"in t)throw t.error;const{result:e}=t;return e?{...e,transactions:e.transactions.map((({transaction:t,meta:e,version:n})=>({meta:e,transaction:{...t,message:ar(n,t.message)},version:n})))}:null}}}catch(t){throw new Hn(t,"failed to get confirmed block")}}async getParsedBlock(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,Dt.Ue)(o,Si);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,Dt.Ue)(o,Ii);if("error"in t)throw t.error;return t.result}default:{const t=(0,Dt.Ue)(o,Ai);if("error"in t)throw t.error;return t.result}}}catch(t){throw new Hn(t,"failed to get block")}}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=await this._rpcRequest("getBlockProduction",r),o=(0,Dt.Ue)(i,_r);if("error"in o)throw new Hn(o.error,"failed to get block production information");return o.result}async getTransaction(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getTransaction",i),s=(0,Dt.Ue)(o,Ti);if("error"in s)throw new Hn(s.error,"failed to get transaction");const a=s.result;return a?{...a,transaction:{...a.transaction,message:ar(a.version,a.transaction.message)}}:a}async getParsedTransaction(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getTransaction",i),s=(0,Dt.Ue)(o,Pi);if("error"in s)throw new Hn(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){const{commitment:n,config:r}=er(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,Dt.Ue)(t,Pi);if("error"in e)throw new Hn(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const{commitment:n,config:r}=er(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,Dt.Ue)(t,Ti);if("error"in e)throw new Hn(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:ar(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,Dt.Ue)(r,xi);if("error"in i)throw new Hn(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");const s={...o,transactions:o.transactions.map((({transaction:t,meta:e})=>{const n=new en(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...s,transactions:s.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:un.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=await this._rpcRequest("getBlocks",r),o=(0,Dt.Ue)(i,ir((0,Dt.IX)((0,Dt.Rx)())));if("error"in o)throw new Hn(o.error,"failed to get blocks");return o.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),i=(0,Dt.Ue)(r,Ei);if("error"in i)throw new Hn(i.error,"failed to get block");const o=i.result;if(!o)throw new Error("Block "+t+" not found");return o}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,Dt.Ue)(r,Ei);if("error"in i)throw new Hn(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");return o}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,Dt.Ue)(r,Ti);if("error"in i)throw new Hn(i.error,"failed to get transaction");const o=i.result;if(!o)return o;const s=new en(o.transaction.message),a=o.transaction.signatures;return{...o,transaction:un.populate(s,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,Dt.Ue)(r,Pi);if("error"in i)throw new Hn(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=(0,Dt.Ue)(t,Pi);if("error"in e)throw new Hn(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getConfirmedSignaturesForAddress2",r),o=(0,Dt.Ue)(i,jr);if("error"in o)throw new Hn(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getSignaturesForAddress",r),o=(0,Dt.Ue)(i,Yr);if("error"in o)throw new Hn(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=new Vn({key:t,state:Vn.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=xn.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),r=(0,Dt.Ue)(n,Ci);if("error"in r)throw new Hn(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await vn(100);const t=Date.now()-this._blockhashInfo.lastFetch>=tr;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await vn(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,"base64",n),i=await this._rpcRequest("getStakeMinimumDelegation",r),o=(0,Dt.Ue)(i,or((0,Dt.Rx)()));if("error"in o)throw new Hn(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(t,e,n){if("message"in t){const r=t.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(e)||void 0!==n)throw new Error("Invalid arguments");const s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment);const a=[o,s],u=await this._rpcRequest("simulateTransaction",a),c=(0,Dt.Ue)(u,wr);if("error"in c)throw new Error("failed to simulate transaction: "+c.error.message);return c.result}let r;if(t instanceof un){let e=t;r=new un,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=un.populate(t),r._message=r._json=void 0;if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid arguments");const o=e;if(r.nonceInfo&&o)r.sign(...o);else{let t=this._disableBlockhashCaching;for(;;){const e=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=e.lastValidBlockHeight,r.recentBlockhash=e.blockhash,!o)break;if(r.sign(...o),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}t=!0}}const s=r._compile(),a=s.serialize(),u=r._serialize(a).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:s.nonProgramIds()).map((t=>t.toBase58()));c.accounts={encoding:"base64",addresses:t}}o&&(c.sigVerify=!0);const d=[u,c],l=await this._rpcRequest("simulateTransaction",d),h=(0,Dt.Ue)(l,wr);if("error"in h){let t;if("data"in h.error&&(t=h.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(h.error.message,n)}throw new Fn("failed to simulate transaction: "+h.error.message,t)}return h.result}async sendTransaction(t,e,n){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const n=t.serialize();return await this.sendRawTransaction(n,e)}if(void 0===e||!Array.isArray(e))throw new Error("Invalid arguments");const r=e;if(t.nonceInfo)t.sign(...r);else{let e=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(e);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...r),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}e=!0}}const i=t.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(t,e){const n=Ie(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=!0===r?"processed":e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],s=await this._rpcRequest("sendTransaction",o),a=(0,Dt.Ue)(s,Ni);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new Fn("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(t,e){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,n!==e.state){const n=this._subscriptionStateChangeCallbacksByHash[t];n&&n.forEach((t=>{try{t(e.state)}catch{}}))}}_onSubscriptionStateChange(t,e){const n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(e),()=>{r.delete(e),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const e=await this._rpcWebSocket.call(i,r);this._setSubscription(t,{...n,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Fr);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=Un([t.method,e]),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];Ze(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Hr);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Ui);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,qr);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Gr);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Zr);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),s=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Xr);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class Fi{constructor(t){this._keypair=void 0,this._keypair=t??ve()}static generate(){return new Fi(ve())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=ke(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new Fi({publicKey:n,secretKey:t})}static fromSeed(t){const e=ke(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new Fi({publicKey:e,secretKey:n})}get publicKey(){return new Re(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const Wi=Object.freeze({CreateLookupTable:{index:0,layout:Rt.struct([Rt.u32("instruction"),En("recentSlot"),Rt.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Rt.struct([Rt.u32("instruction")])},ExtendLookupTable:{index:2,layout:Rt.struct([Rt.u32("instruction"),En(),Rt.seq(We(),Rt.offset(Rt.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Rt.struct([Rt.u32("instruction")])},CloseLookupTable:{index:4,layout:Rt.struct([Rt.u32("instruction")])}});class Hi{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Wi))if(r.index==e){n=t;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);const{recentSlot:e}=Mn(Wi.CreateLookupTable,t.data);return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error(`invalid instruction; found ${t.keys.length} keys, expected at least 2`);const{addresses:e}=Mn(Wi.ExtendLookupTable,t.data);return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((t=>new Re(t)))}}static decodeCloseLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}static decodeFreezeLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static decodeDeactivateLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(Ki.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(t,e){if(t.lengtht.toBytes()))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Bn.programId,isSigner:!1,isWritable:!1}),new an({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=kn(Wi.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new an({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=kn(Wi.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new an({programId:this.programId,keys:n,data:e})}}Ki.programId=new Re("AddressLookupTab1e1111111111111111111111111");class qi{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u8("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Vi))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=Mn(Vi.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=Mn(Vi.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=Mn(Vi.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=Mn(Vi.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(Gi.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const Vi=Object.freeze({RequestUnits:{index:0,layout:Rt.struct([Rt.u8("instruction"),Rt.u32("units"),Rt.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Rt.struct([Rt.u8("instruction"),Rt.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Rt.struct([Rt.u8("instruction"),Rt.u32("units")])},SetComputeUnitPrice:{index:3,layout:Rt.struct([Rt.u8("instruction"),En("microLamports")])}});class Gi{constructor(){}static requestUnits(t){const e=kn(Vi.RequestUnits,t);return new an({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=kn(Vi.RequestHeapFrame,t);return new an({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=kn(Vi.SetComputeUnitLimit,t);return new an({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=kn(Vi.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new an({keys:[],programId:this.programId,data:e})}}Gi.programId=new Re("ComputeBudget111111111111111111111111111111");const Zi=Rt.struct([Rt.u8("numSignatures"),Rt.u8("padding"),Rt.u16("signatureOffset"),Rt.u16("signatureInstructionIndex"),Rt.u16("publicKeyOffset"),Rt.u16("publicKeyInstructionIndex"),Rt.u16("messageDataOffset"),Rt.u16("messageDataSize"),Rt.u16("messageInstructionIndex")]);class Xi{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:o}=t;Ze(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),Ze(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const s=Zi.span,a=s+e.length,u=a+r.length,c=i.Buffer.alloc(u+n.length),d=null==o?65535:o;return Zi.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,s),c.fill(r,a),c.fill(n,u),new an({keys:[],programId:Xi.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;Ze(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=Fi.fromSecretKey(e),i=t.publicKey.toBytes(),o=Ae(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}Xi.programId=new Re("Ed25519SigVerify111111111111111111111111111"),we.utils.isValidPrivateKey;const Ji=we.getPublicKey,Qi=Rt.struct([Rt.u8("numSignatures"),Rt.u16("signatureOffset"),Rt.u8("signatureInstructionIndex"),Rt.u16("ethAddressOffset"),Rt.u8("ethAddressInstructionIndex"),Rt.u16("messageDataOffset"),Rt.u16("messageDataSize"),Rt.u8("messageInstructionIndex"),Rt.blob(20,"ethAddress"),Rt.blob(64,"signature"),Rt.u8("recoveryId")]);class to{constructor(){}static publicKeyToEthAddress(t){Ze(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return i.Buffer.from(ne(Ie(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return to.createInstructionWithEthAddress({ethAddress:to.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:o,instructionIndex:s=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?i.Buffer.from(e.substr(2),"hex"):i.Buffer.from(e,"hex"):e,Ze(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,c=u+r.length+1,d=i.Buffer.alloc(Qi.span+n.length);return Qi.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:s,signature:Ie(r),ethAddress:Ie(a),recoveryId:o},d),d.fill(Ie(n),Qi.span),new an({keys:[],programId:to.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;Ze(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=Ie(e),o=Ji(t,!1).slice(1),s=i.Buffer.from(ne(Ie(n))),[a,u]=((t,e)=>{const n=we.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(s,t);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var eo;to.programId=new Re("KeccakSecp256k11111111111111111111111111111");const no=new Re("StakeConfig11111111111111111111111111111111");class ro{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class io{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}eo=io,io.default=new eo(0,0,Re.default);class oo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(so))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=Mn(so.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new ro(new Re(e.staker),new Re(e.withdrawer)),lockup:new io(n.unixTimestamp,n.epoch,new Re(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),Mn(so.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=Mn(so.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Re(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Mn(so.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new Re(i),newAuthorizedPubkey:new Re(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Mn(so.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Mn(so.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Mn(so.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Mn(so.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(uo.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.lengthRt.struct([We("staker"),We("withdrawer")],t))(),((t="lockup")=>Rt.struct([Rt.ns64("unixTimestamp"),Rt.ns64("epoch"),We("custodian")],t))()])},Authorize:{index:1,layout:Rt.struct([Rt.u32("instruction"),We("newAuthorized"),Rt.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:Rt.struct([Rt.u32("instruction")])},Split:{index:3,layout:Rt.struct([Rt.u32("instruction"),Rt.ns64("lamports")])},Withdraw:{index:4,layout:Rt.struct([Rt.u32("instruction"),Rt.ns64("lamports")])},Deactivate:{index:5,layout:Rt.struct([Rt.u32("instruction")])},Merge:{index:7,layout:Rt.struct([Rt.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:Rt.struct([Rt.u32("instruction"),We("newAuthorized"),Rt.u32("stakeAuthorizationType"),Ke("authoritySeed"),We("authorityOwner")])}}),ao=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class uo{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||io.default,o=kn(so.Initialize,{authorized:{staker:Ie(n.staker.toBuffer()),withdrawer:Ie(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Ie(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mn,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new an(s)}static createAccountWithSeed(t){const e=new un;e.add(Bn.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new un;e.add(Bn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=kn(so.Delegate);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:wn,isSigner:!1,isWritable:!1},{pubkey:no,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=kn(so.Authorize,{newAuthorized:Ie(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new un).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=kn(so.AuthorizeWithSeed,{newAuthorized:Ie(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:Ie(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new un).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=kn(so.Split,{lamports:i});return new an({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t,e){const n=new un;return n.add(Bn.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),n.add(this.splitInstruction(t))}static splitWithSeed(t,e){const{stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,basePubkey:o,seed:s,lamports:a}=t,u=new un;return u.add(Bn.allocate({accountPubkey:i,basePubkey:o,seed:s,space:this.space,programId:this.programId})),e&&e>0&&u.add(Bn.transfer({fromPubkey:t.authorizedPubkey,toPubkey:i,lamports:e})),u.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,lamports:a}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=kn(so.Merge);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:wn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=kn(so.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:wn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new un).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=kn(so.Deactivate);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}uo.programId=new Re("Stake11111111111111111111111111111111111111"),uo.space=200;class co{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}class lo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ho))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=Mn(ho.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new co(new Re(e.nodePubkey),new Re(e.authorizedVoter),new Re(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=Mn(ho.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Re(e),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:e,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Mn(ho.AuthorizeWithSeed,t.data);return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new Re(e),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new Re(r),voteAuthorizationType:{index:i},votePubkey:t.keys[0].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Mn(ho.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(po.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.lengthRt.struct([We("nodePubkey"),We("authorizedVoter"),We("authorizedWithdrawer"),Rt.u8("commission")],t))()])},Authorize:{index:1,layout:Rt.struct([Rt.u32("instruction"),We("newAuthorized"),Rt.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:Rt.struct([Rt.u32("instruction"),Rt.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:Rt.struct([Rt.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:Rt.struct([Rt.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>Rt.struct([Rt.u32("voteAuthorizationType"),We("currentAuthorityDerivedKeyOwnerPubkey"),Ke("currentAuthorityDerivedKeySeed"),We("newAuthorized")],t))()])}}),fo=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class po{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=kn(ho.InitializeAccount,{voteInit:{nodePubkey:Ie(r.nodePubkey.toBuffer()),authorizedVoter:Ie(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Ie(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mn,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new an(o)}static createAccount(t){const e=new un;return e.add(Bn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=kn(ho.Authorize,{newAuthorized:Ie(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=kn(ho.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Ie(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Ie(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new un).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=kn(ho.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return po.withdraw(t)}static updateValidatorIdentity(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,nodePubkey:r}=t,i=kn(ho.UpdateValidatorIdentity),o=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:o,programId:this.programId,data:i})}}po.programId=new Re("Vote111111111111111111111111111111111111111"),po.space=3762;const mo=new Re("Va1idator1nfo111111111111111111111111111111"),go=(0,Dt.dt)({name:(0,Dt.Z_)(),website:(0,Dt.jt)((0,Dt.Z_)()),details:(0,Dt.jt)((0,Dt.Z_)()),keybaseUsername:(0,Dt.jt)((0,Dt.Z_)())});class yo{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==Ve(e))return null;const n=[];for(let t=0;t<2;t++){const t=new Re(tn(e,0,Le)),r=1===Qe(e);n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(mo)&&n[1].isSigner){const t=Ke().decode(i.Buffer.from(e)),r=JSON.parse(t);return(0,Dt.hu)(r,go),new yo(n[1].publicKey,r)}return null}}const bo=new Re("Vote111111111111111111111111111111111111111"),wo=Rt.struct([We("nodePubkey"),We("authorizedWithdrawer"),Rt.u8("commission"),Rt.nu64(),Rt.seq(Rt.struct([Rt.nu64("slot"),Rt.u32("confirmationCount")]),Rt.offset(Rt.u32(),-8),"votes"),Rt.u8("rootSlotValid"),Rt.nu64("rootSlot"),Rt.nu64(),Rt.seq(Rt.struct([Rt.nu64("epoch"),We("authorizedVoter")]),Rt.offset(Rt.u32(),-8),"authorizedVoters"),Rt.struct([Rt.seq(Rt.struct([We("authorizedPubkey"),Rt.nu64("epochOfLastAuthorizedSwitch"),Rt.nu64("targetEpoch")]),32,"buf"),Rt.nu64("idx"),Rt.u8("isEmpty")],"priorVoters"),Rt.nu64(),Rt.seq(Rt.struct([Rt.nu64("epoch"),Rt.nu64("credits"),Rt.nu64("prevCredits")]),Rt.offset(Rt.u32(),-8),"epochCredits"),Rt.struct([Rt.nu64("slot"),Rt.nu64("timestamp")],"lastTimestamp")]);class _o{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=wo.decode(Ie(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new _o({nodePubkey:new Re(e.nodePubkey),authorizedWithdrawer:new Re(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(vo),priorVoters:Mo(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function vo({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new Re(t)}}function ko({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new Re(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function Mo({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(ko),...t.slice(0,e).map(ko)]}const Ao={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function So(t,e){const n=!1===e?"http":"https";if(!t)return Ao[n].devnet;const r=Ao[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r}async function Io(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await t.sendRawTransaction(e,s),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(a,u),d=(await c).value;if(d.err)throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`);return a}const xo=1e9},39809:(t,e,n)=>{"use strict";const r=e;r.bignum=n(4590),r.define=n(22500).define,r.base=n(71979),r.constants=n(36826),r.decoders=n(78307),r.encoders=n(56579)},22500:(t,e,n)=>{"use strict";const r=n(56579),i=n(78307),o=n(35717);function s(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new s(t,e)},s.prototype._createNamed=function(t){const e=this.name;function n(t){this._initNamed(t,e)}return o(n,t),n.prototype._initNamed=function(e,n){t.call(this,e,n)},new n(this)},s.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i[t])),this.decoders[t]},s.prototype.decode=function(t,e,n){return this._getDecoder(e).decode(t,n)},s.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r[t])),this.encoders[t]},s.prototype.encode=function(t,e,n){return this._getEncoder(e).encode(t,n)}},36625:(t,e,n)=>{"use strict";const r=n(35717),i=n(98465).b,o=n(2399).Buffer;function s(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function a(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return a.isEncoderBuffer(t)||(t=new a(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}r(s,i),e.C=s,s.isDecoderBuffer=function(t){return t instanceof s||"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},s.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function(t){const e=new s(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.R=a,a.isEncoderBuffer=function(t){return t instanceof a||"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},a.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(t,e),e+=n.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},71979:(t,e,n)=>{"use strict";const r=e;r.Reporter=n(98465).b,r.DecoderBuffer=n(36625).C,r.EncoderBuffer=n(36625).R,r.Node=n(41949)},41949:(t,e,n)=>{"use strict";const r=n(98465).b,i=n(36625).R,o=n(36625).C,s=n(79746),a=["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"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function c(t,e,n){const r={};this._baseState=r,r.name=n,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=c;const d=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const t=this._baseState,e={};d.forEach((function(n){e[n]=t[n]}));const n=new this.constructor(e.parent);return n._baseState=e,n},c.prototype._wrap=function(){const t=this._baseState;u.forEach((function(e){this[e]=function(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}}),this)},c.prototype._init=function(t){const e=this._baseState;s(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),s.equal(e.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(t){const e=this._baseState,n=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==n.length&&(s(null===e.children),e.children=n,n.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(s(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(n){n==(0|n)&&(n|=0);const r=t[n];e[r]=n})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){c.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),a.forEach((function(t){c.prototype[t]=function(){const e=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===e.tag),e.tag=t,this._useArgs(n),this}})),c.prototype.use=function(t){s(t);const e=this._baseState;return s(null===e.use),e.use=t,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(t){const e=this._baseState;return s(null===e.default),e.default=t,e.optional=!0,this},c.prototype.explicit=function(t){const e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.explicit=t,this},c.prototype.implicit=function(t){const e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.implicit=t,this},c.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},c.prototype.key=function(t){const e=this._baseState;return s(null===e.key),e.key=t,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(t){const e=this._baseState;return s(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},c.prototype.contains=function(t){const e=this._baseState;return s(null===e.use),e.contains=t,this},c.prototype._decode=function(t,e){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,e));let r,i=n.default,s=!0,a=null;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(s=this._peekTag(t,r,n.any),t.isError(s))return s}else{const r=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e),s=!0}catch(t){s=!1}t.restore(r)}}if(n.obj&&s&&(r=t.enterObject()),s){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const r=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(e&&e.track&&null!==n.tag&&e.track(t.path(),r,t.length,"tagged"),e&&e.track&&null!==n.tag&&e.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(t,e)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const r=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(r,e)}}return n.obj&&s&&(i=t.leaveObject(r)),null===n.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,i),i},c.prototype._decodeGeneric=function(t,e,n){const r=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,r.args[0],n):/str$/.test(t)?this._decodeStr(e,t,n):"objid"===t&&r.args?this._decodeObjid(e,r.args[0],r.args[1],n):"objid"===t?this._decodeObjid(e,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(e,t,n):"null_"===t?this._decodeNull(e,n):"bool"===t?this._decodeBool(e,n):"objDesc"===t?this._decodeStr(e,t,n):"int"===t||"enum"===t?this._decodeInt(e,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,e._reporterState.obj)._decode(e,n):e.error("unknown tag: "+t)},c.prototype._getUse=function(t,e){const n=this._baseState;return n.useDecoder=this._use(t,e),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},c.prototype._decodeChoice=function(t,e){const n=this._baseState;let r=null,i=!1;return Object.keys(n.choice).some((function(o){const s=t.save(),a=n.choice[o];try{const n=a._decode(t,e);if(t.isError(n))return!1;r={type:o,value:n},i=!0}catch(e){return t.restore(s),!1}return!0}),this),i?r:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},c.prototype._encode=function(t,e,n){const r=this._baseState;if(null!==r.default&&r.default===t)return;const i=this._encodeValue(t,e,n);return void 0===i||this._skipDefault(i,e,n)?void 0:i},c.prototype._encodeValue=function(t,e,n){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new r);let o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let s=null,a=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)s=this._getUse(i.contains,n)._encode(t,e),a=!0;else if(i.children)s=i.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,e,t);if(null===n._baseState.key)return e.error("Child should have a key");const r=e.enterKey(n._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=n._encode(t[n._baseState.key],e,t);return e.leaveKey(r),i}),this).filter((function(t){return t})),s=this._createEncoderBuffer(s);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,s=this._createEncoderBuffer(t.map((function(n){const r=this._baseState;return this._getUse(r.args[0],t)._encode(n,e)}),n))}else null!==i.use?o=this._getUse(i.use,n)._encode(t,e):(s=this._encodePrimitive(i.tag,t),a=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,n=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(t,a,n,s))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(t,e){const n=this._baseState,r=n.choice[t.type];return r||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(t.value,e)},c.prototype._encodePrimitive=function(t,e){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&n.args)return this._encodeObjid(e,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},98465:(t,e,n)=>{"use strict";const r=n(35717);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.b=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,n){const r=this._reporterState;this.exitKey(t),null!==r.obj&&(r.obj[e]=n)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){const e=this._reporterState,n=e.obj;return e.obj=t,n},i.prototype.error=function(t){let e;const n=this._reporterState,r=t instanceof o;if(e=r?t:new o(n.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!n.options.partial)throw e;return r||n.errors.push(e),e},i.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},r(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},70160:(t,e)=>{"use strict";function n(t){const e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);const r=t[n];e[r]=n})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=n(e.tagClass),e.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"},e.tagByName=n(e.tag)},36826:(t,e,n)=>{"use strict";const r=e;r._reverse=function(t){const e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);const r=t[n];e[r]=n})),e},r.der=n(70160)},41671:(t,e,n)=>{"use strict";const r=n(35717),i=n(4590),o=n(36625).C,s=n(41949),a=n(70160);function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){s.call(this,"der",t)}function d(t,e){let n=t.readUInt8(e);if(t.isError(n))return n;const r=a.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=t.readUInt8(e),t.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:a.tag[n]}}function l(t,e,n){let r=t.readUInt8(n);if(t.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return t.error("length octect is too long");r=0;for(let e=0;e{"use strict";const r=e;r.der=n(41671),r.pem=n(59631)},59631:(t,e,n)=>{"use strict";const r=n(35717),i=n(2399).Buffer,o=n(41671);function s(t){o.call(this,t),this.enc="pem"}r(s,o),t.exports=s,s.prototype.decode=function(t,e){const n=t.toString().split(/[\r\n]+/g),r=e.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/;let a=-1,u=-1;for(let t=0;t{"use strict";const r=n(35717),i=n(2399).Buffer,o=n(41949),s=n(70160);function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.call(this,"der",t)}function c(t){return t<10?"0"+t:t}t.exports=a,a.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(u,o),u.prototype._encodeComposite=function(t,e,n,r){const o=function(t,e,n,r){let i;if("seqof"===t?t="seq":"setof"===t&&(t="set"),s.tagByName.hasOwnProperty(t))i=s.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return r.error("Unknown tag: "+t);i=t}return i>=31?r.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=s.tagClassByName[n||"universal"]<<6,i)}(t,e,n,this.reporter);if(r.length<128){const t=i.alloc(2);return t[0]=o,t[1]=r.length,this._createEncoderBuffer([t,r])}let a=1;for(let t=r.length;t>=256;t>>=8)a++;const u=i.alloc(2+a);u[0]=o,u[1]=128|a;for(let t=1+a,e=r.length;e>0;t--,e>>=8)u[t]=255&e;return this._createEncoderBuffer([u,r])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=i.alloc(2*t.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let r=0;for(let e=0;e=128;n>>=7)r++}const o=i.alloc(r);let s=o.length-1;for(let e=t.length-1;e>=0;e--){let n=t[e];for(o[s--]=127&n;(n>>=7)>0;)o[s--]=128|127&n}return this._createEncoderBuffer(o)},u.prototype._encodeTime=function(t,e){let n;const r=new Date(t);return"gentime"===e?n=[c(r.getUTCFullYear()),c(r.getUTCMonth()+1),c(r.getUTCDate()),c(r.getUTCHours()),c(r.getUTCMinutes()),c(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?n=[c(r.getUTCFullYear()%100),c(r.getUTCMonth()+1),c(r.getUTCDate()),c(r.getUTCHours()),c(r.getUTCMinutes()),c(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(n,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=i.from(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const n=i.alloc(e);return t.copy(n),0===t.length&&(n[0]=0),this._createEncoderBuffer(n)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let n=1;for(let e=t;e>=256;e>>=8)n++;const r=new Array(n);for(let e=r.length-1;e>=0;e--)r[e]=255&t,t>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(i.from(r))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,n){const r=this._baseState;let i;if(null===r.default)return!1;const o=t.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,e,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i{"use strict";const r=e;r.der=n(66984),r.pem=n(2883)},2883:(t,e,n)=>{"use strict";const r=n(35717),i=n(66984);function o(t){i.call(this,t),this.enc="pem"}r(o,i),t.exports=o,o.prototype.encode=function(t,e){const n=i.prototype.encode.call(this,t).toString("base64"),r=["-----BEGIN "+e.label+"-----"];for(let t=0;t=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},58162:(t,e,n)=>{"use strict";var r=n(89509).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,d=new Uint8Array(s);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,f=s-1;(0!==l||h>>0,d[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,n++}for(var p=s-o;p!==s&&0===d[p];)p++;var m=r.allocUnsafe(i+(s-p));m.fill(0,0,i);for(var g=i;p!==s;)m[g++]=d[p++];return m}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=r.from(e)),!r.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var n=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,n++;for(var c=(s-o)*d+1>>>0,l=new Uint8Array(c);o!==s;){for(var h=e[o],f=0,p=c-1;(0!==h||f>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");i=f,o++}for(var m=c-i;m!==c&&0===l[m];)m++;for(var g=u.repeat(n);m{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],u=o[1],c=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,u)),d=0,l=u>0?s-4:s;for(n=0;n>16&255,c[d++]=e>>8&255,c[d++]=255&e;return 2===u&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,c[d++]=255&e),1===u&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,c[d++]=e>>8&255,c[d++]=255&e),c},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,c=r-i;ac?c:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,r){for(var i,o,s=[],a=e;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},40475:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.toBigIntLE=function(t){{const e=r.from(t);e.reverse();const n=e.toString("hex");return 0===n.length?BigInt(0):BigInt(`0x${n}`)}},e.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}},e.toBufferLE=function(t,e){{const n=t.toString(16),i=r.from(n.padStart(2*e,"0").slice(0,2*e),"hex");return i.reverse(),i}},e.toBufferBE=function(t,e){{const n=t.toString(16);return r.from(n.padStart(2*e,"0").slice(0,2*e),"hex")}}},44431:function(t,e,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",d=c+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,f=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,g=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function b(t){for(var e,n,r=1,i=t.length,o=t[0]+"";rc^n?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;so[s]^n?1:-1;return u==c?0:u>c^n?1:-1}function _(t,e,n,r){if(tn||t!==u(t))throw Error(c+(r||"Argument")+("number"==typeof t?tn?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function v(t){var e=t.c.length-1;return y(t.e/h)==e&&t.c[e]%2!=0}function k(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function M(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else eC?y.c=y.e=null:t.e=10;l/=10,c++);return void(c>C?y.c=y.e=null:(y.e=c,y.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(y,g,p);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(c=g.indexOf("."))>-1&&(g=g.replace(".","")),(l=g.search(/e/i))>0?(c<0&&(c=l),c+=+g.slice(l+1),g=g.substring(0,l)):c<0&&(c=g.length)}else{if(_(e,2,Y.length,"Base"),10==e&&F)return V(y=new W(t),L+y.e+1,$);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(y,g,p,e);if(y.s=1/t<0?(g=g.slice(1),-1):1,W.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(d+t)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(n=Y.slice(0,e),c=l=0,m=g.length;lc){c=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,l=-1,c=0;continue}return i(y,String(t),p,e)}p=!1,(c=(g=r(g,e,10,y.s)).indexOf("."))>-1?g=g.replace(".",""):c=g.length}for(l=0;48===g.charCodeAt(l);l++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(l,++m)){if(m-=l,p&&W.DEBUG&&m>15&&(t>f||t!==u(t)))throw Error(d+y.s*t);if((c=c-l-1)>C)y.c=y.e=null;else if(c=O)?k(u,s):M(u,s,"0");else if(o=(t=V(new W(t),e,n)).e,a=(u=b(t.c)).length,1==r||2==r&&(e<=o||o<=R)){for(;aa){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-a)>0)for(o+1==a&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function K(t,e){for(var n,r,i=1,o=new W(t[0]);i=10;i/=10,r++);return(n=r+n*h-1)>C?t.c=t.e=null:n=10;c/=10,i++);if((o=e-i)<0)o+=h,s=e,d=g[f=0],m=u(d/y[i-s-1]%10);else if((f=a((o+1)/h))>=g.length){if(!r)break t;for(;g.length<=f;g.push(0));d=m=0,i=1,s=(o%=h)-h+1}else{for(d=c=g[f],i=1;c>=10;c/=10,i++);m=(s=(o%=h)-h+i)<0?0:u(d/y[i-s-1]%10)}if(r=r||e<0||null!=g[f+1]||(s<0?d:d%y[i-s-1]),r=n<4?(m||r)&&(0==n||n==(t.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(o>0?s>0?d/y[i-s]:0:g[f-1])%10&1||n==(t.s<0?8:7)),e<1||!g[0])return g.length=0,r?(e-=t.e+1,g[0]=y[(h-e%h)%h],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=f,c=1,f--):(g.length=f+1,c=y[h-o],g[f]=s>0?u(d/y[i-s]%y[s])*c:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(t.e++,g[0]==l&&(g[0]=1));break}if(g[f]+=c,g[f]!=l)break;g[f--]=0,c=1}for(o=g.length;0===g[--o];g.pop());}t.e>C?t.c=t.e=null:t.e=O?k(e,n):M(e,n,"0"),t.s<0?"-"+e:e)}return W.clone=t,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(c+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(_(n=t[e],0,g,e),L=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(_(n=t[e],0,8,e),$=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(_(n[0],-g,0,e),_(n[1],0,g,e),R=n[0],O=n[1]):(_(n,-g,g,e),R=-(O=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)_(n[0],-g,-1,e),_(n[1],1,g,e),D=n[0],C=n[1];else{if(_(n,-g,g,e),!n)throw Error(c+e+" cannot be zero: "+n);D=-(C=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(c+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw N=!n,Error(c+"crypto unavailable");N=n}else N=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(_(n=t[e],0,9,e),z=n),t.hasOwnProperty(e="POW_PRECISION")&&(_(n=t[e],0,g,e),U=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(c+e+" not an object: "+n);j=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(c+e+" invalid: "+n);F="0123456789"==n.slice(0,10),Y=n}}return{DECIMAL_PLACES:L,ROUNDING_MODE:$,EXPONENTIAL_AT:[R,O],RANGE:[D,C],CRYPTO:N,MODULO_MODE:z,POW_PRECISION:U,FORMAT:j,ALPHABET:Y}},W.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!W.DEBUG)return!0;var e,n,r=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===u(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%h)<1&&(e+=h),String(r[0]).length==e){for(e=0;e=l||n!==u(n))break t;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+t)},W.maximum=W.max=function(){return K(arguments,-1)},W.minimum=W.min=function(){return K(arguments,1)},W.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return u(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,o,s=0,d=[],l=new W(B);if(null==t?t=L:_(t,0,g),i=a(t/h),N)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[s]=n[0],e[s+1]=n[1]):(d.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw N=!1,Error(c+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(e,s):(d.push(o%1e14),s+=7);s=i/7}if(!N)for(;s=10;o/=10,s++);sn-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var u,c,d,l,h,f,p,m,g=r.indexOf("."),y=L,w=$;for(g>=0&&(l=U,U=0,r=r.replace(".",""),f=(m=new W(i)).pow(r.length-g),U=l,m.c=e(M(b(f.c),f.e,"0"),10,o,t),m.e=m.c.length),d=l=(p=e(r,i,o,a?(u=Y,t):(u=t,Y))).length;0==p[--l];p.pop());if(!p[0])return u.charAt(0);if(g<0?--d:(f.c=p,f.e=d,f.s=s,p=(f=n(f,m,y,w,o)).c,h=f.r,d=f.e),g=p[c=d+y+1],l=o/2,h=h||c<0||null!=p[c+1],h=w<4?(null!=g||h)&&(0==w||w==(f.s<0?3:2)):g>l||g==l&&(4==w||h||6==w&&1&p[c-1]||w==(f.s<0?8:7)),c<1||!p[0])r=h?M(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(p.length=c,h)for(--o;++p[--c]>o;)p[c]=0,c||(++d,p=[1].concat(p));for(l=p.length;!p[--l];);for(g=0,r="";g<=l;r+=u.charAt(p[g++]));r=M(r,d,u.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,u=t.length,c=e%m,d=e/m|0;for(t=t.slice();u--;)a=((i=c*(o=t[u]%m)+(r=d*o+(s=t[u]/m|0)*c)%m*m+a)/n|0)+(r/m|0)+d*s,t[u]=i%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.splice(0,1));}return function(r,i,o,s,a){var c,d,f,p,m,g,b,w,_,v,k,M,A,S,I,x,E,T=r.s==i.s?1:-1,P=r.c,B=i.c;if(!(P&&P[0]&&B&&B[0]))return new W(r.s&&i.s&&(P?!B||P[0]!=B[0]:B)?P&&0==P[0]||!B?0*T:T/0:NaN);for(_=(w=new W(T)).c=[],T=o+(d=r.e-i.e)+1,a||(a=l,d=y(r.e/h)-y(i.e/h),T=T/h|0),f=0;B[f]==(P[f]||0);f++);if(B[f]>(P[f]||0)&&d--,T<0)_.push(1),p=!0;else{for(S=P.length,x=B.length,f=0,T+=2,(m=u(a/(B[0]+1)))>1&&(B=t(B,m,a),P=t(P,m,a),x=B.length,S=P.length),A=x,k=(v=P.slice(0,x)).length;k=a/2&&I++;do{if(m=0,(c=e(B,v,x,k))<0){if(M=v[0],x!=k&&(M=M*a+(v[1]||0)),(m=u(M/I))>1)for(m>=a&&(m=a-1),b=(g=t(B,m,a)).length,k=v.length;1==e(g,v,b,k);)m--,n(g,x=10;T/=10,f++);V(w,o+(w.e=f+d*h-1)+1,s,p)}else w.e=d,w.r=+p;return w}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,x=/^\.([^.]+)$/,E=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(T,"");if(E.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(S,(function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e})),r&&(i=r,o=o.replace(I,"$1").replace(x,"0.$1")),e!=o))return new W(o,i);if(W.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},P.absoluteValue=P.abs=function(){var t=new W(this);return t.s<0&&(t.s=1),t},P.comparedTo=function(t,e){return w(this,new W(t,e))},P.decimalPlaces=P.dp=function(t,e){var n,r,i,o=this;if(null!=t)return _(t,0,g),null==e?e=$:_(e,0,8),V(new W(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-y(this.e/h))*h,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},P.dividedBy=P.div=function(t,e){return n(this,new W(t,e),L,$)},P.dividedToIntegerBy=P.idiv=function(t,e){return n(this,new W(t,e),0,1)},P.exponentiatedBy=P.pow=function(t,e){var n,r,i,o,s,d,l,f,p=this;if((t=new W(t)).c&&!t.isInteger())throw Error(c+"Exponent not an integer: "+G(t));if(null!=e&&(e=new W(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return f=new W(Math.pow(+G(p),s?t.s*(2-v(t)):+G(t))),e?f.mod(e):f;if(d=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new W(NaN);(r=!d&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&v(t)?-0:0,p.e>-1&&(o=1/o),new W(d?1/o:o);U&&(o=a(U/h+2))}for(s?(n=new W(.5),d&&(t.s=1),l=v(t)):l=(i=Math.abs(+G(t)))%2,f=new W(B);;){if(l){if(!(f=f.times(p)).c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(e))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(V(t=t.times(n),t.e+1,1),t.e>14)l=v(t);else{if(0==(i=+G(t)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(e))}return r?f:(d&&(f=B.div(f)),e?f.mod(e):o?V(f,U,$,void 0):f)},P.integerValue=function(t){var e=new W(this);return null==t?t=$:_(t,0,8),V(e,e.e+1,t)},P.isEqualTo=P.eq=function(t,e){return 0===w(this,new W(t,e))},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(t,e){return w(this,new W(t,e))>0},P.isGreaterThanOrEqualTo=P.gte=function(t,e){return 1===(e=w(this,new W(t,e)))||0===e},P.isInteger=function(){return!!this.c&&y(this.e/h)>this.c.length-2},P.isLessThan=P.lt=function(t,e){return w(this,new W(t,e))<0},P.isLessThanOrEqualTo=P.lte=function(t,e){return-1===(e=w(this,new W(t,e)))||0===e},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.minus=function(t,e){var n,r,i,o,s=this,a=s.s;if(e=(t=new W(t,e)).s,!a||!e)return new W(NaN);if(a!=e)return t.s=-e,s.plus(t);var u=s.e/h,c=t.e/h,d=s.c,f=t.c;if(!u||!c){if(!d||!f)return d?(t.s=-e,t):new W(f?s:NaN);if(!d[0]||!f[0])return f[0]?(t.s=-e,t):new W(d[0]?s:3==$?-0:0)}if(u=y(u),c=y(c),d=d.slice(),a=u-c){for((o=a<0)?(a=-a,i=d):(c=u,i=f),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=d.length)<(e=f.length))?a:e,a=e=0;e0)for(;e--;d[n++]=0);for(e=l-1;r>a;){if(d[--r]=0;){for(n=0,p=M[i]%_,g=M[i]/_|0,o=i+(s=u);o>i;)n=((c=p*(c=k[--s]%_)+(a=g*c+(d=k[s]/_|0)*p)%_*_+b[o]+n)/w|0)+(a/_|0)+g*d,b[o--]=c%w;b[o]=n}return n?++r:b.splice(0,1),q(t,b,r)},P.negated=function(){var t=new W(this);return t.s=-t.s||null,t},P.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new W(t,e)).s,!i||!e)return new W(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/h,s=t.e/h,a=r.c,u=t.c;if(!o||!s){if(!a||!u)return new W(i/0);if(!a[0]||!u[0])return u[0]?t:new W(a[0]?r:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(e=u.length)<0&&(n=u,u=a,a=n,e=i),i=0;e;)i=(a[--e]=a[e]+u[e]+i)/l|0,a[e]=l===a[e]?0:a[e]%l;return i&&(a=[i].concat(a),++s),q(t,a,s)},P.precision=P.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return _(t,1,g),null==e?e=$:_(e,0,8),V(new W(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*h+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},P.shiftedBy=function(t){return _(t,-9007199254740991,f),this.times("1e"+t)},P.squareRoot=P.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,u=s.s,c=s.e,d=L+4,l=new W("0.5");if(1!==u||!a||!a[0])return new W(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+G(s)))||u==1/0?(((e=b(a)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=y((c+1)/2)-(c<0||c%2),r=new W(e=u==1/0?"5e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):r=new W(u+""),r.c[0])for((u=(c=r.e)+d)<3&&(u=0);;)if(o=r,r=l.times(o.plus(n(s,o,d,1))),b(o.c).slice(0,u)===(e=b(r.c)).slice(0,u)){if(r.e0&&m>0){for(o=m%a||a,l=p.substr(0,o);o0&&(l+=d+p.slice(o)),f&&(l="-"+l)}r=h?l+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):l}return(n.prefix||"")+r+(n.suffix||"")},P.toFraction=function(t){var e,r,i,o,s,a,u,d,l,f,m,g,y=this,w=y.c;if(null!=t&&(!(u=new W(t)).isInteger()&&(u.c||1!==u.s)||u.lt(B)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+G(u));if(!w)return new W(y);for(e=new W(B),l=r=new W(B),i=d=new W(B),g=b(w),s=e.e=g.length-y.e-1,e.c[0]=p[(a=s%h)<0?h+a:a],t=!t||u.comparedTo(e)>0?s>0?e:l:u,a=C,C=1/0,u=new W(g),d.c[0]=0;f=n(u,e,0,1),1!=(o=r.plus(f.times(i))).comparedTo(t);)r=i,i=o,l=d.plus(f.times(o=l)),d=o,e=u.minus(f.times(o=e)),u=o;return o=n(t.minus(r),i,0,1),d=d.plus(o.times(l)),r=r.plus(o.times(i)),d.s=l.s=y.s,m=n(l,i,s*=2,$).minus(y).abs().comparedTo(n(d,r,s,$).minus(y).abs())<1?[l,i]:[d,r],C=a,m},P.toNumber=function(){return+G(this)},P.toPrecision=function(t,e){return null!=t&&_(t,1,g),H(this,t,e,2)},P.toString=function(t){var e,n=this,i=n.s,o=n.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=R||o>=O?k(b(n.c),o):M(b(n.c),o,"0"):10===t&&F?e=M(b((n=V(new W(n),L+o+1,$)).c),n.e,"0"):(_(t,2,Y.length,"Base"),e=r(M(b(n.c),o,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},P.valueOf=P.toJSON=function(){return G(this)},P._isBigNumber=!0,null!=e&&W.set(e),W}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(e,n,e,t))||(t.exports=r)}()},13550:function(t,e,n){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(46601).Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),u=e;u=49?c-49+10:c>=17?c-17+10:c,r(c>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],f=[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],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?h[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],d=p[t];n="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(d).toString(t);n=(l=l.idivn(d)).isZero()?m+n:h[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(t[n--]=s>>8&255),n>=0&&(t[n--]=s>>16&255),6===o?(n>=0&&(t[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function y(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function b(t,e,n){return y(t,e,n)}function w(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):n<63?m(this,t,e):n<1024?y(this,t,e):b(this,t,e)},w.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},w.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i&1}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new I(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){I.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(k,v),k.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},k.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new k;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return _[t]=e,e},I.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(d(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},I.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},I.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new x(t)},i(x,I),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},25532:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},u=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeUnchecked=e.deserialize=e.serialize=e.BinaryReader=e.BinaryWriter=e.BorshError=e.baseDecode=e.baseEncode=void 0;const c=u(n(13550)),d=u(n(77191)),l=a(n(21127)),h=new("function"!=typeof TextDecoder?l.TextDecoder:TextDecoder)("utf-8",{fatal:!0});e.baseEncode=function(t){return"string"==typeof t&&(t=r.from(t,"utf8")),d.default.encode(r.from(t))},e.baseDecode=function(t){return r.from(d.default.decode(t))};const f=1024;class p extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}e.BorshError=p;class m{constructor(){this.buf=r.alloc(f),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=r.concat([this.buf,r.alloc(f)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(r.from(new c.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(r.from(new c.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(r.from(new c.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(r.from(new c.default(t).toArray("le",64)))}writeBuffer(t){this.buf=r.concat([r.from(this.buf.subarray(0,this.length)),t,r.alloc(f)]),this.length+=t.length}writeString(t){this.maybeResize();const e=r.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(r.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}}function g(t,e,n){const r=n.value;n.value=function(...t){try{return r.apply(this,t)}catch(t){if(t instanceof RangeError){const e=t.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e)>=0)throw new p("Reached the end of buffer when deserializing")}throw t}}}e.BinaryWriter=m;class y{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new c.default(t,"le")}readU128(){const t=this.readBuffer(16);return new c.default(t,"le")}readU256(){const t=this.readBuffer(32);return new c.default(t,"le")}readU512(){const t=this.readBuffer(64);return new c.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new p(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return h.decode(e)}catch(t){throw new p(`Error decoding UTF-8 string: ${t}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),n=Array();for(let r=0;r{w(t,e,n,r[0],i)}));else if(void 0!==r.kind)switch(r.kind){case"option":null==n?i.writeU8(0):(i.writeU8(1),w(t,e,n,r.type,i));break;case"map":i.writeU32(n.size),n.forEach(((n,o)=>{w(t,e,o,r.key,i),w(t,e,n,r.value,i)}));break;default:throw new p(`FieldType ${r} unrecognized`)}else _(t,n,i)}catch(t){throw t instanceof p&&t.addToFieldPath(e),t}}function _(t,e,n){if("function"==typeof e.borshSerialize)return void e.borshSerialize(n);const r=t.get(e.constructor);if(!r)throw new p(`Class ${e.constructor.name} is missing in schema`);if("struct"===r.kind)r.fields.map((([r,i])=>{w(t,r,e[r],i,n)}));else{if("enum"!==r.kind)throw new p(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`);{const i=e[r.field];for(let o=0;ov(t,e,n[0],r)))}if("option"===n.kind)return r.readU8()?v(t,e,n.type,r):void 0;if("map"===n.kind){let i=new Map;const o=r.readU32();for(let s=0;s=r.values.length)throw new p(`Enum index: ${i} is out of range`);const[o,s]=r.values[i];return new e({[o]:v(t,o,s,n)})}throw new p(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}s([g],y.prototype,"readU8",null),s([g],y.prototype,"readU16",null),s([g],y.prototype,"readU32",null),s([g],y.prototype,"readU64",null),s([g],y.prototype,"readU128",null),s([g],y.prototype,"readU256",null),s([g],y.prototype,"readU512",null),s([g],y.prototype,"readString",null),s([g],y.prototype,"readFixedArray",null),s([g],y.prototype,"readArray",null),e.BinaryReader=y,e.serialize=function(t,e,n=m){const r=new n;return _(t,e,r),r.toArray()},e.deserialize=function(t,e,n,r=y){const i=new r(n),o=k(t,e,i);if(i.offset{var r;function i(t){this.rand=t}if(t.exports=function(t){return r||(r=new i(null)),r.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n{var r=n(89509).Buffer;function i(t){r.isBuffer(t)||(t=r.from(t));for(var e=t.length/4|0,n=new Array(e),i=0;i>>24]^d[p>>>16&255]^l[m>>>8&255]^h[255&g]^e[y++],s=c[p>>>24]^d[m>>>16&255]^l[g>>>8&255]^h[255&f]^e[y++],a=c[m>>>24]^d[g>>>16&255]^l[f>>>8&255]^h[255&p]^e[y++],u=c[g>>>24]^d[f>>>16&255]^l[p>>>8&255]^h[255&m]^e[y++],f=o,p=s,m=a,g=u;return o=(r[f>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^e[y++],s=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&f])^e[y++],a=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[f>>>8&255]<<8|r[255&p])^e[y++],u=(r[g>>>24]<<24|r[f>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^e[y++],[o>>>=0,s>>>=0,a>>>=0,u>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var c=a^a<<1^a<<2^a<<3^a<<4;c=c>>>8^255&c^99,n[s]=c,r[c]=s;var d=t[s],l=t[d],h=t[l],f=257*t[c]^16843008*c;i[0][s]=f<<24|f>>>8,i[1][s]=f<<16|f>>>16,i[2][s]=f<<8|f>>>24,i[3][s]=f,f=16843009*h^65537*l^257*d^16843008*s,o[0][c]=f<<24|f>>>8,o[1][c]=f<<16|f>>>16,o[2][c]=f<<8|f>>>24,o[3][c]=f,0===s?s=a=1:(s=d^t[t[t[h^d]]],a^=t[t[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,n=e+6,r=4*(n+1),i=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/e|0]<<24):e>6&&o%e==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-e]^s}for(var c=[],d=0;d>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return s(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),n=r.allocUnsafe(16);return n.writeUInt32BE(e[0],0),n.writeUInt32BE(e[1],4),n.writeUInt32BE(e[2],8),n.writeUInt32BE(e[3],12),n},c.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var n=s(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},62422:(t,e,n)=>{var r=n(74497),i=n(89509).Buffer,o=n(71027),s=n(35717),a=n(83288),u=n(67295),c=n(20685);function d(t,e,n,s){o.call(this);var u=i.alloc(4,0);this._cipher=new r.AES(e);var d=this._cipher.encryptBlock(u);this._ghash=new a(d),n=function(t,e,n){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var r=new a(n),o=e.length,s=o%16;r.update(e),s&&(s=16-s,r.update(i.alloc(s,0))),r.update(i.alloc(8,0));var u=8*o,d=i.alloc(8);d.writeUIntBE(u,0,8),r.update(d),t._finID=r.state;var l=i.from(t._finID);return c(l),l}(this,n,d),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}s(d,o),d.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var n=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(n),this._len+=t.length,n},d.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var n=0;t.length!==e.length&&n++;for(var r=Math.min(t.length,e.length),i=0;i{var r=n(71494),i=n(66193),o=n(44946);e.createCipher=e.Cipher=r.createCipher,e.createCipheriv=e.Cipheriv=r.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},66193:(t,e,n)=>{var r=n(62422),i=n(89509).Buffer,o=n(45),s=n(25969),a=n(71027),u=n(74497),c=n(13048);function d(t,e,n){a.call(this),this._cache=new l,this._last=void 0,this._cipher=new u.AES(e),this._prev=i.from(n),this._mode=t,this._autopadding=!0}function l(){this.cache=i.allocUnsafe(0)}function h(t,e,n){var a=o[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=i.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof e&&(e=i.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===a.type?new s(a.module,e,n,!0):"auth"===a.type?new r(a.module,e,n,!0):new d(a.module,e,n)}n(35717)(d,a),d.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,e),r.push(n);return i.concat(r)},d.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var n=-1;++n16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var n=o[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=c(e,!1,n.key,n.iv);return h(t,r.key,r.iv)},e.createDecipheriv=h},71494:(t,e,n)=>{var r=n(45),i=n(62422),o=n(89509).Buffer,s=n(25969),a=n(71027),u=n(74497),c=n(13048);function d(t,e,n){a.call(this),this._cache=new h,this._cipher=new u.AES(e),this._prev=o.from(n),this._mode=t,this._autopadding=!0}n(35717)(d,a),d.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get();)n=this._mode.encrypt(this,e),r.push(n);return o.concat(r)};var l=o.alloc(16,16);function h(){this.cache=o.allocUnsafe(0)}function f(t,e,n){var a=r[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===a.type?new s(a.module,e,n):"auth"===a.type?new i(a.module,e,n):new d(a.module,e,n)}d.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},h.prototype.add=function(t){this.cache=o.concat([this.cache,t])},h.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},h.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),n=-1;++n{var r=n(89509).Buffer,i=r.alloc(16,0);function o(t){var e=r.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}s.prototype.ghash=function(t){for(var e=-1;++e0;e--)r[e]=r[e]>>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=r[0]^225<<24)}this.state=o(i)},s.prototype.update=function(t){var e;for(this.cache=r.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=s},20685:t=>{t.exports=function(t){for(var e,n=t.length;n--;){if(255!==(e=t.readUInt8(n))){e++,t.writeUInt8(e,n);break}t.writeUInt8(0,n)}}},25292:(t,e,n)=>{var r=n(67295);e.encrypt=function(t,e){var n=r(e,t._prev);return t._prev=t._cipher.encryptBlock(n),t._prev},e.decrypt=function(t,e){var n=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return r(i,n)}},86311:(t,e,n)=>{var r=n(89509).Buffer,i=n(67295);function o(t,e,n){var o=e.length,s=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=r.concat([t._prev,n?e:s]),s}e.encrypt=function(t,e,n){for(var i,s=r.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=r.allocUnsafe(0)),!(t._cache.length<=e.length)){s=r.concat([s,o(t,e,n)]);break}i=t._cache.length,s=r.concat([s,o(t,e.slice(0,i),n)]),e=e.slice(i)}return s}},21510:(t,e,n)=>{var r=n(89509).Buffer;function i(t,e,n){for(var r,i,s=-1,a=0;++s<8;)r=e&1<<7-s?128:0,a+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^r))>>s%8,t._prev=o(t._prev,n?r:i);return a}function o(t,e){var n=t.length,i=-1,o=r.allocUnsafe(t.length);for(t=r.concat([t,r.from([e])]);++i>7;return o}e.encrypt=function(t,e,n){for(var o=e.length,s=r.allocUnsafe(o),a=-1;++a{var r=n(89509).Buffer;function i(t,e,n){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=r.concat([t._prev.slice(1),r.from([n?e:i])]),i}e.encrypt=function(t,e,n){for(var o=e.length,s=r.allocUnsafe(o),a=-1;++a{var r=n(67295),i=n(89509).Buffer,o=n(20685);function s(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var n=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*n)]);for(var a=0;a{e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},45:(t,e,n)=>{var r={ECB:n(11084),CBC:n(25292),CFB:n(86311),CFB8:n(71964),CFB1:n(21510),OFB:n(18861),CTR:n(96009),GCM:n(96009)},i=n(44946);for(var o in i)i[o].module=r[i[o].mode];t.exports=i},18861:(t,e,n)=>{var r=n(48764).Buffer,i=n(67295);function o(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(t,e){for(;t._cache.length{var r=n(74497),i=n(89509).Buffer,o=n(71027);function s(t,e,n,s){o.call(this),this._cipher=new r.AES(e),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._mode=t}n(35717)(s,o),s.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},53614:(t,e,n)=>{var r=n(47667),i=n(44696),o=n(45),s=n(99715),a=n(13048);function u(t,e,n){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,n);if(s[t])return new r({key:e,iv:n,mode:t});throw new TypeError("invalid suite type")}function c(t,e,n){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,n);if(s[t])return new r({key:e,iv:n,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");n=8*s[t].key,r=s[t].iv}var i=a(e,!1,n,r);return u(t,i.key,i.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");n=8*s[t].key,r=s[t].iv}var i=a(e,!1,n,r);return c(t,i.key,i.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(s).concat(i.getCiphers())}},47667:(t,e,n)=>{var r=n(71027),i=n(15251),o=n(35717),s=n(89509).Buffer,a={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function u(t){r.call(this);var e,n=t.mode.toLowerCase(),i=a[n];e=t.decrypt?"decrypt":"encrypt";var o=t.key;s.isBuffer(o)||(o=s.from(o)),"des-ede"!==n&&"des-ede-cbc"!==n||(o=s.concat([o,o.slice(0,8)]));var u=t.iv;s.isBuffer(u)||(u=s.from(u)),this._des=i.create({key:o,iv:u,type:e})}a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],t.exports=u,o(u,r),u.prototype._update=function(t){return s.from(this._des.update(t))},u.prototype._final=function(){return s.from(this._des.final())}},99715:(t,e)=>{e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},23663:(t,e,n)=>{var r=n(48764).Buffer,i=n(13550),o=n(61798);function s(t){var e,n=t.modulus.byteLength();do{e=new i(o(n))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,e){var n=function(t){var e=s(t);return{blinder:e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),o=e.modulus.byteLength(),a=new i(t).mul(n.blinder).umod(e.modulus),u=a.toRed(i.mont(e.prime1)),c=a.toRed(i.mont(e.prime2)),d=e.coefficient,l=e.prime1,h=e.prime2,f=u.redPow(e.exponent1).fromRed(),p=c.redPow(e.exponent2).fromRed(),m=f.isub(p).imul(d).umod(l).imul(h);return p.iadd(m).imul(n.unblinder).umod(e.modulus).toArrayLike(r,"be",o)}a.getr=s,t.exports=a},56042:(t,e,n)=>{"use strict";t.exports=n(75207)},64743:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=n(23482),o=n(23872),s=n(35717),a=n(82957),u=n(47753),c=n(75207);function d(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){return new d(t)}function f(t){return new l(t)}Object.keys(c).forEach((function(t){c[t].id=r.from(c[t].id,"hex"),c[t.toLowerCase()]=c[t]})),s(d,o.Writable),d.prototype._write=function(t,e,n){this._hash.update(t),n()},d.prototype.update=function(t,e){return this._hash.update("string"==typeof t?r.from(t,e):t),this},d.prototype.sign=function(t,e){this.end();var n=this._hash.digest(),r=a(n,t,this._hashType,this._signType,this._tag);return e?r.toString(e):r},s(l,o.Writable),l.prototype._write=function(t,e,n){this._hash.update(t),n()},l.prototype.update=function(t,e){return this._hash.update("string"==typeof t?r.from(t,e):t),this},l.prototype.verify=function(t,e,n){var i="string"==typeof e?r.from(e,n):e;this.end();var o=this._hash.digest();return u(i,o,t,this._signType,this._tag)},t.exports={Sign:h,Verify:f,createSign:h,createVerify:f}},82957:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=n(58355),o=n(23663),s=n(86266).ec,a=n(13550),u=n(70980),c=n(1308);function d(t,e,n,o){if((t=r.from(t.toArray())).length0&&n.ishrn(r),n}function h(t,e,n){var o,s;do{for(o=r.alloc(0);8*o.length{"use strict";var r=n(89509).Buffer,i=n(13550),o=n(86266).ec,s=n(70980),a=n(1308);function u(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=0)throw new Error("invalid sig")}t.exports=function(t,e,n,c,d){var l=s(n);if("ec"===l.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(t,e,n){var r=a[n.data.algorithm.curve.join(".")];if(!r)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var i=new o(r),s=n.data.subjectPrivateKey.data;return i.verify(e,t,s)}(t,e,l)}if("dsa"===l.type){if("dsa"!==c)throw new Error("wrong public key type");return function(t,e,n){var r=n.data.p,o=n.data.q,a=n.data.g,c=n.data.pub_key,d=s.signature.decode(t,"der"),l=d.s,h=d.r;u(l,o),u(h,o);var f=i.mont(r),p=l.invm(o);return 0===a.toRed(f).redPow(new i(e).mul(p).mod(o)).fromRed().mul(c.toRed(f).redPow(h.mul(p).mod(o)).fromRed()).mod(r).mod(o).cmp(h)}(t,e,l)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");e=r.concat([d,e]);for(var h=l.modulus.byteLength(),f=[1],p=0;e.length+f.length+2{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,4)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-9,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var c=("number"!=typeof u&&(u=0),u+1>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(r(e,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},34390:(t,e,n)=>{"use strict";var r=n(34155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=d;var o=n(44960),s=n(92010);n(35717)(d,o);for(var a=i(s.prototype),u=0;u{"use strict";t.exports=i;var r=n(3912);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(35717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},44960:(t,e,n)=>{"use strict";var r,i=n(34155);t.exports=S,S.ReadableState=A,n(17187).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=n(59819),u=n(48764).Buffer,c=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=n(56353);o=d&&d.debuglog?d.debuglog("stream"):function(){};var l,h,f,p=n(76633),m=n(75997),g=n(898).getHighWaterMark,y=n(84419).q,b=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(35717)(S,a);var k=m.errorOrDestroy,M=["error","close","destroy","pause","resume"];function A(t,e,i){r=r||n(34390),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(72221).s),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function S(t){if(r=r||n(34390),!(this instanceof S))return new S(t);var e=this instanceof r;this._readableState=new A(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function I(t,e,n,r,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(i||(s=function(t,e){var n,r;return r=e,u.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],e)),n}(a,e)),s)k(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r)a.endEmitted?k(t,new v):x(t,a,e,!0);else if(a.ended)k(t,new w);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):L(t,a)):x(t,a,e,!1)}else r||(a.reading=!1,L(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function P(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(B,t))}function B(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function L(t,e){e.readingMore||(e.readingMore=!0,i.nextTick($,t,e))}function $(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function z(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function j(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?z(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&z(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&z(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(t){k(this,new _("_read()"))},S.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?m:u;function u(){o("onend"),t.end()}r.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",f),t.removeListener("finish",p),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",e),n.removeListener("end",u),n.removeListener("end",m),n.removeListener("data",l),d=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(n);t.on("drain",c);var d=!1;function l(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==j(r.pipes,t))&&!d&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function h(e){o("onerror",e),m(),t.removeListener("error",h),0===s(t,"error")&&k(t,e)}function f(){t.removeListener("finish",p),m()}function p(){o("onfinish"),t.removeListener("close",f),m()}function m(){o("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",h),t.once("close",f),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?P(this):r.reading||i.nextTick(O,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(R,this),n},S.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(R,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(D,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s{"use strict";t.exports=d;var r=n(84419).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(34390);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var r,i=n(34155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=S,S.WritableState=A;var s,a={deprecate:n(94927)},u=n(59819),c=n(48764).Buffer,d=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=n(75997),h=n(898).getHighWaterMark,f=n(84419).q,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,w=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,v=f.ERR_UNKNOWN_ENCODING,k=l.errorOrDestroy;function M(){}function A(t,e,s){r=r||n(34390),t=t||{},"boolean"!=typeof s&&(s=e instanceof r),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(B,t,e),t._writableState.errorEmitted=!0,k(t,r)):(o(r),t._writableState.errorEmitted=!0,k(t,r),B(t,e))}(t,n,r,e,o);else{var s=T(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(t,n),r?i.nextTick(x,t,n,s,o):x(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function S(t){var e=this instanceof(r=r||n(34390));if(!e&&!s.call(S,this))return new S(t);this._writableState=new A(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function I(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function x(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),B(t,e)}function E(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,I(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,d=n.encoding,l=n.callback;if(I(t,e,!1,e.objectMode?1:c.length,c,d,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(n){e.pendingcb--,n&&k(t,n),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var n=T(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(35717)(S,u),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===S&&t&&t._writableState instanceof A}})):s=function(t){return t instanceof this},S.prototype.pipe=function(){k(this,new y)},S.prototype.write=function(t,e,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=t,c.isBuffer(r)||r instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=M),o.ending?function(t,e){var n=new _;k(t,n),i.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o;return null===n?o=new w:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(k(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,n){n(new m("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,B(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(t,e){e(t)}},54887:(t,e,n)=>{"use strict";var r,i=n(34155);function o(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=n(5800),a=Symbol("lastResolve"),u=Symbol("lastReject"),c=Symbol("error"),d=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(t,e){return{value:t,done:e}}function m(t){var e=t[a];if(null!==e){var n=t[f].read();null!==n&&(t[l]=null,t[a]=null,t[u]=null,e(p(n,!1)))}}function g(t){i.nextTick(m,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(r={get stream(){return this[f]},next:function(){var t=this,e=this[c];if(null!==e)return Promise.reject(e);if(this[d])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[c]?n(t[c]):e(p(void 0,!0))}))}));var n,r=this[l];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[d]?n(p(void 0,!0)):e[h](n,r)}),r)}}(r,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),y);t.exports=function(t){var e,n=Object.create(b,(o(e={},f,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,c,{value:null,writable:!0}),o(e,d,{value:t._readableState.endEmitted,writable:!0}),o(e,h,{value:function(t,e){var r=n[f].read();r?(n[l]=null,n[a]=null,n[u]=null,t(p(r,!1))):(n[a]=t,n[u]=e)},writable:!0}),e));return n[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[u];return null!==e&&(n[l]=null,n[a]=null,n[u]=null,e(t)),void(n[c]=t)}var r=n[a];null!==r&&(n[l]=null,n[a]=null,n[u]=null,r(p(void 0,!0))),n[d]=!0})),t.on("readable",g.bind(null,n)),n}},76633:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return u.alloc(0);for(var e,n,r,i=u.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,u.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=u.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:d,value:function(t,e){return c(this,i(i({},e),{},{depth:0,customInspect:!1}))}}])&&s(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},75997:(t,e,n)=>{"use strict";var r=n(34155);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(s,this,t)):r.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},5800:(t,e,n)=>{"use strict";var r=n(84419).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},37065:(t,e,n)=>{"use strict";var r,i=n(84419).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t){t()}function c(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),i=0;i0,(function(t){d||(d=t),t&&h.forEach(u),o||(h.forEach(u),l(d))}))}));return e.reduce(c)}},898:(t,e,n)=>{"use strict";var r=n(84419).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},59819:(t,e,n)=>{t.exports=n(17187).EventEmitter},23872:(t,e,n)=>{(e=t.exports=n(44960)).Stream=e,e.Readable=e,e.Writable=n(92010),e.Duplex=n(34390),e.Transform=n(3912),e.PassThrough=n(41294),e.finished=n(5800),e.pipeline=n(37065)},72221:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=d,this.end=l,e=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function d(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},77191:(t,e,n)=>{var r=n(58162);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},20698:(t,e,n)=>{"use strict";var r=n(48764).Buffer;class i{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function o(t,e){return e.property?t+"["+e.property+"]":t}e.Layout=i,e.nameWithProperty=o,e.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof i))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class s extends i{isCount(){throw new Error("ExternalLayout is abstract")}}class a extends s{constructor(t,e){if(void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class u extends s{constructor(t,e,n){if(!(t instanceof i))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof c||this.layout instanceof d}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class c extends i{constructor(t,e){if(super(t,e),6t+r.encode(i,e,n+t)),0);return this.count instanceof s&&this.count.encode(t.length,e,n),i}}class S extends i{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof i),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class I{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class x extends I{constructor(t,e){if(!(t instanceof s&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class E extends i{constructor(t,e,n){const r=t instanceof c||t instanceof d;if(r)t=new x(new u(t));else if(t instanceof s&&t.isCount())t=new x(t);else if(!(t instanceof I))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof i))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&r&&(o+=t.layout.span)),super(o,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let a=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return a(t)},this.configGetSourceVariant=function(t){a=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new T(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return r.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class T extends i{constructor(t,e,n,r){if(!(t instanceof E))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof i))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=n?n.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function P(t){return 0>t&&(t+=4294967296),t}class B extends i{constructor(t,e,n){if(!(t instanceof c||t instanceof d))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==P(t&this.valueMask))throw new TypeError(o("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=P(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let i=this.length;if(this.length instanceof s&&(i=t.length),!r.isBuffer(t)||i!==t.length)throw new TypeError(o("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,i,"hex"),this.length instanceof s&&this.length.encode(i,e,n),i}}class O extends i{constructor(t){super(-1,t)}getSpan(t,e){if(!r.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return i.copy(e,n),e[n+o]=0,o+1}}class D extends i{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!r.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return i.copy(e,n),o}}class C extends i{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}e.ExternalLayout=s,e.GreedyCount=a,e.OffsetLayout=u,e.UInt=c,e.UIntBE=d,e.Int=l,e.IntBE=h,e.Float=_,e.FloatBE=v,e.Double=k,e.DoubleBE=M,e.Sequence=A,e.Structure=S,e.UnionDiscriminator=I,e.UnionLayoutDiscriminator=x,e.Union=E,e.VariantLayout=T,e.BitStructure=B,e.BitField=L,e.Boolean=$,e.Blob=R,e.CString=O,e.UTF8=D,e.Constant=C,e.greedy=(t,e)=>new a(t,e),e.offset=(t,e,n)=>new u(t,e,n),e.u8=t=>new c(1,t),e.u16=t=>new c(2,t),e.u24=t=>new c(3,t),e.u32=t=>new c(4,t),e.u40=t=>new c(5,t),e.u48=t=>new c(6,t),e.nu64=t=>new g(t),e.u16be=t=>new d(2,t),e.u24be=t=>new d(3,t),e.u32be=t=>new d(4,t),e.u40be=t=>new d(5,t),e.u48be=t=>new d(6,t),e.nu64be=t=>new y(t),e.s8=t=>new l(1,t),e.s16=t=>new l(2,t),e.s24=t=>new l(3,t),e.s32=t=>new l(4,t),e.s40=t=>new l(5,t),e.s48=t=>new l(6,t),e.ns64=t=>new b(t),e.s16be=t=>new h(2,t),e.s24be=t=>new h(3,t),e.s32be=t=>new h(4,t),e.s40be=t=>new h(5,t),e.s48be=t=>new h(6,t),e.ns64be=t=>new w(t),e.f32=t=>new _(t),e.f32be=t=>new v(t),e.f64=t=>new k(t),e.f64be=t=>new M(t),e.struct=(t,e,n)=>new S(t,e,n),e.bits=(t,e,n)=>new B(t,e,n),e.seq=(t,e,n)=>new A(t,e,n),e.union=(t,e,n)=>new E(t,e,n),e.unionLayoutDiscriminator=(t,e)=>new x(t,e),e.blob=(t,e)=>new R(t,e),e.cstr=t=>new O(t),e.utf8=(t,e)=>new D(t,e),e.const=(t,e)=>new C(t,e)},67295:(t,e,n)=>{var r=n(48764).Buffer;t.exports=function(t,e){for(var n=Math.min(t.length,e.length),i=new r(n),o=0;o{"use strict";const r=n(79742),i=n(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return f(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return u.from(r,e,n);const i=function(t){if(u.isBuffer(t)){const e=0|p(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?a(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function d(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return d(t),a(t<0?0:0|p(t))}function h(t){const e=t.length<0?0:0|p(t.length),n=a(e);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(i)return r?-1:K(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return T(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function I(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=x)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,r,i){if(G(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(r,i),d=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return k(this,t,e,n);case"base64":return M(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function $(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){Y(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function O(t,e,n,r,i){Y(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function C(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function N(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=J((function(t){F(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=J((function(t){F(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||L(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||$(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||$(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=J((function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);$(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);$(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=J((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,n){return C(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return C(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return N(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function Y(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function F(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw F(t,n),new z.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=j(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function K(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},23204:t=>{"use strict";const e=/[\p{Lu}]/u,n=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,i=/([\p{Alpha}\p{N}_]|$)/u,o=/[_.\- ]+/,s=new RegExp("^"+o.source),a=new RegExp(o.source+i.source,"gu"),u=new RegExp("\\d+"+i.source,"gu"),c=(t,i)=>{if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("Expected the input to be `string | string[]`");if(i={pascalCase:!1,preserveConsecutiveUppercase:!1,...i},0===(t=Array.isArray(t)?t.map((t=>t.trim())).filter((t=>t.length)).join("-"):t.trim()).length)return"";const o=!1===i.locale?t=>t.toLowerCase():t=>t.toLocaleLowerCase(i.locale),c=!1===i.locale?t=>t.toUpperCase():t=>t.toLocaleUpperCase(i.locale);return 1===t.length?i.pascalCase?c(t):o(t):(t!==o(t)&&(t=((t,r,i)=>{let o=!1,s=!1,a=!1;for(let u=0;u(r.lastIndex=0,t.replace(r,(t=>e(t)))))(t,o):o(t),i.pascalCase&&(t=c(t.charAt(0))+t.slice(1)),((t,e)=>(a.lastIndex=0,u.lastIndex=0,t.replace(a,((t,n)=>e(n))).replace(u,(t=>e(t)))))(t,c))};t.exports=c,t.exports.default=c},71027:(t,e,n)=>{var r=n(89509).Buffer,i=n(42830).Transform,o=n(6941).s;function s(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(35717)(s,i),s.prototype.update=function(t,e,n){"string"==typeof t&&(t=r.from(t,e));var i=this._update(t);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,n){var r;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){r=t}finally{n(r)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||r.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,n){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var r=this._decoder.write(t);return n&&(r+=this._decoder.end()),r},t.exports=s},76393:(t,e,n)=>{var r=n(48764).Buffer,i=n(86266),o=n(16426);t.exports=function(t){return new a(t)};var s={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}};function a(t){this.curveType=s[t],this.curveType||(this.curveType={name:t}),this.curve=new i.ec(this.curveType.name),this.keys=void 0}function u(t,e,n){Array.isArray(t)||(t=t.toArray());var i=new r(t);if(n&&i.length=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},23482:(t,e,n)=>{"use strict";var r=n(35717),i=n(62318),o=n(79785),s=n(89072),a=n(71027);function u(t){a.call(this,"digest"),this._hash=t}r(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},78028:(t,e,n)=>{var r=n(62318);t.exports=function(t){return(new r).update(t).digest()}},58355:(t,e,n)=>{"use strict";var r=n(35717),i=n(51031),o=n(71027),s=n(89509).Buffer,a=n(78028),u=n(79785),c=n(89072),d=s.alloc(128);function l(t,e){o.call(this,"digest"),"string"==typeof e&&(e=s.from(e));var n="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>n?e=("rmd160"===t?new u:c(t)).update(e).digest():e.length{"use strict";var r=n(35717),i=n(89509).Buffer,o=n(71027),s=i.alloc(128),a=64;function u(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length{"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=n(61798),e.createHash=e.Hash=n(23482),e.createHmac=e.Hmac=n(58355);var r=n(56042),i=Object.keys(r),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var s=n(25632);e.pbkdf2=s.pbkdf2,e.pbkdf2Sync=s.pbkdf2Sync;var a=n(53614);e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var u=n(62607);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var c=n(64743);e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=n(76393);var d=n(7900);e.publicEncrypt=d.publicEncrypt,e.privateEncrypt=d.privateEncrypt,e.publicDecrypt=d.publicDecrypt,e.privateDecrypt=d.privateDecrypt;var l=n(77963);e.randomFill=l.randomFill,e.randomFillSync=l.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.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}},93776:function(t,e,n){var r;!function(i){"use strict";var o,s,a,u=9e15,c=1e9,d="0123456789abcdef",l="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",h="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",f={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-u,maxE:u,crypto:!1},p=!0,m="[DecimalError] ",g=m+"Invalid argument: ",y=m+"Precision limit exceeded",b=m+"crypto unavailable",w="[object Decimal]",_=Math.floor,v=Math.pow,k=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,M=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,A=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,S=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,I=1e7,x=7,E=l.length-1,T=h.length-1,P={toStringTag:w};function B(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;en)throw Error(g+t)}function $(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=x,i=0):(i=Math.ceil((e+1)/x),e%=x),o=v(10,x-e),a=t[i]%o|0,null==r?e<3?(0==e?a=a/100|0:1==e&&(a=a/10|0),s=n<4&&99999==a||n>3&&49999==a||5e4==a||0==a):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(t[i+1]/o/100|0)==v(10,e-2)-1||(a==o/2||0==a)&&0==(t[i+1]/o/100|0):e<4?(0==e?a=a/1e3|0:1==e?a=a/100|0:2==e&&(a=a/10|0),s=(r||n<4)&&9999==a||!r&&n>3&&4999==a):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==v(10,e-3)-1,s}function R(t,e,n){for(var r,i,o=[0],s=0,a=t.length;sn-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}P.absoluteValue=P.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),D(t)},P.ceil=function(){return D(new this.constructor(this),this.e+1,2)},P.clampedTo=P.clamp=function(t,e){var n=this,r=n.constructor;if(t=new r(t),e=new r(e),!t.s||!e.s)return new r(NaN);if(t.gt(e))throw Error(g+e);return n.cmp(t)<0?t:n.cmp(e)>0?e:new r(n)},P.comparedTo=P.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,u=o.s,c=t.s;if(!s||!a)return u&&c?u!==c?u:s===a?0:!s^u<0?1:-1:NaN;if(!s[0]||!a[0])return s[0]?u:a[0]?-c:0;if(u!==c)return u;if(o.e!==t.e)return o.e>t.e^u<0?1:-1;for(e=0,n=(r=s.length)<(i=a.length)?r:i;ea[e]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1},P.cosine=P.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+x,r.rounding=1,n=function(t,e){var n,r,i;if(e.isZero())return e;(r=e.d.length)<32?i=(1/J(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=X(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}(r,Q(r,n)),r.precision=t,r.rounding=e,D(2==a||3==a?n.neg():n,t,e,!0)):new r(1):new r(NaN)},P.cubeRoot=P.cbrt=function(){var t,e,n,r,i,o,s,a,u,c,d=this,l=d.constructor;if(!d.isFinite()||d.isZero())return new l(d);for(p=!1,(o=d.s*v(d.s*d,1/3))&&Math.abs(o)!=1/0?r=new l(o.toString()):(n=B(d.d),(o=((t=d.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=v(n,1/3),t=_((t+1)/3)-(t%3==(t<0?-1:2)),(r=new l(n=o==1/0?"5e"+t:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+t)).s=d.s),s=(t=l.precision)+3;;)if(c=(u=(a=r).times(a).times(a)).plus(d),r=O(c.plus(d).times(a),c.plus(u),s+2,1),B(a.d).slice(0,s)===(n=B(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(D(r,t+1,1),e=!r.times(r).times(r).eq(d));break}if(!i&&(D(a,t+1,0),a.times(a).times(a).eq(d))){r=a;break}s+=4,i=1}return p=!0,D(r,t,l.rounding,e)},P.decimalPlaces=P.dp=function(){var t,e=this.d,n=NaN;if(e){if(n=((t=e.length-1)-_(this.e/x))*x,t=e[t])for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},P.dividedBy=P.div=function(t){return O(this,new this.constructor(t))},P.dividedToIntegerBy=P.divToInt=function(t){var e=this.constructor;return D(O(this,new e(t),0,1,1),e.precision,e.rounding)},P.equals=P.eq=function(t){return 0===this.cmp(t)},P.floor=function(){return D(new this.constructor(this),this.e+1,3)},P.greaterThan=P.gt=function(t){return this.cmp(t)>0},P.greaterThanOrEqualTo=P.gte=function(t){var e=this.cmp(t);return 1==e||0===e},P.hyperbolicCosine=P.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?e=(1/J(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),o=X(s,1,o.times(e),new s(1),!0);for(var u,c=t,d=new s(8);c--;)u=o.times(o),o=a.minus(u.times(d.minus(u.times(d))));return D(o,s.precision=n,s.rounding=r,!0)},P.hyperbolicSine=P.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=X(o,2,i,i,!0);else{t=(t=1.4*Math.sqrt(r))>16?16:0|t,i=X(o,2,i=i.times(1/J(5,t)),i,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=n,D(i,e,n,!0)},P.hyperbolicTangent=P.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,O(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},P.inverseCosine=P.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?e.isNeg()?U(n,i,o):new n(0):new n(NaN):e.isZero()?U(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=U(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))},P.inverseHyperbolicCosine=P.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,p=!1,n=n.times(n).minus(1).sqrt().plus(n),p=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)},P.inverseHyperbolicSine=P.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,p=!1,n=n.times(n).plus(1).sqrt().plus(n),p=!0,r.precision=t,r.rounding=e,n.ln())},P.inverseHyperbolicTangent=P.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?D(new o(i),t,e,!0):(o.precision=n=r-i.e,i=O(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)},P.inverseSine=P.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==e?0===e?((t=U(o,n+4,r).times(.5)).s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},P.inverseTangent=P.atan=function(){var t,e,n,r,i,o,s,a,u,c=this,d=c.constructor,l=d.precision,h=d.rounding;if(c.isFinite()){if(c.isZero())return new d(c);if(c.abs().eq(1)&&l+4<=T)return(s=U(d,l+4,h).times(.25)).s=c.s,s}else{if(!c.s)return new d(NaN);if(l+4<=T)return(s=U(d,l+4,h).times(.5)).s=c.s,s}for(d.precision=a=l+10,d.rounding=1,t=n=Math.min(28,a/x+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(p=!1,e=Math.ceil(a/x),r=1,u=c.times(c),s=new d(c),i=c;-1!==t;)if(i=i.times(u),o=s.minus(i.div(r+=2)),i=i.times(u),void 0!==(s=o.plus(i.div(r+=2))).d[e])for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<this.d.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isPositive=P.isPos=function(){return this.s>0},P.isZero=function(){return!!this.d&&0===this.d[0]},P.lessThan=P.lt=function(t){return this.cmp(t)<0},P.lessThanOrEqualTo=P.lte=function(t){return this.cmp(t)<1},P.logarithm=P.log=function(t){var e,n,r,i,o,s,a,u,c=this,d=c.constructor,l=d.precision,h=d.rounding;if(null==t)t=new d(10),e=!0;else{if(n=(t=new d(t)).d,t.s<0||!n||!n[0]||t.eq(1))return new d(NaN);e=t.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new d(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(p=!1,s=q(c,a=l+5),r=e?z(d,a+10):q(t,a),$((u=O(s,r,a,1)).d,i=l,h))do{if(s=q(c,a+=10),r=e?z(d,a+10):q(t,a),u=O(s,r,a,1),!o){+B(u.d).slice(i+1,i+15)+1==1e14&&(u=D(u,l+1,0));break}}while($(u.d,i+=10,h));return p=!0,D(u,l,h)},P.minus=P.sub=function(t){var e,n,r,i,o,s,a,u,c,d,l,h,f=this,m=f.constructor;if(t=new m(t),!f.d||!t.d)return f.s&&t.s?f.d?t.s=-t.s:t=new m(t.d||f.s!==t.s?f:NaN):t=new m(NaN),t;if(f.s!=t.s)return t.s=-t.s,f.plus(t);if(c=f.d,h=t.d,a=m.precision,u=m.rounding,!c[0]||!h[0]){if(h[0])t.s=-t.s;else{if(!c[0])return new m(3===u?-0:0);t=new m(f)}return p?D(t,a,u):t}if(n=_(t.e/x),d=_(f.e/x),c=c.slice(),o=d-n){for((l=o<0)?(e=c,o=-o,s=h.length):(e=h,n=d,s=c.length),o>(r=Math.max(Math.ceil(a/x),s)+2)&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for((l=(r=c.length)<(s=h.length))&&(s=r),r=0;r0;--r)c[s++]=0;for(r=h.length;r>o;){if(c[--r](s=(o=Math.ceil(a/x))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=c.length)-(i=d.length)<0&&(i=s,n=d,d=c,c=n),e=0;i;)e=(c[--i]=c[i]+d[i]+e)/I|0,c[i]%=I;for(e&&(c.unshift(e),++r),s=c.length;0==c[--s];)c.pop();return t.d=c,t.e=N(c,r),p?D(t,a,u):t},P.precision=P.sd=function(t){var e,n=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(g+t);return n.d?(e=j(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},P.round=function(){var t=this,e=t.constructor;return D(new e(t),t.e+1,e.rounding)},P.sine=P.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+x,r.rounding=1,n=function(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:X(t,2,e,e);n=(n=1.4*Math.sqrt(r))>16?16:0|n,e=X(t,2,e=e.times(1/J(5,n)),e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}(r,Q(r,n)),r.precision=t,r.rounding=e,D(a>2?n.neg():n,t,e,!0)):new r(NaN)},P.squareRoot=P.sqrt=function(){var t,e,n,r,i,o,s=this,a=s.d,u=s.e,c=s.s,d=s.constructor;if(1!==c||!a||!a[0])return new d(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);for(p=!1,0==(c=Math.sqrt(+s))||c==1/0?(((e=B(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=_((u+1)/2)-(u<0||u%2),r=new d(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new d(c.toString()),n=(u=d.precision)+3;;)if(r=(o=r).plus(O(s,o,n+2,1)).times(.5),B(o.d).slice(0,n)===(e=B(r.d)).slice(0,n)){if("9999"!=(e=e.slice(n-3,n+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(D(r,u+1,1),t=!r.times(r).eq(s));break}if(!i&&(D(o,u+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}return p=!0,D(r,u,d.rounding,t)},P.tangent=P.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,(n=n.sin()).s=1,n=O(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,D(2==a||4==a?n.neg():n,t,e,!0)):new r(NaN)},P.times=P.mul=function(t){var e,n,r,i,o,s,a,u,c,d=this,l=d.constructor,h=d.d,f=(t=new l(t)).d;if(t.s*=d.s,!(h&&h[0]&&f&&f[0]))return new l(!t.s||h&&!h[0]&&!f||f&&!f[0]&&!h?NaN:h&&f?0*t.s:t.s/0);for(n=_(d.e/x)+_(t.e/x),(u=h.length)<(c=f.length)&&(o=h,h=f,f=o,s=u,u=c,c=s),o=[],r=s=u+c;r--;)o.push(0);for(r=c;--r>=0;){for(e=0,i=u+r;i>r;)a=o[i]+f[r]*h[i-r-1]+e,o[i--]=a%I|0,e=a/I|0;o[i]=(o[i]+e)%I|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=N(o,n),p?D(t,l.precision,l.rounding):t},P.toBinary=function(t,e){return tt(this,2,t,e)},P.toDecimalPlaces=P.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),void 0===t?n:(L(t,0,c),void 0===e?e=r.rounding:L(e,0,8),D(n,t+n.e+1,e))},P.toExponential=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=C(r,!0):(L(t,0,c),void 0===e?e=i.rounding:L(e,0,8),n=C(r=D(new i(r),t+1,e),!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},P.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return void 0===t?n=C(i):(L(t,0,c),void 0===e?e=o.rounding:L(e,0,8),n=C(r=D(new o(i),t+i.e+1,e),!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},P.toFraction=function(t){var e,n,r,i,o,s,a,u,c,d,l,h,f=this,m=f.d,y=f.constructor;if(!m)return new y(f);if(c=n=new y(1),r=u=new y(0),s=(o=(e=new y(r)).e=j(m)-f.e-1)%x,e.d[0]=v(10,s<0?x+s:s),null==t)t=o>0?e:c;else{if(!(a=new y(t)).isInt()||a.lt(c))throw Error(g+a);t=a.gt(e)?o>0?e:c:a}for(p=!1,a=new y(B(m)),d=y.precision,y.precision=o=m.length*x*2;l=O(a,e,0,1,1),1!=(i=n.plus(l.times(r))).cmp(t);)n=r,r=i,i=c,c=u.plus(l.times(i)),u=i,i=e,e=a.minus(l.times(i)),a=i;return i=O(t.minus(n),r,0,1,1),u=u.plus(i.times(c)),n=n.plus(i.times(r)),u.s=c.s=f.s,h=O(c,r,o,1).minus(f).abs().cmp(O(u,n,o,1).minus(f).abs())<1?[c,r]:[u,n],y.precision=d,p=!0,h},P.toHexadecimal=P.toHex=function(t,e){return tt(this,16,t,e)},P.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),null==t){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),void 0===e?e=r.rounding:L(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(p=!1,n=O(n,t,0,e,1).times(t),p=!0,D(n)):(t.s=n.s,n=t),n},P.toNumber=function(){return+this},P.toOctal=function(t,e){return tt(this,8,t,e)},P.toPower=P.pow=function(t){var e,n,r,i,o,s,a=this,u=a.constructor,c=+(t=new u(t));if(!(a.d&&t.d&&a.d[0]&&t.d[0]))return new u(v(+a,c));if((a=new u(a)).eq(1))return a;if(r=u.precision,o=u.rounding,t.eq(1))return D(a,r,o);if((e=_(t.e/x))>=t.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=F(u,a,n,r),t.s<0?new u(1).div(i):D(i,r,o);if((s=a.s)<0){if(eu.maxE+1||e0?s/0:0):(p=!1,u.rounding=a.s=1,n=Math.min(12,(e+"").length),(i=K(t.times(q(a,r+n)),r)).d&&$((i=D(i,r+5,1)).d,r,o)&&(e=r+10,+B((i=D(K(t.times(q(a,e+n)),e),e+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=D(i,r+1,0))),i.s=s,p=!0,u.rounding=o,D(i,r,o))},P.toPrecision=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=C(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(L(t,1,c),void 0===e?e=i.rounding:L(e,0,8),n=C(r=D(new i(r),t,e),t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},P.toSignificantDigits=P.toSD=function(t,e){var n=this.constructor;return void 0===t?(t=n.precision,e=n.rounding):(L(t,1,c),void 0===e?e=n.rounding:L(e,0,8)),D(new n(this),t,e)},P.toString=function(){var t=this,e=t.constructor,n=C(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},P.truncated=P.trunc=function(){return D(new this.constructor(this),this.e+1,1)},P.valueOf=P.toJSON=function(){var t=this,e=t.constructor,n=C(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};var O=function(){function t(t,e,n){var r,i=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+i,t[o]=r%n|0,i=r/n|0;return i&&t.unshift(i),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;)t.shift()}return function(r,i,o,a,u,c){var d,l,h,f,p,m,g,y,b,w,v,k,M,A,S,E,T,P,B,L,$=r.constructor,R=r.s==i.s?1:-1,O=r.d,C=i.d;if(!(O&&O[0]&&C&&C[0]))return new $(r.s&&i.s&&(O?!C||O[0]!=C[0]:C)?O&&0==O[0]||!C?0*R:R/0:NaN);for(c?(p=1,l=r.e-i.e):(c=I,p=x,l=_(r.e/p)-_(i.e/p)),B=C.length,T=O.length,w=(b=new $(R)).d=[],h=0;C[h]==(O[h]||0);h++);if(C[h]>(O[h]||0)&&l--,null==o?(A=o=$.precision,a=$.rounding):A=u?o+(r.e-i.e)+1:o,A<0)w.push(1),m=!0;else{if(A=A/p+2|0,h=0,1==B){for(f=0,C=C[0],A++;(h1&&(C=t(C,f,c),O=t(O,f,c),B=C.length,T=O.length),E=B,k=(v=O.slice(0,B)).length;k=c/2&&++P;do{f=0,(d=e(C,v,B,k))<0?(M=v[0],B!=k&&(M=M*c+(v[1]||0)),(f=M/P|0)>1?(f>=c&&(f=c-1),1==(d=e(g=t(C,f,c),v,y=g.length,k=v.length))&&(f--,n(g,B=10;f/=10)h++;b.e=h+l*p-1,D(b,u?o+b.e+1:o,a,m)}return b}}();function D(t,e,n,r){var i,o,s,a,u,c,d,l,h,f=t.constructor;t:if(null!=e){if(!(l=t.d))return t;for(i=1,a=l[0];a>=10;a/=10)i++;if((o=e-i)<0)o+=x,s=e,u=(d=l[h=0])/v(10,i-s-1)%10|0;else if((h=Math.ceil((o+1)/x))>=(a=l.length)){if(!r)break t;for(;a++<=h;)l.push(0);d=u=0,i=1,s=(o%=x)-x+1}else{for(d=a=l[h],i=1;a>=10;a/=10)i++;u=(s=(o%=x)-x+i)<0?0:d/v(10,i-s-1)%10|0}if(r=r||e<0||void 0!==l[h+1]||(s<0?d:d%v(10,i-s-1)),c=n<4?(u||r)&&(0==n||n==(t.s<0?3:2)):u>5||5==u&&(4==n||r||6==n&&(o>0?s>0?d/v(10,i-s):0:l[h-1])%10&1||n==(t.s<0?8:7)),e<1||!l[0])return l.length=0,c?(e-=t.e+1,l[0]=v(10,(x-e%x)%x),t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=h,a=1,h--):(l.length=h+1,a=v(10,x-o),l[h]=s>0?(d/v(10,i-s)%v(10,s)|0)*a:0),c)for(;;){if(0==h){for(o=1,s=l[0];s>=10;s/=10)o++;for(s=l[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,l[0]==I&&(l[0]=1));break}if(l[h]+=a,l[h]!=I)break;l[h--]=0,a=1}for(o=l.length;0===l[--o];)l.pop()}return p&&(t.e>f.maxE?(t.d=null,t.e=NaN):t.e0?o=o.charAt(0)+"."+o.slice(1)+Y(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+Y(-i-1)+o,n&&(r=n-s)>0&&(o+=Y(r))):i>=s?(o+=Y(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+Y(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=Y(r))),o}function N(t,e){var n=t[0];for(e*=x;n>=10;n/=10)e++;return e}function z(t,e,n){if(e>E)throw p=!0,n&&(t.precision=n),Error(y);return D(new t(l),e,1,!0)}function U(t,e,n){if(e>T)throw Error(y);return D(new t(h),e,n,!0)}function j(t){var e=t.length-1,n=e*x+1;if(e=t[e]){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function Y(t){for(var e="";t--;)e+="0";return e}function F(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/x+4);for(p=!1;;){if(n%2&&et((o=o.times(e)).d,s)&&(i=!0),0===(n=_(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}et((e=e.times(e)).d,s)}return p=!0,o}function W(t){return 1&t.d[t.d.length-1]}function H(t,e,n){for(var r,i=new t(e[0]),o=0;++o17)return new h(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(p=!1,u=m):u=e,a=new h(.03125);t.e>-2;)t=t.times(a),l+=5;for(u+=r=Math.log(v(2,l))/Math.LN10*2+5|0,n=o=s=new h(1),h.precision=u;;){if(o=D(o.times(t),u,1),n=n.times(++d),B((a=s.plus(O(o,n,u,1))).d).slice(0,u)===B(s.d).slice(0,u)){for(i=l;i--;)s=D(s.times(s),u,1);if(null!=e)return h.precision=m,s;if(!(c<3&&$(s.d,u-r,f,c)))return D(s,h.precision=m,f,p=!0);h.precision=u+=10,n=o=a=new h(1),d=0,c++}s=a}}function q(t,e){var n,r,i,o,s,a,u,c,d,l,h,f=1,m=t,g=m.d,y=m.constructor,b=y.rounding,w=y.precision;if(m.s<0||!g||!g[0]||!m.e&&1==g[0]&&1==g.length)return new y(g&&!g[0]?-1/0:1!=m.s?NaN:g?0:m);if(null==e?(p=!1,d=w):d=e,y.precision=d+=10,r=(n=B(g)).charAt(0),!(Math.abs(o=m.e)<15e14))return c=z(y,d+2,w).times(o+""),m=q(new y(r+"."+n.slice(1)),d-10).plus(c),y.precision=w,null==e?D(m,w,b,p=!0):m;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=B((m=m.times(t)).d)).charAt(0),f++;for(o=m.e,r>1?(m=new y("0."+n),o++):m=new y(r+"."+n.slice(1)),l=m,u=s=m=O(m.minus(1),m.plus(1),d,1),h=D(m.times(m),d,1),i=3;;){if(s=D(s.times(h),d,1),B((c=u.plus(O(s,new y(i),d,1))).d).slice(0,d)===B(u.d).slice(0,d)){if(u=u.times(2),0!==o&&(u=u.plus(z(y,d+2,w).times(o+""))),u=O(u,new y(f),d,1),null!=e)return y.precision=w,u;if(!$(u.d,d-10,b,a))return D(u,y.precision=w,b,p=!0);y.precision=d+=10,c=s=m=O(l.minus(1),l.plus(1),d,1),h=D(m.times(m),d,1),i=a=1}u=c,i+=2}}function V(t){return String(t.s*t.s/0)}function G(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;48===e.charCodeAt(r);r++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(r,i)){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%x,n<0&&(r+=x),rt.constructor.maxE?(t.d=null,t.e=NaN):t.e-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),S.test(e))return G(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(M.test(e))n=16,e=e.toLowerCase();else if(k.test(e))n=2;else{if(!A.test(e))throw Error(g+e);n=8}for((s=e.search(/p/i))>0?(c=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),a=(s=e.indexOf("."))>=0,r=t.constructor,a&&(s=(u=(e=e.replace(".","")).length)-s,i=F(r,new r(n),s,2*s)),s=l=(d=R(e,n,I)).length-1;0===d[s];--s)d.pop();return s<0?new r(0*t.s):(t.e=N(d,l),t.d=d,p=!1,a&&(t=O(t,i,4*u)),c&&(t=t.times(Math.abs(c)<54?v(2,c):o.pow(2,c))),p=!0,t)}function X(t,e,n,r,i){var o,s,a,u,c=t.precision,d=Math.ceil(c/x);for(p=!1,u=n.times(n),a=new t(r);;){if(s=O(a.times(u),new t(e++*e++),c,1),a=i?r.plus(s):r.minus(s),r=O(s.times(u),new t(e++*e++),c,1),void 0!==(s=a.plus(r)).d[d]){for(o=d;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=r,r=s,s=o}return p=!0,s.d.length=d+1,s}function J(t,e){for(var n=t;--e;)n*=t;return n}function Q(t,e){var n,r=e.s<0,i=U(t,t.precision,1),o=i.times(.5);if((e=e.abs()).lte(o))return a=r?4:1,e;if((n=e.divToInt(i)).isZero())a=r?3:2;else{if((e=e.minus(n.times(i))).lte(o))return a=W(n)?r?2:3:r?4:1,e;a=W(n)?r?1:4:r?3:2}return e.minus(i).abs()}function tt(t,e,n,r){var i,o,a,u,l,h,f,p,m,g=t.constructor,y=void 0!==n;if(y?(L(n,1,c),void 0===r?r=g.rounding:L(r,0,8)):(n=g.precision,r=g.rounding),t.isFinite()){for(y?(i=2,16==e?n=4*n-3:8==e&&(n=3*n-2)):i=e,(a=(f=C(t)).indexOf("."))>=0&&(f=f.replace(".",""),(m=new g(1)).e=f.length-a,m.d=R(C(m),10,i),m.e=m.d.length),o=l=(p=R(f,10,i)).length;0==p[--l];)p.pop();if(p[0]){if(a<0?o--:((t=new g(t)).d=p,t.e=o,p=(t=O(t,m,n,r,0,i)).d,o=t.e,h=s),a=p[n],u=i/2,h=h||void 0!==p[n+1],h=r<4?(void 0!==a||h)&&(0===r||r===(t.s<0?3:2)):a>u||a===u&&(4===r||h||6===r&&1&p[n-1]||r===(t.s<0?8:7)),p.length=n,h)for(;++p[--n]>i-1;)p[n]=0,n||(++o,p.unshift(1));for(l=p.length;!p[l-1];--l);for(a=0,f="";a1)if(16==e||8==e){for(a=16==e?4:3,--l;l%a;l++)f+="0";for(l=(p=R(f,i,e)).length;!p[l-1];--l);for(a=1,f="1.";al)for(o-=l;o--;)f+="0";else oe)return t.length=e,!0}function nt(t){return new this(t).abs()}function rt(t){return new this(t).acos()}function it(t){return new this(t).acosh()}function ot(t,e){return new this(t).plus(e)}function st(t){return new this(t).asin()}function at(t){return new this(t).asinh()}function ut(t){return new this(t).atan()}function ct(t){return new this(t).atanh()}function dt(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(n=e.s<0?U(this,r,i):new this(0)).s=t.s:!t.d||e.isZero()?(n=U(this,o,1).times(.5)).s=t.s:e.s<0?(this.precision=o,this.rounding=1,n=this.atan(O(t,e,o,1)),e=U(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(O(t,e,o,1)):(n=U(this,o,1).times(e.s>0?.25:.75)).s=t.s:n=new this(NaN),n}function lt(t){return new this(t).cbrt()}function ht(t){return D(t=new this(t),t.e+1,2)}function ft(t,e,n){return new this(t).clamp(e,n)}function pt(t){if(!t||"object"!=typeof t)throw Error(m+"Object expected");var e,n,r,i=!0===t.defaults,o=["precision",1,c,"rounding",0,8,"toExpNeg",-u,0,"toExpPos",0,u,"maxE",0,u,"minE",-u,0,"modulo",0,9];for(e=0;e=o[e+1]&&r<=o[e+2]))throw Error(g+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=f[n]),void 0!==(r=t[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(g+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(b);this[n]=!0}else this[n]=!1}return this}function mt(t){return new this(t).cos()}function gt(t){return new this(t).cosh()}function yt(t,e){return new this(t).div(e)}function bt(t){return new this(t).exp()}function wt(t){return D(t=new this(t),t.e+1,3)}function _t(){var t,e,n=new this(0);for(p=!1,t=0;t=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(b);for(e=crypto.randomBytes(r*=4);o=214e7?crypto.randomBytes(4).copy(e,o):(a.push(i%1e7),o+=4);o=r/4}else for(;o=10;i/=10)r++;ro.maxE?(i.e=NaN,i.d=null):t.e=10;n/=10)e++;return void(p?e>o.maxE?(i.e=NaN,i.d=null):e{"use strict";e.utils=n(11278),e.Cipher=n(55756),e.DES=n(70778),e.CBC=n(39051),e.EDE=n(50651)},39051:(t,e,n)=>{"use strict";var r=n(79746),i=n(35717),o={};function s(t){r.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e{"use strict";var r=n(79746);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==t.padding}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var n=Math.min(this.buffer.length-this.bufferOff,t.length-e),r=0;r0;r--)e+=this._buffer(t,e),n+=this._flushBuffer(i,n);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,n;return t&&(e=this.update(t)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(n):n},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e{"use strict";var r=n(79746),i=n(35717),o=n(11278),s=n(55756);function a(){this.tmp=new Array(2),this.keys=null}function u(t){s.call(this,t);var e=new a;this._desState=e,this.deriveKeys(e,t.key)}i(u,s),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),r.equal(e.length,this.blockSize,"Invalid key length");var n=o.readUInt32BE(e,0),i=o.readUInt32BE(e,4);o.pc1(n,i,t.tmp,0),n=t.tmp[0],i=t.tmp[1];for(var s=0;s>>1];n=o.r28shl(n,a),i=o.r28shl(i,a),o.pc2(n,i,t.keys,s)}},u.prototype._update=function(t,e,n,r){var i=this._desState,s=o.readUInt32BE(t,e),a=o.readUInt32BE(t,e+4);o.ip(s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,s,a,i.tmp,0):this._decrypt(i,s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],o.writeUInt32BE(n,s,r),o.writeUInt32BE(n,a,r+4)},u.prototype._pad=function(t,e){if(!1===this.padding)return!1;for(var n=t.length-e,r=e;r>>0,s=h}o.rip(a,s,r,i)},u.prototype._decrypt=function(t,e,n,r,i){for(var s=n,a=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],d=t.keys[u+1];o.expand(s,t.tmp,0),c^=t.tmp[0],d^=t.tmp[1];var l=o.substitute(c,d),h=s;s=(a^o.permute(l))>>>0,a=h}o.rip(s,a,r,i)}},50651:(t,e,n)=>{"use strict";var r=n(79746),i=n(35717),o=n(55756),s=n(70778);function a(t,e){r.equal(e.length,24,"Invalid key length");var n=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:o})]:[s.create({type:"decrypt",key:o}),s.create({type:"encrypt",key:i}),s.create({type:"decrypt",key:n})]}function u(t){o.call(this,t);var e=new a(this.type,this.options.key);this._edeState=e}i(u,o),t.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,n,r){var i=this._edeState;i.ciphers[0]._update(t,e,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},u.prototype._pad=s.prototype._pad,u.prototype._unpad=s.prototype._unpad},11278:(t,e)=>{"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,n){t[0+n]=e>>>24,t[1+n]=e>>>16&255,t[2+n]=e>>>8&255,t[3+n]=255&e},e.ip=function(t,e,n,r){for(var i=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1}n[r+0]=i>>>0,n[r+1]=o>>>0},e.rip=function(t,e,n,r){for(var i=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+s&1,i<<=1,i|=t>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=e>>>a+s&1,o<<=1,o|=t>>>a+s&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.pc1=function(t,e,n,r){for(var i=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1}for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.r28shl=function(t,e){return t<>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,r,i){for(var o=0,s=0,a=n.length>>>1,u=0;u>>n[u]&1;for(u=a;u>>n[u]&1;r[i+0]=o>>>0,r[i+1]=s>>>0},e.expand=function(t,e,n){var r=0,i=0;r=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[n+0]=r>>>0,e[n+1]=i>>>0};var r=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var n=0,i=0;i<4;i++)n<<=4,n|=r[64*i+(t>>>18-6*i&63)];for(i=0;i<4;i++)n<<=4,n|=r[256+64*i+(e>>>18-6*i&63)];return n>>>0};var i=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,n=0;n>>i[n]&1;return e>>>0},e.padSplit=function(t,e,n){for(var r=t.toString(2);r.length{var r=n(48764).Buffer,i=n(43590),o=n(29799),s=n(57426),a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(t){var e=new r(o[t].prime,"hex"),n=new r(o[t].gen,"hex");return new s(e,n)},e.createDiffieHellman=e.DiffieHellman=function t(e,n,o,u){return r.isBuffer(n)||void 0===a[n]?t(e,"binary",n,o):(n=n||"binary",u=u||"binary",o=o||new r([2]),r.isBuffer(o)||(o=new r(o,u)),"number"==typeof e?new s(i(e,o),o,!0):(r.isBuffer(e)||(e=new r(e,n)),new s(e,o,!0)))}},57426:(t,e,n)=>{var r=n(48764).Buffer,i=n(83620),o=new(n(63047)),s=new i(24),a=new i(11),u=new i(10),c=new i(3),d=new i(7),l=n(43590),h=n(61798);function f(t,e){return e=e||"utf8",r.isBuffer(t)||(t=new r(t,e)),this._pub=new i(t),this}function p(t,e){return e=e||"utf8",r.isBuffer(t)||(t=new r(t,e)),this._priv=new i(t),this}t.exports=g;var m={};function g(t,e,n){this.setGenerator(e),this.__prime=new i(t),this._prime=i.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=f,this.setPrivateKey=p):this._primeCode=8}function y(t,e){var n=new r(t.toArray());return e?n.toString(e):n}Object.defineProperty(g.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var n=e.toString("hex"),r=[n,t.toString(16)].join("_");if(r in m)return m[r];var i,h=0;if(t.isEven()||!l.simpleSieve||!l.fermatTest(t)||!o.test(t))return h+=1,h+="02"===n||"05"===n?8:4,m[r]=h,h;switch(o.test(t.shrn(1))||(h+=2),n){case"02":t.mod(s).cmp(a)&&(h+=8);break;case"05":(i=t.mod(u)).cmp(c)&&i.cmp(d)&&(h+=8);break;default:h+=4}return m[r]=h,h}(this.__prime,this.__gen)),this._primeCode}}),g.prototype.generateKeys=function(){return this._priv||(this._priv=new i(h(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},g.prototype.computeSecret=function(t){var e=(t=(t=new i(t)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new r(e.toArray()),o=this.getPrime();if(n.length{var r=n(61798);t.exports=b,b.simpleSieve=g,b.fermatTest=y;var i=n(83620),o=new i(24),s=new(n(63047)),a=new i(1),u=new i(2),c=new i(5),d=(new i(16),new i(8),new i(10)),l=new i(3),h=(new i(7),new i(11)),f=new i(4),p=(new i(12),null);function m(){if(null!==p)return p;var t=[];t[0]=2;for(var e=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),i=0;it;)n.ishrn(1);if(n.isEven()&&n.iadd(a),n.testn(1)||n.iadd(u),e.cmp(u)){if(!e.cmp(c))for(;n.mod(d).cmp(l);)n.iadd(f)}else for(;n.mod(o).cmp(h);)n.iadd(f);if(g(p=n.shrn(1))&&g(n)&&y(p)&&y(n)&&s.test(p)&&s.test(n))return n}}},83620:function(t,e,n){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(7748).Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},86266:(t,e,n)=>{"use strict";var r=e;r.version=n(18597).i8,r.utils=n(80953),r.rand=n(29931),r.curve=n(88254),r.curves=n(45427),r.ec=n(57954),r.eddsa=n(65980)},4918:(t,e,n)=>{"use strict";var r=n(73785),i=n(80953),o=i.getNAF,s=i.getJSF,a=i.assert;function u(t,e){this.type=t,this.p=new r(e.p,16),this.red=e.prime?r.red(e.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=e.n&&new r(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var n=t._getDoubles(),r=o(e,1,this._bitLength),i=(1<=s;d--)u=(u<<1)+r[d];c.push(u)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=i;f>0;f--){for(s=0;s=0;c--){for(var d=0;c>=0&&0===s[c];c--)d++;if(c>=0&&d++,u=u.dblp(d),c<0)break;var l=s[c];a(0!==l),u="affine"===t.type?l>0?u.mixedAdd(i[l-1>>1]):u.mixedAdd(i[-l-1>>1].neg()):l>0?u.add(i[l-1>>1]):u.add(i[-l-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,n,r,i){var a,u,c,d=this._wnafT1,l=this._wnafT2,h=this._wnafT3,f=0;for(a=0;a=1;a-=2){var m=a-1,g=a;if(1===d[m]&&1===d[g]){var y=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(y[1]=e[m].add(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].add(e[g].neg())):(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],w=s(n[m],n[g]);for(f=Math.max(w[0].length,f),h[m]=new Array(f),h[g]=new Array(f),u=0;u=0;a--){for(var A=0;a>=0;){var S=!0;for(u=0;u=0&&A++,k=k.dblp(A),a<0)break;for(u=0;u0?c=l[u][I-1>>1]:I<0&&(c=l[u][-I-1>>1].neg()),k="affine"===c.type?k.mixedAdd(c):k.add(c))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i{"use strict";var r=n(80953),i=n(73785),o=n(35717),s=n(4918),a=r.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function c(t,e,n,r,o){s.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(n,16),this.z=r?new i(r,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,s),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),s=r.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),s=r.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},o(c,s.BasePoint),u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},u.prototype.point=function(t,e,n,r){return new c(this,t,e,n,r)},c.fromJSON=function(t,e){return new c(t,e[0],e[1],e[2])},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),s=o.redSub(n),a=r.redSub(e),u=i.redMul(s),c=o.redMul(a),d=i.redMul(a),l=s.redMul(o);return this.curve.point(u,c,l,d)},c.prototype._projDbl=function(){var t,e,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(r=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(r.redSub(u)),n=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=s.redSub(a).redISub(u).redMul(o),e=c.redMul(r.redSub(u)),n=c.redMul(o))}else r=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(r)).redMul(o),e=this.curve._mulC(r).redMul(a.redISub(u)),n=r.redMul(o);return this.curve.point(t,e,n)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),s=i.redSub(r),a=i.redAdd(r),u=n.redAdd(e),c=o.redMul(s),d=a.redMul(u),l=o.redMul(u),h=s.redMul(a);return this.curve.point(c,d,h,l)},c.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),c=i.redAdd(a),d=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),l=r.redMul(u).redMul(d);return this.curve.twisted?(e=r.redMul(c).redMul(s.redSub(this.curve._mulA(o))),n=u.redMul(c)):(e=r.redMul(c).redMul(s.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(l,e,n)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},c.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},88254:(t,e,n)=>{"use strict";var r=e;r.base=n(4918),r.short=n(6673),r.mont=n(22881),r.edwards=n(31138)},22881:(t,e,n)=>{"use strict";var r=n(73785),i=n(35717),o=n(4918),s=n(80953);function a(t){o.call(this,"mont",t),this.a=new r(t.a,16).toRed(this.red),this.b=new r(t.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,n){o.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(e,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},i(u,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),s=i.redMul(r),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},6673:(t,e,n)=>{"use strict";var r=n(80953),i=n(73785),o=n(35717),s=n(4918),a=r.assert;function u(t){s.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,n,r){s.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function d(t,e,n,r){s.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,s),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);e=(e=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(t.lambda)n=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:n,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(n)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),n=new i(2).toRed(e).redInvm(),r=n.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,n,r,o,s,a,u,c,d,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=t,f=this.n.clone(),p=new i(1),m=new i(0),g=new i(0),y=new i(1),b=0;0!==h.cmpn(0);){var w=f.div(h);c=f.sub(w.mul(h)),d=g.sub(w.mul(p));var _=y.sub(w.mul(m));if(!r&&c.cmp(l)<0)e=u.neg(),n=p,r=c.neg(),o=d;else if(r&&2==++b)break;u=c,f=h,h=c,g=p,p=d,y=m,m=_}s=c.neg(),a=d;var v=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(v)>=0&&(s=e,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(s).sub(a),k2:u.add(c).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(e&&!o||!e&&o)&&(r=r.redNeg()),this.point(t,r)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},c.prototype.isInfinity=function(){return this.inf},c.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(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},c.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},c.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(d,s.BasePoint),u.prototype.jpoint=function(t,e,n){return new d(this,t,e,n)},d.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},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 e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(n.redMul(this.z)),a=r.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),l=r.redMul(c),h=u.redSqr().redIAdd(d).redISub(l).redISub(l),f=u.redMul(l.redISub(h)).redISub(o.redMul(d)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(h,f,p)},d.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),d=n.redMul(u),l=a.redSqr().redIAdd(c).redISub(d).redISub(d),h=a.redMul(d.redISub(l)).redISub(i.redMul(c)),f=this.z.redMul(s);return this.curve.jpoint(l,h,f)},d.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},d.prototype.inspect=function(){return this.isInfinity()?"":""},d.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},45427:(t,e,n)=>{"use strict";var r,i=e,o=n(33715),s=n(88254),a=n(80953).assert;function u(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var n=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=u,c("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("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:o.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"]}),c("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:o.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"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(91037)}catch(t){r=void 0}c("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},57954:(t,e,n)=>{"use strict";var r=n(73785),i=n(2156),o=n(80953),s=n(45427),a=n(29931),u=o.assert,c=n(31251),d=n(90611);function l(t){if(!(this instanceof l))return new l(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=l,l.prototype.keyPair=function(t){return new c(this,t)},l.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},l.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},l.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(e.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},l.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,n,o){"object"==typeof n&&(o=n,n=null),o||(o={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new r(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),u=t.toArray("be",s),c=new i({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new r(1)),h=0;;h++){var f=o.k?o.k(h):new r(c.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(l)>=0)){var p=this.g.mul(f);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var y=f.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new d({r:g,s:y,recoveryParam:b})}}}}}},l.prototype.verify=function(t,e,n,i){t=this._truncateToN(new r(t,16)),n=this.keyFromPublic(n,i);var o=(e=new d(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),c=u.mul(t).umod(this.n),l=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,n.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,n.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(t,e,n,i){u((3&n)===n,"The recovery param is more than two bits"),e=new d(e,i);var o=this.n,s=new r(t),a=e.r,c=e.s,l=1&n,h=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var f=e.r.invm(o),p=o.sub(s).mul(f).umod(o),m=c.mul(f).umod(o);return this.g.mulAdd(p,a,m)},l.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new d(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},31251:(t,e,n)=>{"use strict";var r=n(73785),i=n(80953).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,n){return e instanceof o?e:new o(t,{pub:e,pubEnc:n})},o.fromPrivate=function(t,e,n){return e instanceof o?e:new o(t,{priv:e,privEnc:n})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new r(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},90611:(t,e,n)=>{"use strict";var r=n(73785),i=n(80953),o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new r(t.r,16),this.s=new r(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function c(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var n=new a;if(48!==t[n.place++])return!1;var o=u(t,n);if(!1===o)return!1;if(o+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var s=u(t,n);if(!1===s)return!1;var c=t.slice(n.place,s+n.place);if(n.place+=s,2!==t[n.place++])return!1;var d=u(t,n);if(!1===d)return!1;if(t.length!==d+n.place)return!1;var l=t.slice(n.place,d+n.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new r(c),this.s=new r(l),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=c(e),n=c(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];d(r,e.length),(r=r.concat(e)).push(2),d(r,n.length);var o=r.concat(n),s=[48];return d(s,o.length),s=s.concat(o),i.encode(s,t)}},65980:(t,e,n)=>{"use strict";var r=n(33715),i=n(45427),o=n(80953),s=o.assert,a=o.parseBytes,u=n(79087),c=n(23622);function d(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof d))return new d(t);t=i[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=r.sha512}t.exports=d,d.prototype.sign=function(t,e){t=a(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),u=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},d.prototype.verify=function(t,e,n){t=a(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},d.prototype.hashInt=function(){for(var t=this.hash(),e=0;e{"use strict";var r=n(80953),i=r.assert,o=r.parseBytes,s=r.cachedProperty;function a(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),r.encode(this.secret(),t)},a.prototype.getPublic=function(t){return r.encode(this.pubBytes(),t)},t.exports=a},23622:(t,e,n)=>{"use strict";var r=n(73785),i=n(80953),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof r&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},91037:t=>{t.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"]]}}},80953:(t,e,n)=>{"use strict";var r=e,i=n(73785),o=n(79746),s=n(34504);r.assert=o,r.toArray=s.toArray,r.zero2=s.zero2,r.toHex=s.toHex,r.encode=s.encode,r.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,r[s]=a,o.iushrn(1)}return r},r.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),s=0==(1&u)?0:3!=(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(s),a=0==(1&c)?0:3!=(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},r.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new i(t,"hex","le")}},73785:function(t,e,n){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(85568).Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},26729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],a]:t._events[u].push(a):(t._events[u]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i{"use strict";var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var i,o,s,c;if(a(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=t,d.type=e,d.count=s.length,c=d,console&&console.warn&&console.warn(c)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function h(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var c=u.length,d=p(u,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return h(this,t,!0)},o.prototype.rawListeners=function(t){return h(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},13048:(t,e,n)=>{var r=n(89509).Buffer,i=n(62318);t.exports=function(t,e,n,o){if(r.isBuffer(t)||(t=r.from(t,"binary")),e&&(r.isBuffer(e)||(e=r.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=n/8,a=r.alloc(s),u=r.alloc(o||0),c=r.alloc(0);s>0||o>0;){var d=new i;d.update(c),d.update(t),e&&d.update(e),c=d.digest();var l=0;if(s>0){var h=a.length-s;l=Math.min(s,c.length),c.copy(a,h,0,l),s-=l}if(l0){var f=u.length-o,p=Math.min(o,c.length-l);c.copy(u,f,l,l+p),o-=p}}return c.fill(0),{key:a,iv:u}}},3349:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=n(70326).Transform;function o(t){i.call(this),this._block=r.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(35717)(o,i),o.prototype._transform=function(t,e,n){var r=null;try{this.update(t,e)}catch(t){r=t}n(r)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=r.from(t,e));for(var n=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},9786:t=>{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,4)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-9,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var c=("number"!=typeof u&&(u=0),u+1>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(r(e,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},62910:(t,e,n)=>{"use strict";var r=n(34155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=d;var o=n(45789),s=n(70469);n(35717)(d,o);for(var a=i(s.prototype),u=0;u{"use strict";t.exports=i;var r=n(70421);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(35717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},45789:(t,e,n)=>{"use strict";var r,i=n(34155);t.exports=S,S.ReadableState=A,n(17187).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=n(50677),u=n(48764).Buffer,c=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=n(31616);o=d&&d.debuglog?d.debuglog("stream"):function(){};var l,h,f,p=n(98354),m=n(35072),g=n(31222).getHighWaterMark,y=n(9786).q,b=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(35717)(S,a);var k=m.errorOrDestroy,M=["error","close","destroy","pause","resume"];function A(t,e,i){r=r||n(62910),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(33893).s),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function S(t){if(r=r||n(62910),!(this instanceof S))return new S(t);var e=this instanceof r;this._readableState=new A(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function I(t,e,n,r,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(i||(s=function(t,e){var n,r;return r=e,u.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],e)),n}(a,e)),s)k(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r)a.endEmitted?k(t,new v):x(t,a,e,!0);else if(a.ended)k(t,new w);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):L(t,a)):x(t,a,e,!1)}else r||(a.reading=!1,L(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function P(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(B,t))}function B(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function L(t,e){e.readingMore||(e.readingMore=!0,i.nextTick($,t,e))}function $(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function z(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function j(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?z(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&z(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&z(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(t){k(this,new _("_read()"))},S.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?m:u;function u(){o("onend"),t.end()}r.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",f),t.removeListener("finish",p),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",e),n.removeListener("end",u),n.removeListener("end",m),n.removeListener("data",l),d=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(n);t.on("drain",c);var d=!1;function l(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==j(r.pipes,t))&&!d&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function h(e){o("onerror",e),m(),t.removeListener("error",h),0===s(t,"error")&&k(t,e)}function f(){t.removeListener("finish",p),m()}function p(){o("onfinish"),t.removeListener("close",f),m()}function m(){o("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",h),t.once("close",f),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?P(this):r.reading||i.nextTick(O,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(R,this),n},S.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(R,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(D,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s{"use strict";t.exports=d;var r=n(9786).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(62910);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var r,i=n(34155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=S,S.WritableState=A;var s,a={deprecate:n(94927)},u=n(50677),c=n(48764).Buffer,d=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=n(35072),h=n(31222).getHighWaterMark,f=n(9786).q,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,w=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,v=f.ERR_UNKNOWN_ENCODING,k=l.errorOrDestroy;function M(){}function A(t,e,s){r=r||n(62910),t=t||{},"boolean"!=typeof s&&(s=e instanceof r),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(B,t,e),t._writableState.errorEmitted=!0,k(t,r)):(o(r),t._writableState.errorEmitted=!0,k(t,r),B(t,e))}(t,n,r,e,o);else{var s=T(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(t,n),r?i.nextTick(x,t,n,s,o):x(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function S(t){var e=this instanceof(r=r||n(62910));if(!e&&!s.call(S,this))return new S(t);this._writableState=new A(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function I(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function x(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),B(t,e)}function E(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,I(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,d=n.encoding,l=n.callback;if(I(t,e,!1,e.objectMode?1:c.length,c,d,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(n){e.pendingcb--,n&&k(t,n),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var n=T(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(35717)(S,u),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===S&&t&&t._writableState instanceof A}})):s=function(t){return t instanceof this},S.prototype.pipe=function(){k(this,new y)},S.prototype.write=function(t,e,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=t,c.isBuffer(r)||r instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=M),o.ending?function(t,e){var n=new _;k(t,n),i.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o;return null===n?o=new w:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(k(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,n){n(new m("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,B(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(t,e){e(t)}},30527:(t,e,n)=>{"use strict";var r,i=n(34155);function o(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=n(28640),a=Symbol("lastResolve"),u=Symbol("lastReject"),c=Symbol("error"),d=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(t,e){return{value:t,done:e}}function m(t){var e=t[a];if(null!==e){var n=t[f].read();null!==n&&(t[l]=null,t[a]=null,t[u]=null,e(p(n,!1)))}}function g(t){i.nextTick(m,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(r={get stream(){return this[f]},next:function(){var t=this,e=this[c];if(null!==e)return Promise.reject(e);if(this[d])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[c]?n(t[c]):e(p(void 0,!0))}))}));var n,r=this[l];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[d]?n(p(void 0,!0)):e[h](n,r)}),r)}}(r,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),y);t.exports=function(t){var e,n=Object.create(b,(o(e={},f,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,c,{value:null,writable:!0}),o(e,d,{value:t._readableState.endEmitted,writable:!0}),o(e,h,{value:function(t,e){var r=n[f].read();r?(n[l]=null,n[a]=null,n[u]=null,t(p(r,!1))):(n[a]=t,n[u]=e)},writable:!0}),e));return n[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[u];return null!==e&&(n[l]=null,n[a]=null,n[u]=null,e(t)),void(n[c]=t)}var r=n[a];null!==r&&(n[l]=null,n[a]=null,n[u]=null,r(p(void 0,!0))),n[d]=!0})),t.on("readable",g.bind(null,n)),n}},98354:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return u.alloc(0);for(var e,n,r,i=u.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,u.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=u.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:d,value:function(t,e){return c(this,i(i({},e),{},{depth:0,customInspect:!1}))}}])&&s(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},35072:(t,e,n)=>{"use strict";var r=n(34155);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(s,this,t)):r.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},28640:(t,e,n)=>{"use strict";var r=n(9786).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},64218:(t,e,n)=>{"use strict";var r,i=n(9786).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t){t()}function c(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),i=0;i0,(function(t){d||(d=t),t&&h.forEach(u),o||(h.forEach(u),l(d))}))}));return e.reduce(c)}},31222:(t,e,n)=>{"use strict";var r=n(9786).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},50677:(t,e,n)=>{t.exports=n(17187).EventEmitter},70326:(t,e,n)=>{(e=t.exports=n(45789)).Stream=e,e.Readable=e,e.Writable=n(70469),e.Duplex=n(62910),e.Transform=n(70421),e.PassThrough=n(58994),e.finished=n(28640),e.pipeline=n(64218)},33893:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=d,this.end=l,e=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function d(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},33715:(t,e,n)=>{var r=e;r.utils=n(26436),r.common=n(95772),r.sha=n(89041),r.ripemd=n(12949),r.hmac=n(52344),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},95772:(t,e,n)=>{"use strict";var r=n(26436),i=n(79746);function o(){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}e.BlockHash=o,o.prototype.update=function(t,e){if(t=r.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=r.join32(t,0,t.length-n,this.endian);for(var i=0;i>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o{"use strict";var r=n(26436),i=n(79746);function o(t,e,n){if(!(this instanceof o))return new o(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(e,n))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e{"use strict";var r=n(26436),i=n(95772),o=r.rotl32,s=r.sum32,a=r.sum32_3,u=r.sum32_4,c=i.BlockHash;function d(){if(!(this instanceof d))return new d;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function h(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function f(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}r.inherits(d,c),e.ripemd160=d,d.blockSize=512,d.outSize=160,d.hmacStrength=192,d.padLength=64,d.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],c=this.h[3],d=this.h[4],b=n,w=r,_=i,v=c,k=d,M=0;M<80;M++){var A=s(o(u(n,l(M,r,i,c),t[p[M]+e],h(M)),g[M]),d);n=d,d=c,c=o(i,10),i=r,r=A,A=s(o(u(b,l(79-M,w,_,v),t[m[M]+e],f(M)),y[M]),k),b=k,k=v,v=o(_,10),_=w,w=A}A=a(this.h[1],i,v),this.h[1]=a(this.h[2],c,k),this.h[2]=a(this.h[3],d,b),this.h[3]=a(this.h[4],n,w),this.h[4]=a(this.h[0],r,_),this.h[0]=A},d.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"little"):r.split32(this.h,"little")};var p=[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],m=[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],g=[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],y=[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]},89041:(t,e,n)=>{"use strict";e.sha1=n(84761),e.sha224=n(10799),e.sha256=n(89344),e.sha384=n(80772),e.sha512=n(45900)},84761:(t,e,n)=>{"use strict";var r=n(26436),i=n(95772),o=n(37038),s=r.rotl32,a=r.sum32,u=r.sum32_5,c=o.ft_1,d=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;d.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(h,d),t.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r{"use strict";var r=n(26436),i=n(89344);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}r.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}},89344:(t,e,n)=>{"use strict";var r=n(26436),i=n(95772),o=n(37038),s=n(79746),a=r.sum32,u=r.sum32_4,c=r.sum32_5,d=o.ch32,l=o.maj32,h=o.s0_256,f=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,y=[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;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}r.inherits(b,g),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r{"use strict";var r=n(26436),i=n(45900);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}r.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}},45900:(t,e,n)=>{"use strict";var r=n(26436),i=n(95772),o=n(79746),s=r.rotr64_hi,a=r.rotr64_lo,u=r.shr64_hi,c=r.shr64_lo,d=r.sum64,l=r.sum64_hi,h=r.sum64_lo,f=r.sum64_4_hi,p=r.sum64_4_lo,m=r.sum64_5_hi,g=r.sum64_5_lo,y=i.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 w(){if(!(this instanceof w))return new w;y.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=new Array(160)}function _(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function v(t,e,n,r,i,o){var s=e&r^~e&o;return s<0&&(s+=4294967296),s}function k(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function M(t,e,n,r,i,o){var s=e&r^e&o^r&o;return s<0&&(s+=4294967296),s}function A(t,e){var n=s(t,e,28)^s(e,t,2)^s(e,t,7);return n<0&&(n+=4294967296),n}function S(t,e){var n=a(t,e,28)^a(e,t,2)^a(e,t,7);return n<0&&(n+=4294967296),n}function I(t,e){var n=a(t,e,14)^a(t,e,18)^a(e,t,9);return n<0&&(n+=4294967296),n}function x(t,e){var n=s(t,e,1)^s(t,e,8)^u(t,e,7);return n<0&&(n+=4294967296),n}function E(t,e){var n=a(t,e,1)^a(t,e,8)^c(t,e,7);return n<0&&(n+=4294967296),n}function T(t,e){var n=a(t,e,19)^a(e,t,29)^c(t,e,6);return n<0&&(n+=4294967296),n}r.inherits(w,y),t.exports=w,w.blockSize=1024,w.outSize=512,w.hmacStrength=192,w.padLength=128,w.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r{"use strict";var r=n(26436).rotr32;function i(t,e,n){return t&e^~t&n}function o(t,e,n){return t&e^t&n^e&n}function s(t,e,n){return t^e^n}e.ft_1=function(t,e,n,r){return 0===t?i(e,n,r):1===t||3===t?s(e,n,r):2===t?o(e,n,r):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return r(t,2)^r(t,13)^r(t,22)},e.s1_256=function(t){return r(t,6)^r(t,11)^r(t,25)},e.g0_256=function(t){return r(t,7)^r(t,18)^t>>>3},e.g1_256=function(t){return r(t,17)^r(t,19)^t>>>10}},26436:(t,e,n)=>{"use strict";var r=n(79746),i=n(35717);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>0}return s},e.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},e.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},e.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,r){return(e+r>>>0>>0},e.sum64_lo=function(t,e,n,r){return e+r>>>0},e.sum64_4_hi=function(t,e,n,r,i,o,s,a){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,n,r,i,o,s,a){return e+r+o+a>>>0},e.sum64_5_hi=function(t,e,n,r,i,o,s,a,u,c){var d=0,l=e;return d+=(l=l+r>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,n,r,i,o,s,a,u,c){return e+r+o+a+c>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},2156:(t,e,n)=>{"use strict";var r=n(33715),i=n(34504),o=n(79746);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),n=i.toArray(t.nonce,t.nonceEnc||"hex"),r=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}t.exports=s,s.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},s.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=i.toArray(n,r||"hex"),this._update(n));for(var o=[];o.length{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,d=-7,l=n?i-1:0,h=n?-1:1,f=t[e+l];for(l+=h,o=f&(1<<-d)-1,f>>=-d,d+=a;d>0;o=256*o+t[e+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+t[e+l],l+=h,d-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,d=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;t[n+f]=255&s,f+=p,s/=256,c-=8);t[n+f-p]|=128*m}},35717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},31198:(t,e,n)=>{"use strict";const r=n(74608).v4,i=n(17741),o=function(t,e){if(!(this instanceof o))return new o(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return r()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};t.exports=o,o.prototype.request=function(t,e,n,r){const o=this;let s=null;const a=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&t&&"object"==typeof t&&"function"==typeof e)r=e,s=t;else{"function"==typeof n&&(r=n,n=void 0);const o="function"==typeof r;try{s=i(t,e,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(o)return r(t);throw t}if(!o)return s}let u;try{u=JSON.stringify(s,this.options.replacer)}catch(t){return r(t)}return this.callServer(u,(function(t,e){o._parseResponse(t,e,r)})),s},o.prototype._parseResponse=function(t,e,n){if(t)return void n(t);if(!e)return n();let r;try{r=JSON.parse(e,this.options.reviver)}catch(t){return n(t)}if(3===n.length){if(Array.isArray(r)){const t=function(t){return void 0!==t.error},e=function(e){return!t(e)};return n(null,r.filter(t),r.filter(e))}return n(null,r.error,r.result)}n(null,r)}},17741:(t,e,n)=>{"use strict";const r=n(74608).v4;t.exports=function(t,e,n,i){if("string"!=typeof t)throw new TypeError(t+" must be a string");const o="number"==typeof(i=i||{}).version?i.version:2;if(1!==o&&2!==o)throw new TypeError(o+" must be 1 or 2");const s={method:t};if(2===o&&(s.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");s.params=e}if(void 0===n){const t="function"==typeof i.generator?i.generator:function(){return r()};s.id=t(s,i)}else 2===o&&null===n?i.notificationIdNull&&(s.id=null):s.id=n;return s}},55733:(t,e,n)=>{var r=n(48764).Buffer,i=n(34155);t.exports=function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[s]={exports:{}};e[s][0].call(c.exports,(function(t){return i(e[s][1][t]||t)}),c,c.exports,t,e,n,r)}return n[s].exports}for(var o=void 0,s=0;s>2,a=(3&e)<<4|n>>4,u=1>6:64,c=2>4,n=(15&s)<<4|(a=o.indexOf(t.charAt(c++)))>>2,r=(3&a)<<6|(u=o.indexOf(t.charAt(c++))),h[d++]=e,64!==a&&(h[d++]=n),64!==u&&(h[d++]=r);return h}},{"./support":30,"./utils":32}],2:[function(t,e,n){"use strict";var r=t("./external"),i=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),s=t("./stream/DataLengthProbe");function a(t,e,n,r,i){this.compressedSize=t,this.uncompressedSize=e,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var t=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(t,e,n){return t.pipe(new o).pipe(new s("uncompressedSize")).pipe(e.compressWorker(n)).pipe(new s("compressedSize")).withStreamInfo("compression",e)},e.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,n){"use strict";var r=t("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,n){"use strict";var r=t("./utils"),i=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==r.getTypeOf(t)?function(t,e,n,r){var o=i,s=0+n;t^=-1;for(var a=0;a>>8^o[255&(t^e[a])];return-1^t}(0|e,t,t.length):function(t,e,n,r){var o=i,s=0+n;t^=-1;for(var a=0;a>>8^o[255&(t^e.charCodeAt(a))];return-1^t}(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(t,e,n){"use strict";var r;r="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:r}},{lie:37}],7:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=t("pako"),o=t("./utils"),s=t("./stream/GenericWorker"),a=r?"uint8array":"array";function u(t,e){s.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}n.magic="\b\0",o.inherits(u,s),u.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(a,t.data),!1)},u.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},n.compressWorker=function(t){return new u("Deflate",t)},n.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,n){"use strict";function r(t,e){var n,r="";for(n=0;n>>=8;return r}function i(t,e,n,i,s,d){var l,h,f=t.file,p=t.compression,m=d!==a.utf8encode,g=o.transformTo("string",d(f.name)),y=o.transformTo("string",a.utf8encode(f.name)),b=f.comment,w=o.transformTo("string",d(b)),_=o.transformTo("string",a.utf8encode(b)),v=y.length!==f.name.length,k=_.length!==b.length,M="",A="",S="",I=f.dir,x=f.date,E={crc32:0,compressedSize:0,uncompressedSize:0};e&&!n||(E.crc32=t.crc32,E.compressedSize=t.compressedSize,E.uncompressedSize=t.uncompressedSize);var T=0;e&&(T|=8),m||!v&&!k||(T|=2048);var P=0,B=0;I&&(P|=16),"UNIX"===s?(B=798,P|=function(t,e){var n=t;return t||(n=e?16893:33204),(65535&n)<<16}(f.unixPermissions,I)):(B=20,P|=function(t){return 63&(t||0)}(f.dosPermissions)),l=x.getUTCHours(),l<<=6,l|=x.getUTCMinutes(),l<<=5,l|=x.getUTCSeconds()/2,h=x.getUTCFullYear()-1980,h<<=4,h|=x.getUTCMonth()+1,h<<=5,h|=x.getUTCDate(),v&&(A=r(1,1)+r(u(g),4)+y,M+="up"+r(A.length,2)+A),k&&(S=r(1,1)+r(u(w),4)+_,M+="uc"+r(S.length,2)+S);var L="";return L+="\n\0",L+=r(T,2),L+=p.magic,L+=r(l,2),L+=r(h,2),L+=r(E.crc32,4),L+=r(E.compressedSize,4),L+=r(E.uncompressedSize,4),L+=r(g.length,2),L+=r(M.length,2),{fileRecord:c.LOCAL_FILE_HEADER+L+g+M,dirRecord:c.CENTRAL_FILE_HEADER+r(B,2)+L+r(w.length,2)+"\0\0\0\0"+r(P,4)+r(i,4)+g+M+w}}var o=t("../utils"),s=t("../stream/GenericWorker"),a=t("../utf8"),u=t("../crc32"),c=t("../signature");function d(t,e,n,r){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(d,s),d.prototype.push=function(t){var e=t.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,s.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:n?(e+100*(n-r-1))/n:100}}))},d.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var n=i(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,n=i(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),e)this.push({data:function(t){return c.DATA_DESCRIPTOR+r(t.crc32,4)+r(t.compressedSize,4)+r(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e=this.index;e--)n=(n<<8)+this.byteAt(e);return this.index+=t,n},readString:function(t){return r.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=i},{"../utils":32}],19:[function(t,e,n){"use strict";var r=t("./Uint8ArrayReader");function i(t){r.call(this,t)}t("../utils").inherits(i,r),i.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,n){"use strict";var r=t("./DataReader");function i(t){r.call(this,t)}t("../utils").inherits(i,r),i.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},i.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},i.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},i.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./DataReader":18}],21:[function(t,e,n){"use strict";var r=t("./ArrayReader");function i(t){r.call(this,t)}t("../utils").inherits(i,r),i.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,n){"use strict";var r=t("../utils"),i=t("../support"),o=t("./ArrayReader"),s=t("./StringReader"),a=t("./NodeBufferReader"),u=t("./Uint8ArrayReader");e.exports=function(t){var e=r.getTypeOf(t);return r.checkSupport(e),"string"!==e||i.uint8array?"nodebuffer"===e?new a(t):i.uint8array?new u(r.transformTo("uint8array",t)):new o(r.transformTo("array",t)):new s(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,n){"use strict";var r=t("./GenericWorker"),i=t("../utils");function o(t){r.call(this,"ConvertWorker to "+t),this.destType=t}i.inherits(o,r),o.prototype.processChunk=function(t){this.push({data:i.transformTo(this.destType,t.data),meta:t.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,n){"use strict";var r=t("./GenericWorker"),i=t("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,r),o.prototype.processChunk=function(t){this.streamInfo.crc32=i(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,n){"use strict";var r=t("../utils"),i=t("./GenericWorker");function o(t){i.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}r.inherits(o,i),o.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}i.prototype.processChunk.call(this,t)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,n){"use strict";var r=t("../utils"),i=t("./GenericWorker");function o(t){i.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=r.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}r.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,n){"use strict";function r(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var n=0;n "+t:t}},e.exports=r},{}],29:[function(t,e,n){"use strict";var i=t("../utils"),o=t("./ConvertWorker"),s=t("./GenericWorker"),a=t("../base64"),u=t("../support"),c=t("../external"),d=null;if(u.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function l(t,e,n){var r=e;switch(e){case"blob":case"arraybuffer":r="uint8array";break;case"base64":r="string"}try{this._internalType=r,this._outputType=e,this._mimeType=n,i.checkSupport(r),this._worker=t.pipe(new o(r)),t.lock()}catch(t){this._worker=new s("error"),this._worker.error(t)}}l.prototype={accumulate:function(t){return function(t,e){return new c.Promise((function(n,o){var s=[],u=t._internalType,c=t._outputType,d=t._mimeType;t.on("data",(function(t,n){s.push(t),e&&e(n)})).on("error",(function(t){s=[],o(t)})).on("end",(function(){try{var t=function(t,e,n){switch(t){case"blob":return i.newBlob(i.transformTo("arraybuffer",e),n);case"base64":return a.encode(e);default:return i.transformTo(t,e)}}(c,function(t,e){var n,i=0,o=null,s=0;for(n=0;n>>6:(n<65536?e[s++]=224|n>>>12:(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63),e[s++]=128|n>>>6&63),e[s++]=128|63&n);return e}(t)},n.utf8decode=function(t){return i.nodebuffer?r.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,n,i,o,s=t.length,u=new Array(2*s);for(e=n=0;e>10&1023,u[n++]=56320|1023&i)}return u.length!==n&&(u.subarray?u=u.subarray(0,n):u.length=n),r.applyFromCharCode(u)}(t=r.transformTo(i.uint8array?"uint8array":"array",t))},r.inherits(c,s),c.prototype.processChunk=function(t){var e=r.transformTo(i.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=e;(e=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),e.set(o,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var s=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return n<0||0===n?e:n+a[t[n]]>e?n:e}(e),u=e;s!==e.length&&(i.uint8array?(u=e.subarray(0,s),this.leftOver=e.subarray(s,e.length)):(u=e.slice(0,s),this.leftOver=e.slice(s,e.length))),this.push({data:n.utf8decode(u),meta:t.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,r.inherits(d,s),d.prototype.processChunk=function(t){this.push({data:n.utf8encode(t.data),meta:t.meta})},n.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,n){"use strict";var r=t("./support"),i=t("./base64"),o=t("./nodejsUtils"),s=t("./external");function a(t){return t}function u(t,e){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,n,r,i=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4>>6:(n<65536?e[s++]=224|n>>>12:(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63),e[s++]=128|n>>>6&63),e[s++]=128|63&n);return e},n.buf2binstring=function(t){return u(t,t.length)},n.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n>10&1023,c[r++]=56320|1023&i)}return u(c,r)},n.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return n<0||0===n?e:n+s[t[n]]>e?n:e}},{"./common":41}],43:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,s=0;0!==n;){for(n-=s=2e3>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e,n,i){var o=r,s=i+n;t^=-1;for(var a=i;a>>8^o[255&(t^e[a])];return-1^t}},{}],46:[function(t,e,n){"use strict";var r,i=t("../utils/common"),o=t("./trees"),s=t("./adler32"),a=t("./crc32"),u=t("./messages"),c=0,d=0,l=-2,h=2,f=8,p=286,m=30,g=19,y=2*p+1,b=15,w=3,_=258,v=_+w+1,k=42,M=113;function A(t,e){return t.msg=u[e],e}function S(t){return(t<<1)-(4t.avail_out&&(n=t.avail_out),0!==n&&(i.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function E(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,x(t.strm)}function T(t,e){t.pending_buf[t.pending++]=e}function P(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function B(t,e){var n,r,i=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match,u=t.strstart>t.w_size-v?t.strstart-(t.w_size-v):0,c=t.window,d=t.w_mask,l=t.prev,h=t.strstart+_,f=c[o+s-1],p=c[o+s];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(c[(n=e)+s]===p&&c[n+s-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&ou&&0!=--i);return s<=t.lookahead?s:t.lookahead}function L(t){var e,n,r,o,u,c,d,l,h,f,p=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=p+(p-v)){for(i.arraySet(t.window,t.window,p,p,0),t.match_start-=p,t.strstart-=p,t.block_start-=p,e=n=t.hash_size;r=t.head[--e],t.head[e]=p<=r?r-p:0,--n;);for(e=n=p;r=t.prev[--e],t.prev[e]=p<=r?r-p:0,--n;);o+=p}if(0===t.strm.avail_in)break;if(c=t.strm,d=t.window,l=t.strstart+t.lookahead,f=void 0,(h=o)<(f=c.avail_in)&&(f=h),n=0===f?0:(c.avail_in-=f,i.arraySet(d,c.input,c.next_in,f,l),1===c.state.wrap?c.adler=s(c.adler,d,f,l):2===c.state.wrap&&(c.adler=a(c.adler,d,f,l)),c.next_in+=f,c.total_in+=f,f),t.lookahead+=n,t.lookahead+t.insert>=w)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<=w&&(t.ins_h=(t.ins_h<=w)if(r=o._tr_tally(t,t.strstart-t.match_start,t.match_length-w),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=w){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=w&&(t.ins_h=(t.ins_h<=w&&t.match_length<=t.prev_length){for(i=t.strstart+t.lookahead-w,r=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-w),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=i&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(L(t),0===t.lookahead&&e===c)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,E(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-v&&(E(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(E(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(E(t,!1),t.strm.avail_out),1)})),new O(4,4,8,4,$),new O(4,5,16,8,$),new O(4,6,32,32,$),new O(4,4,16,16,R),new O(8,16,32,32,R),new O(8,16,128,128,R),new O(8,32,128,256,R),new O(32,128,258,1024,R),new O(32,258,258,4096,R)],n.deflateInit=function(t,e){return z(t,e,f,15,8,0)},n.deflateInit2=z,n.deflateReset=N,n.deflateResetKeep=C,n.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?l:(t.state.gzhead=e,d):l},n.deflate=function(t,e){var n,i,s,u;if(!t||!t.state||5>8&255),T(i,i.gzhead.time>>16&255),T(i,i.gzhead.time>>24&255),T(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),T(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(T(i,255&i.gzhead.extra.length),T(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=a(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(T(i,0),T(i,0),T(i,0),T(i,0),T(i,0),T(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),T(i,3),i.status=M);else{var h=f+(i.w_bits-8<<4)<<8;h|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(h|=32),h+=31-h%31,i.status=M,P(i,h),0!==i.strstart&&(P(i,t.adler>>>16),P(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),x(t),s=i.pending,i.pending!==i.pending_buf_size));)T(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),x(t),s=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexs&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),x(t),s=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexs&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),0===u&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&x(t),i.pending+2<=i.pending_buf_size&&(T(i,255&t.adler),T(i,t.adler>>8&255),t.adler=0,i.status=M)):i.status=M),0!==i.pending){if(x(t),0===t.avail_out)return i.last_flush=-1,d}else if(0===t.avail_in&&S(e)<=S(n)&&4!==e)return A(t,-5);if(666===i.status&&0!==t.avail_in)return A(t,-5);if(0!==t.avail_in||0!==i.lookahead||e!==c&&666!==i.status){var p=2===i.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(L(t),0===t.lookahead)){if(e===c)return 1;break}if(t.match_length=0,n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(E(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(E(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(E(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var n,r,i,s,a=t.window;;){if(t.lookahead<=_){if(L(t),t.lookahead<=_&&e===c)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=w&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=w?(n=o._tr_tally(t,1,t.match_length-w),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(E(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(E(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(E(t,!1),0===t.strm.avail_out)?1:2}(i,e):r[i.level].func(i,e);if(3!==p&&4!==p||(i.status=666),1===p||3===p)return 0===t.avail_out&&(i.last_flush=-1),d;if(2===p&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(I(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),x(t),0===t.avail_out))return i.last_flush=-1,d}return 4!==e?d:i.wrap<=0?1:(2===i.wrap?(T(i,255&t.adler),T(i,t.adler>>8&255),T(i,t.adler>>16&255),T(i,t.adler>>24&255),T(i,255&t.total_in),T(i,t.total_in>>8&255),T(i,t.total_in>>16&255),T(i,t.total_in>>24&255)):(P(i,t.adler>>>16),P(i,65535&t.adler)),x(t),0=n.w_size&&(0===a&&(I(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,e,p-n.w_size,n.w_size,0),e=f,p=n.w_size),u=t.avail_in,c=t.next_in,h=t.input,t.avail_in=p,t.next_in=0,t.input=e,L(n);n.lookahead>=w;){for(r=n.strstart,o=n.lookahead-(w-1);n.ins_h=(n.ins_h<>>=_=w>>>24,p-=_,0==(_=w>>>16&255))I[o++]=65535&w;else{if(!(16&_)){if(0==(64&_)){w=m[(65535&w)+(f&(1<<_)-1)];continue e}if(32&_){n.mode=12;break t}t.msg="invalid literal/length code",n.mode=30;break t}v=65535&w,(_&=15)&&(p<_&&(f+=S[r++]<>>=_,p-=_),p<15&&(f+=S[r++]<>>=_=w>>>24,p-=_,!(16&(_=w>>>16&255))){if(0==(64&_)){w=g[(65535&w)+(f&(1<<_)-1)];continue n}t.msg="invalid distance code",n.mode=30;break t}if(k=65535&w,p<(_&=15)&&(f+=S[r++]<>>=_,p-=_,(_=o-s)>3,f&=(1<<(p-=v<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function p(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function m(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=d,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(l),e.distcode=e.distdyn=new r.Buf32(h),e.sane=1,e.back=-1,u):c}function g(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,m(t)):c}function y(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15=s.wsize?(r.arraySet(s.window,e,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(o=s.wsize-s.wnext)&&(o=i),r.arraySet(s.window,e,n-i,o,s.wnext),(i-=o)?(r.arraySet(s.window,e,n-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,n.check=o(n.check,N,2,0),w=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){t.msg="incorrect header check",n.mode=30;break}if(8!=(15&b)){t.msg="unknown compression method",n.mode=30;break}if(w-=4,$=8+(15&(b>>>=4)),0===n.wbits)n.wbits=$;else if($>n.wbits){t.msg="invalid window size",n.mode=30;break}n.dmax=1<<$,t.adler=n.check=1,n.mode=512&b?10:12,w=b=0;break;case 2:for(;w<16;){if(0===g)break t;g--,b+=l[p++]<>8&1),512&n.flags&&(N[0]=255&b,N[1]=b>>>8&255,n.check=o(n.check,N,2,0)),w=b=0,n.mode=3;case 3:for(;w<32;){if(0===g)break t;g--,b+=l[p++]<>>8&255,N[2]=b>>>16&255,N[3]=b>>>24&255,n.check=o(n.check,N,4,0)),w=b=0,n.mode=4;case 4:for(;w<16;){if(0===g)break t;g--,b+=l[p++]<>8),512&n.flags&&(N[0]=255&b,N[1]=b>>>8&255,n.check=o(n.check,N,2,0)),w=b=0,n.mode=5;case 5:if(1024&n.flags){for(;w<16;){if(0===g)break t;g--,b+=l[p++]<>>8&255,n.check=o(n.check,N,2,0)),w=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(g<(A=n.length)&&(A=g),A&&(n.head&&($=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,l,p,A,$)),512&n.flags&&(n.check=o(n.check,l,A,p)),g-=A,p+=A,n.length-=A),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===g)break t;for(A=0;$=l[p+A++],n.head&&$&&n.length<65536&&(n.head.name+=String.fromCharCode($)),$&&A>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=12;break;case 10:for(;w<32;){if(0===g)break t;g--,b+=l[p++]<>>=7&w,w-=7&w,n.mode=27;break}for(;w<3;){if(0===g)break t;g--,b+=l[p++]<>>=1)){case 0:n.mode=14;break;case 1:if(k(n),n.mode=20,6!==e)break;b>>>=2,w-=2;break t;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=30}b>>>=2,w-=2;break;case 14:for(b>>>=7&w,w-=7&w;w<32;){if(0===g)break t;g--,b+=l[p++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&b,w=b=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(A=n.length){if(g>>=5,w-=5,n.ndist=1+(31&b),b>>>=5,w-=5,n.ncode=4+(15&b),b>>>=4,w-=4,286>>=3,w-=3}for(;n.have<19;)n.lens[z[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,O={bits:n.lenbits},R=a(0,n.lens,0,19,n.lencode,0,n.work,O),n.lenbits=O.bits,R){t.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,T=65535&C,!((x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>>=x,w-=x,n.lens[n.have++]=T;else{if(16===T){for(D=x+2;w>>=x,w-=x,0===n.have){t.msg="invalid bit length repeat",n.mode=30;break}$=n.lens[n.have-1],A=3+(3&b),b>>>=2,w-=2}else if(17===T){for(D=x+3;w>>=x)),b>>>=3,w-=3}else{for(D=x+7;w>>=x)),b>>>=7,w-=7}if(n.have+A>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=30;break}for(;A--;)n.lens[n.have++]=$}}if(30===n.mode)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,O={bits:n.lenbits},R=a(1,n.lens,0,n.nlen,n.lencode,0,n.work,O),n.lenbits=O.bits,R){t.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,O={bits:n.distbits},R=a(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,O),n.distbits=O.bits,R){t.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(6<=g&&258<=y){t.next_out=m,t.avail_out=y,t.next_in=p,t.avail_in=g,n.hold=b,n.bits=w,s(t,v),m=t.next_out,h=t.output,y=t.avail_out,p=t.next_in,l=t.input,g=t.avail_in,b=n.hold,w=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;E=(C=n.lencode[b&(1<>>16&255,T=65535&C,!((x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>P)])>>>16&255,T=65535&C,!(P+(x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>>=P,w-=P,n.back+=P}if(b>>>=x,w-=x,n.back+=x,n.length=T,0===E){n.mode=26;break}if(32&E){n.back=-1,n.mode=12;break}if(64&E){t.msg="invalid literal/length code",n.mode=30;break}n.extra=15&E,n.mode=22;case 22:if(n.extra){for(D=n.extra;w>>=n.extra,w-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;E=(C=n.distcode[b&(1<>>16&255,T=65535&C,!((x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>P)])>>>16&255,T=65535&C,!(P+(x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>>=P,w-=P,n.back+=P}if(b>>>=x,w-=x,n.back+=x,64&E){t.msg="invalid distance code",n.mode=30;break}n.offset=T,n.extra=15&E,n.mode=24;case 24:if(n.extra){for(D=n.extra;w>>=n.extra,w-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===y)break t;if(A=v-y,n.offset>A){if((A=n.offset-A)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=30;break}S=A>n.wnext?(A-=n.wnext,n.wsize-A):n.wnext-A,A>n.length&&(A=n.length),I=n.window}else I=h,S=m-n.offset,A=n.length;for(yb?(_=C[N+l[A]],$[R+l[A]]):(_=96,0),f=1<>T)+(p-=f)]=w<<24|_<<16|v|0,0!==p;);for(f=1<>=1;if(0!==f?(L&=f-1,L+=f):L=0,A++,0==--O[M]){if(M===I)break;M=e[n+l[A]]}if(x>>7)]}function I(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function x(t,e,n){t.bi_valid>c-n?(t.bi_buf|=e<>c-t.bi_valid,t.bi_valid+=n-c):(t.bi_buf|=e<>>=1,n<<=1,0<--e;);return n>>>1}function P(t,e,n){var r,i,o=new Array(u+1),s=0;for(r=1;r<=u;r++)o[r]=s=s+n[r-1]<<1;for(i=0;i<=e;i++){var a=t[2*i+1];0!==a&&(t[2*i]=T(o[a]++,a))}}function B(t){var e;for(e=0;e>1;1<=n;n--)R(t,o,n);for(i=c;n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],R(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,R(t,o,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,s,a,c=e.dyn_tree,d=e.max_code,l=e.stat_desc.static_tree,h=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,m=e.stat_desc.max_length,g=0;for(o=0;o<=u;o++)t.bl_count[o]=0;for(c[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<573;n++)m<(o=c[2*c[2*(r=t.heap[n])+1]+1]+1)&&(o=m,g++),c[2*r+1]=o,d>=7;r>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e>>3,(s=t.static_len+3+7>>>3)<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==e?U(t,e,n,r):4===t.strategy||s===i?(x(t,2+(r?1:0),3),O(t,p,m)):(x(t,4+(r?1:0),3),function(t,e,n,r){var i;for(x(t,e-257,5),x(t,n-1,5),x(t,r-4,4),i=0;i>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(y[n]+o+1)]++,t.dyn_dtree[2*S(e)]++),t.last_lit===t.lit_bufsize-1},n._tr_align=function(t){x(t,2,3),E(t,256,p),function(t){16===t.bi_valid?(I(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":41}],53:[function(t,e,n){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,r){(function(t){!function(t,e){"use strict";if(!t.setImmediate){var n,r,o,s,a=1,u={},c=!1,d=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,n="[object process]"==={}.toString.call(t.process)?function(t){i.nextTick((function(){f(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?(s="setImmediate$"+Math.random()+"$",t.addEventListener?t.addEventListener("message",p,!1):t.attachEvent("onmessage",p),function(e){t.postMessage(s+e,"*")}):t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},function(t){o.port2.postMessage(t)}):d&&"onreadystatechange"in d.createElement("script")?(r=d.documentElement,function(t){var e=d.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):function(t){setTimeout(f,0,t)},l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r{"use strict";var r=n(35717),i=n(3349),o=n(89509).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function c(t,e,n,r,i,o,s){return u(t+(e&n|~e&r)+i+o|0,s)+e|0}function d(t,e,n,r,i,o,s){return u(t+(e&r|n&~r)+i+o|0,s)+e|0}function l(t,e,n,r,i,o,s){return u(t+(e^n^r)+i+o|0,s)+e|0}function h(t,e,n,r,i,o,s){return u(t+(n^(e|~r))+i+o|0,s)+e|0}r(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var n=this._a,r=this._b,i=this._c,o=this._d;n=c(n,r,i,o,t[0],3614090360,7),o=c(o,n,r,i,t[1],3905402710,12),i=c(i,o,n,r,t[2],606105819,17),r=c(r,i,o,n,t[3],3250441966,22),n=c(n,r,i,o,t[4],4118548399,7),o=c(o,n,r,i,t[5],1200080426,12),i=c(i,o,n,r,t[6],2821735955,17),r=c(r,i,o,n,t[7],4249261313,22),n=c(n,r,i,o,t[8],1770035416,7),o=c(o,n,r,i,t[9],2336552879,12),i=c(i,o,n,r,t[10],4294925233,17),r=c(r,i,o,n,t[11],2304563134,22),n=c(n,r,i,o,t[12],1804603682,7),o=c(o,n,r,i,t[13],4254626195,12),i=c(i,o,n,r,t[14],2792965006,17),n=d(n,r=c(r,i,o,n,t[15],1236535329,22),i,o,t[1],4129170786,5),o=d(o,n,r,i,t[6],3225465664,9),i=d(i,o,n,r,t[11],643717713,14),r=d(r,i,o,n,t[0],3921069994,20),n=d(n,r,i,o,t[5],3593408605,5),o=d(o,n,r,i,t[10],38016083,9),i=d(i,o,n,r,t[15],3634488961,14),r=d(r,i,o,n,t[4],3889429448,20),n=d(n,r,i,o,t[9],568446438,5),o=d(o,n,r,i,t[14],3275163606,9),i=d(i,o,n,r,t[3],4107603335,14),r=d(r,i,o,n,t[8],1163531501,20),n=d(n,r,i,o,t[13],2850285829,5),o=d(o,n,r,i,t[2],4243563512,9),i=d(i,o,n,r,t[7],1735328473,14),n=l(n,r=d(r,i,o,n,t[12],2368359562,20),i,o,t[5],4294588738,4),o=l(o,n,r,i,t[8],2272392833,11),i=l(i,o,n,r,t[11],1839030562,16),r=l(r,i,o,n,t[14],4259657740,23),n=l(n,r,i,o,t[1],2763975236,4),o=l(o,n,r,i,t[4],1272893353,11),i=l(i,o,n,r,t[7],4139469664,16),r=l(r,i,o,n,t[10],3200236656,23),n=l(n,r,i,o,t[13],681279174,4),o=l(o,n,r,i,t[0],3936430074,11),i=l(i,o,n,r,t[3],3572445317,16),r=l(r,i,o,n,t[6],76029189,23),n=l(n,r,i,o,t[9],3654602809,4),o=l(o,n,r,i,t[12],3873151461,11),i=l(i,o,n,r,t[15],530742520,16),n=h(n,r=l(r,i,o,n,t[2],3299628645,23),i,o,t[0],4096336452,6),o=h(o,n,r,i,t[7],1126891415,10),i=h(i,o,n,r,t[14],2878612391,15),r=h(r,i,o,n,t[5],4237533241,21),n=h(n,r,i,o,t[12],1700485571,6),o=h(o,n,r,i,t[3],2399980690,10),i=h(i,o,n,r,t[10],4293915773,15),r=h(r,i,o,n,t[1],2240044497,21),n=h(n,r,i,o,t[8],1873313359,6),o=h(o,n,r,i,t[15],4264355552,10),i=h(i,o,n,r,t[6],2734768916,15),r=h(r,i,o,n,t[13],1309151649,21),n=h(n,r,i,o,t[4],4149444226,6),o=h(o,n,r,i,t[11],3174756917,10),i=h(i,o,n,r,t[2],718787259,15),r=h(r,i,o,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){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 t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},63047:(t,e,n)=>{var r=n(96240),i=n(29931);function o(t){this.rand=t||new i.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var i=new r(this.rand.generate(n))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var n=e.sub(t);return t.add(this._randbelow(n))},o.prototype.test=function(t,e,n){var i=t.bitLength(),o=r.mont(t),s=new r(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var a=t.subn(1),u=0;!a.testn(u);u++);for(var c=t.shrn(u),d=a.toRed(o);e>0;e--){var l=this._randrange(new r(2),a);n&&n(l);var h=l.toRed(o).redPow(c);if(0!==h.cmp(s)&&0!==h.cmp(d)){for(var f=1;f0;e--){var d=this._randrange(new r(2),s),l=t.gcd(d);if(0!==l.cmpn(1))return l;var h=d.toRed(i).redPow(u);if(0!==h.cmp(o)&&0!==h.cmp(c)){for(var f=1;f=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},79746:t=>{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},34504:(t,e)=>{"use strict";var n=e;function r(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",n=0;n>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}},42786:function(t,e,n){!function(t){"use strict";t.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(t){return/^nm$/i.test(t)},meridiem:function(t,e,n){return t<12?n?"vm":"VM":n?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[Môre om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",ss:"%d sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},14130:function(t,e,n){!function(t){"use strict";var e=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},n={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},r=function(t){return function(r,i,o,s){var a=e(r),u=n[t][e(r)];return 2===a&&(u=u[i?0:1]),u.replace(/%d/i,r)}},i=["جانفي","فيفري","مارس","أفريل","ماي","جوان","جويلية","أوت","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];t.defineLocale("ar-dz",{months:i,monthsShort:i,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:r("s"),ss:r("s"),m:r("m"),mm:r("m"),h:r("h"),hh:r("h"),d:r("d"),dd:r("d"),M:r("M"),MM:r("M"),y:r("y"),yy:r("y")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:0,doy:4}})}(n(30381))},96135:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-kw",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:0,doy:12}})}(n(30381))},56440:function(t,e,n){!function(t){"use strict";var e={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},n=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},r={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},i=function(t){return function(e,i,o,s){var a=n(e),u=r[t][n(e)];return 2===a&&(u=u[i?0:1]),u.replace(/%d/i,e)}},o=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];t.defineLocale("ar-ly",{months:o,monthsShort:o,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:i("s"),ss:i("s"),m:i("m"),mm:i("m"),h:i("h"),hh:i("h"),d:i("d"),dd:i("d"),M:i("M"),MM:i("M"),y:i("y"),yy:i("y")},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n(30381))},47702:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n(30381))},20315:function(t,e,n){!function(t){"use strict";var e={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};t.defineLocale("ar-ps",{months:"كانون الثاني_شباط_آذار_نيسان_أيّار_حزيران_تمّوز_آب_أيلول_تشري الأوّل_تشرين الثاني_كانون الأوّل".split("_"),monthsShort:"ك٢_شباط_آذار_نيسان_أيّار_حزيران_تمّوز_آب_أيلول_ت١_ت٢_ك١".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(t){return t.replace(/[٣٤٥٦٧٨٩٠]/g,(function(t){return n[t]})).split("").reverse().join("").replace(/[١٢](?![\u062a\u0643])/g,(function(t){return n[t]})).split("").reverse().join("").replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:0,doy:6}})}(n(30381))},16040:function(t,e,n){!function(t){"use strict";var e={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};t.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(t){return t.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(t){return n[t]})).replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:0,doy:6}})}(n(30381))},37100:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-tn",{months:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n(30381))},30867:function(t,e,n){!function(t){"use strict";var e={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},r=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},i={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},o=function(t){return function(e,n,o,s){var a=r(e),u=i[t][r(e)];return 2===a&&(u=u[n?0:1]),u.replace(/%d/i,e)}},s=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];t.defineLocale("ar",{months:s,monthsShort:s,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:o("s"),ss:o("s"),m:o("m"),mm:o("m"),h:o("h"),hh:o("h"),d:o("d"),dd:o("d"),M:o("M"),MM:o("M"),y:o("y"),yy:o("y")},preparse:function(t){return t.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(t){return n[t]})).replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n(30381))},31083:function(t,e,n){!function(t){"use strict";var e={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-üncü",4:"-üncü",100:"-üncü",6:"-ncı",9:"-uncu",10:"-uncu",30:"-uncu",60:"-ıncı",90:"-ıncı"};t.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),weekdaysShort:"Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),weekdaysMin:"Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[gələn həftə] dddd [saat] LT",lastDay:"[dünən] LT",lastWeek:"[keçən həftə] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s əvvəl",s:"bir neçə saniyə",ss:"%d saniyə",m:"bir dəqiqə",mm:"%d dəqiqə",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gecə|səhər|gündüz|axşam/,isPM:function(t){return/^(gündüz|axşam)$/.test(t)},meridiem:function(t,e,n){return t<4?"gecə":t<12?"səhər":t<17?"gündüz":"axşam"},dayOfMonthOrdinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(t){if(0===t)return t+"-ıncı";var n=t%10;return t+(e[n]||e[t%100-n]||e[t>=100?100:null])},week:{dow:1,doy:7}})}(n(30381))},9808:function(t,e,n){!function(t){"use strict";function e(t,e,n){return"m"===n?e?"хвіліна":"хвіліну":"h"===n?e?"гадзіна":"гадзіну":t+" "+(r=+t,i={ss:e?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:e?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:e?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"}[n].split("_"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2]);var r,i}t.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:e,mm:e,h:e,hh:e,d:"дзень",dd:e,M:"месяц",MM:e,y:"год",yy:e},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(t){return/^(дня|вечара)$/.test(t)},meridiem:function(t,e,n){return t<4?"ночы":t<12?"раніцы":t<17?"дня":"вечара"},dayOfMonthOrdinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":case"w":case"W":return t%10!=2&&t%10!=3||t%100==12||t%100==13?t+"-ы":t+"-і";case"D":return t+"-га";default:return t}},week:{dow:1,doy:7}})}(n(30381))},68338:function(t,e,n){!function(t){"use strict";t.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Миналата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[Миналия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",ss:"%d секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",w:"седмица",ww:"%d седмици",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(t){var e=t%10,n=t%100;return 0===t?t+"-ев":0===n?t+"-ен":n>10&&n<20?t+"-ти":1===e?t+"-ви":2===e?t+"-ри":7===e||8===e?t+"-ми":t+"-ти"},week:{dow:1,doy:7}})}(n(30381))},67438:function(t,e,n){!function(t){"use strict";t.defineLocale("bm",{months:"Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo".split("_"),monthsShort:"Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des".split("_"),weekdays:"Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri".split("_"),weekdaysShort:"Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib".split("_"),weekdaysMin:"Ka_Nt_Ta_Ar_Al_Ju_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"MMMM [tile] D [san] YYYY",LLL:"MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm",LLLL:"dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm"},calendar:{sameDay:"[Bi lɛrɛ] LT",nextDay:"[Sini lɛrɛ] LT",nextWeek:"dddd [don lɛrɛ] LT",lastDay:"[Kunu lɛrɛ] LT",lastWeek:"dddd [tɛmɛnen lɛrɛ] LT",sameElse:"L"},relativeTime:{future:"%s kɔnɔ",past:"a bɛ %s bɔ",s:"sanga dama dama",ss:"sekondi %d",m:"miniti kelen",mm:"miniti %d",h:"lɛrɛ kelen",hh:"lɛrɛ %d",d:"tile kelen",dd:"tile %d",M:"kalo kelen",MM:"kalo %d",y:"san kelen",yy:"san %d"},week:{dow:1,doy:4}})}(n(30381))},76225:function(t,e,n){!function(t){"use strict";var e={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};t.defineLocale("bn-bd",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(t){return t.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/রাত|ভোর|সকাল|দুপুর|বিকাল|সন্ধ্যা|রাত/,meridiemHour:function(t,e){return 12===t&&(t=0),"রাত"===e?t<4?t:t+12:"ভোর"===e||"সকাল"===e?t:"দুপুর"===e?t>=3?t:t+12:"বিকাল"===e||"সন্ধ্যা"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"রাত":t<6?"ভোর":t<12?"সকাল":t<15?"দুপুর":t<18?"বিকাল":t<20?"সন্ধ্যা":"রাত"},week:{dow:0,doy:6}})}(n(30381))},8905:function(t,e,n){!function(t){"use strict";var e={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};t.defineLocale("bn",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(t){return t.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(t,e){return 12===t&&(t=0),"রাত"===e&&t>=4||"দুপুর"===e&&t<5||"বিকাল"===e?t+12:t},meridiem:function(t,e,n){return t<4?"রাত":t<10?"সকাল":t<17?"দুপুর":t<20?"বিকাল":"রাত"},week:{dow:0,doy:6}})}(n(30381))},11560:function(t,e,n){!function(t){"use strict";var e={1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"},n={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"};t.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12".split("_"),monthsShortRegex:/^(ཟླ་\d{1,2})/,monthsParseExact:!0,weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",ss:"%d སྐར་ཆ།",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(t){return t.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(t,e){return 12===t&&(t=0),"མཚན་མོ"===e&&t>=4||"ཉིན་གུང"===e&&t<5||"དགོང་དག"===e?t+12:t},meridiem:function(t,e,n){return t<4?"མཚན་མོ":t<10?"ཞོགས་ཀས":t<17?"ཉིན་གུང":t<20?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}})}(n(30381))},1278:function(t,e,n){!function(t){"use strict";function e(t,e,n){return t+" "+function(t,e){return 2===e?function(t){var e={m:"v",b:"v",d:"z"};return void 0===e[t.charAt(0)]?t:e[t.charAt(0)]+t.substring(1)}(t):t}({mm:"munutenn",MM:"miz",dd:"devezh"}[n],t)}function n(t){return t>9?n(t%10):t}var r=[/^gen/i,/^c[ʼ\']hwe/i,/^meu/i,/^ebr/i,/^mae/i,/^(mez|eve)/i,/^gou/i,/^eos/i,/^gwe/i,/^her/i,/^du/i,/^ker/i],i=/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,o=[/^Su/i,/^Lu/i,/^Me([^r]|$)/i,/^Mer/i,/^Ya/i,/^Gw/i,/^Sa/i];t.defineLocale("br",{months:"Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParse:o,fullWeekdaysParse:[/^sul/i,/^lun/i,/^meurzh/i,/^merc[ʼ\']her/i,/^yaou/i,/^gwener/i,/^sadorn/i],shortWeekdaysParse:[/^Sul/i,/^Lun/i,/^Meu/i,/^Mer/i,/^Yao/i,/^Gwe/i,/^Sad/i],minWeekdaysParse:o,monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,monthsShortStrictRegex:/^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY HH:mm",LLLL:"dddd, D [a viz] MMMM YYYY HH:mm"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warcʼhoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Decʼh da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s ʼzo",s:"un nebeud segondennoù",ss:"%d eilenn",m:"ur vunutenn",mm:e,h:"un eur",hh:"%d eur",d:"un devezh",dd:e,M:"ur miz",MM:e,y:"ur bloaz",yy:function(t){switch(n(t)){case 1:case 3:case 4:case 5:case 9:return t+" bloaz";default:return t+" vloaz"}}},dayOfMonthOrdinalParse:/\d{1,2}(añ|vet)/,ordinal:function(t){return t+(1===t?"añ":"vet")},week:{dow:1,doy:4},meridiemParse:/a.m.|g.m./,isPM:function(t){return"g.m."===t},meridiem:function(t,e,n){return t<12?"a.m.":"g.m."}})}(n(30381))},80622:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=t+" ";switch(n){case"ss":return r+(1===t?"sekunda":2===t||3===t||4===t?"sekunde":"sekundi");case"mm":return r+(1===t?"minuta":2===t||3===t||4===t?"minute":"minuta");case"h":return"jedan sat";case"hh":return r+(1===t?"sat":2===t||3===t||4===t?"sata":"sati");case"dd":return r+(1===t?"dan":"dana");case"MM":return r+(1===t?"mjesec":2===t||3===t||4===t?"mjeseca":"mjeseci");case"yy":return r+(1===t?"godina":2===t||3===t||4===t?"godine":"godina")}}t.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:e,m:function(t,e,n,r){if("m"===n)return e?"jedna minuta":r?"jednu minutu":"jedne minute"},mm:e,h:e,hh:e,d:"dan",dd:e,M:"mjesec",MM:e,y:"godinu",yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},2468:function(t,e,n){!function(t){"use strict";t.defineLocale("ca",{months:{standalone:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),format:"de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dt_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a les] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a les] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"uns segons",ss:"%d segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(t,e){var n=1===t?"r":2===t?"n":3===t?"r":4===t?"t":"è";return"w"!==e&&"W"!==e||(n="a"),t+n},week:{dow:1,doy:4}})}(n(30381))},5822:function(t,e,n){!function(t){"use strict";var e={standalone:"leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),format:"ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince".split("_"),isFormat:/DD?[o.]?(\[[^\[\]]*\]|\s)+MMMM/},n="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),r=[/^led/i,/^úno/i,/^bře/i,/^dub/i,/^kvě/i,/^(čvn|červen$|června)/i,/^(čvc|červenec|července)/i,/^srp/i,/^zář/i,/^říj/i,/^lis/i,/^pro/i],i=/^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;function o(t){return t>1&&t<5&&1!=~~(t/10)}function s(t,e,n,r){var i=t+" ";switch(n){case"s":return e||r?"pár sekund":"pár sekundami";case"ss":return e||r?i+(o(t)?"sekundy":"sekund"):i+"sekundami";case"m":return e?"minuta":r?"minutu":"minutou";case"mm":return e||r?i+(o(t)?"minuty":"minut"):i+"minutami";case"h":return e?"hodina":r?"hodinu":"hodinou";case"hh":return e||r?i+(o(t)?"hodiny":"hodin"):i+"hodinami";case"d":return e||r?"den":"dnem";case"dd":return e||r?i+(o(t)?"dny":"dní"):i+"dny";case"M":return e||r?"měsíc":"měsícem";case"MM":return e||r?i+(o(t)?"měsíce":"měsíců"):i+"měsíci";case"y":return e||r?"rok":"rokem";case"yy":return e||r?i+(o(t)?"roky":"let"):i+"lety"}}t.defineLocale("cs",{months:e,monthsShort:n,monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s,ss:s,m:s,mm:s,h:s,hh:s,d:s,dd:s,M:s,MM:s,y:s,yy:s},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},50877:function(t,e,n){!function(t){"use strict";t.defineLocale("cv",{months:"кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),monthsShort:"кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кҫ_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",LLL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",LLLL:"dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ӗнер] LT [сехетре]",nextWeek:"[Ҫитес] dddd LT [сехетре]",lastWeek:"[Иртнӗ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(t){return t+(/сехет$/i.exec(t)?"рен":/ҫул$/i.exec(t)?"тан":"ран")},past:"%s каялла",s:"пӗр-ик ҫеккунт",ss:"%d ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},dayOfMonthOrdinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}})}(n(30381))},47373:function(t,e,n){!function(t){"use strict";t.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",ss:"%d eiliad",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},dayOfMonthOrdinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(t){var e="";return t>20?e=40===t||50===t||60===t||80===t||100===t?"fed":"ain":t>0&&(e=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"][t]),t+e},week:{dow:1,doy:4}})}(n(30381))},24780:function(t,e,n){!function(t){"use strict";t.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"på dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[i] dddd[s kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",ss:"%d sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},60217:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},60894:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de-ch",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},59740:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},5300:function(t,e,n){!function(t){"use strict";var e=["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"],n=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"];t.defineLocale("dv",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:"އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/މކ|މފ/,isPM:function(t){return"މފ"===t},meridiem:function(t,e,n){return t<12?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] LT",lastWeek:"[ފާއިތުވި] dddd LT",sameElse:"L"},relativeTime:{future:"ތެރޭގައި %s",past:"ކުރިން %s",s:"ސިކުންތުކޮޅެއް",ss:"d% ސިކުންތު",m:"މިނިޓެއް",mm:"މިނިޓު %d",h:"ގަޑިއިރެއް",hh:"ގަޑިއިރު %d",d:"ދުވަހެއް",dd:"ދުވަސް %d",M:"މަހެއް",MM:"މަސް %d",y:"އަހަރެއް",yy:"އަހަރު %d"},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:7,doy:12}})}(n(30381))},50837:function(t,e,n){!function(t){"use strict";t.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(t,e){return t?"string"==typeof e&&/D/.test(e.substring(0,e.indexOf("MMMM")))?this._monthsGenitiveEl[t.month()]:this._monthsNominativeEl[t.month()]:this._monthsNominativeEl},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(t,e,n){return t>11?n?"μμ":"ΜΜ":n?"πμ":"ΠΜ"},isPM:function(t){return"μ"===(t+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){return 6===this.day()?"[το προηγούμενο] dddd [{}] LT":"[την προηγούμενη] dddd [{}] LT"},sameElse:"L"},calendar:function(t,e){var n,r=this._calendarEl[t],i=e&&e.hours();return n=r,("undefined"!=typeof Function&&n instanceof Function||"[object Function]"===Object.prototype.toString.call(n))&&(r=r.apply(e)),r.replace("{}",i%12==1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",ss:"%d δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},dayOfMonthOrdinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}})}(n(30381))},78348:function(t,e,n){!function(t){"use strict";t.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:0,doy:4}})}(n(30381))},77925:function(t,e,n){!function(t){"use strict";t.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}})}(n(30381))},22243:function(t,e,n){!function(t){"use strict";t.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},46436:function(t,e,n){!function(t){"use strict";t.defineLocale("en-ie",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},47207:function(t,e,n){!function(t){"use strict";t.defineLocale("en-il",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}})}(n(30381))},44175:function(t,e,n){!function(t){"use strict";t.defineLocale("en-in",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:0,doy:6}})}(n(30381))},76319:function(t,e,n){!function(t){"use strict";t.defineLocale("en-nz",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},31662:function(t,e,n){!function(t){"use strict";t.defineLocale("en-sg",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},92915:function(t,e,n){!function(t){"use strict";t.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec".split("_"),weekdays:"dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato".split("_"),weekdaysShort:"dim_lun_mard_merk_ĵaŭ_ven_sab".split("_"),weekdaysMin:"di_lu_ma_me_ĵa_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"[la] D[-an de] MMMM, YYYY",LLL:"[la] D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd[n], [la] D[-an de] MMMM, YYYY HH:mm",llll:"ddd, [la] D[-an de] MMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(t){return"p"===t.charAt(0).toLowerCase()},meridiem:function(t,e,n){return t>11?n?"p.t.m.":"P.T.M.":n?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd[n je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasintan] dddd[n je] LT",sameElse:"L"},relativeTime:{future:"post %s",past:"antaŭ %s",s:"kelkaj sekundoj",ss:"%d sekundoj",m:"unu minuto",mm:"%d minutoj",h:"unu horo",hh:"%d horoj",d:"unu tago",dd:"%d tagoj",M:"unu monato",MM:"%d monatoj",y:"unu jaro",yy:"%d jaroj"},dayOfMonthOrdinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}})}(n(30381))},55251:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-do",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},96112:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-mx",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:4},invalidDate:"Fecha inválida"})}(n(30381))},71146:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-us",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"MM/DD/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:6}})}(n(30381))},55655:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4},invalidDate:"Fecha inválida"})}(n(30381))},5603:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["mõne sekundi","mõni sekund","paar sekundit"],ss:[t+"sekundi",t+"sekundit"],m:["ühe minuti","üks minut"],mm:[t+" minuti",t+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[t+" tunni",t+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[t+" kuu",t+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[t+" aasta",t+" aastat"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}t.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:"%d päeva",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},77763:function(t,e,n){!function(t){"use strict";t.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",ss:"%d segundo",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},76959:function(t,e,n){!function(t){"use strict";var e={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},n={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};t.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(t){return/بعد از ظهر/.test(t)},meridiem:function(t,e,n){return t<12?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",ss:"%d ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(t){return t.replace(/[۰-۹]/g,(function(t){return n[t]})).replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},dayOfMonthOrdinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}})}(n(30381))},11897:function(t,e,n){!function(t){"use strict";var e="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),n=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",e[7],e[8],e[9]];function r(t,r,i,o){var s="";switch(i){case"s":return o?"muutaman sekunnin":"muutama sekunti";case"ss":s=o?"sekunnin":"sekuntia";break;case"m":return o?"minuutin":"minuutti";case"mm":s=o?"minuutin":"minuuttia";break;case"h":return o?"tunnin":"tunti";case"hh":s=o?"tunnin":"tuntia";break;case"d":return o?"päivän":"päivä";case"dd":s=o?"päivän":"päivää";break;case"M":return o?"kuukauden":"kuukausi";case"MM":s=o?"kuukauden":"kuukautta";break;case"y":return o?"vuoden":"vuosi";case"yy":s=o?"vuoden":"vuotta"}return function(t,r){return t<10?r?n[t]:e[t]:t}(t,o)+" "+s}t.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},42549:function(t,e,n){!function(t){"use strict";t.defineLocale("fil",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},94694:function(t,e,n){!function(t){"use strict";t.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",ss:"%d sekundir",m:"ein minuttur",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaður",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},63049:function(t,e,n){!function(t){"use strict";t.defineLocale("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(t,e){switch(e){default:case"M":case"Q":case"D":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}}})}(n(30381))},52330:function(t,e,n){!function(t){"use strict";t.defineLocale("fr-ch",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(t,e){switch(e){default:case"M":case"Q":case"D":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}},week:{dow:1,doy:4}})}(n(30381))},94470:function(t,e,n){!function(t){"use strict";var e=/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,n=[/^janv/i,/^févr/i,/^mars/i,/^avr/i,/^mai/i,/^juin/i,/^juil/i,/^août/i,/^sept/i,/^oct/i,/^nov/i,/^déc/i];t.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsRegex:e,monthsShortRegex:e,monthsStrictRegex:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,monthsShortStrictRegex:/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",w:"une semaine",ww:"%d semaines",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|)/,ordinal:function(t,e){switch(e){case"D":return t+(1===t?"er":"");default:case"M":case"Q":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}},week:{dow:1,doy:4}})}(n(30381))},5044:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_"),n="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_");t.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsParseExact:!0,weekdays:"snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),weekdaysShort:"si._mo._ti._wo._to._fr._so.".split("_"),weekdaysMin:"Si_Mo_Ti_Wo_To_Fr_So".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[hjoed om] LT",nextDay:"[moarn om] LT",nextWeek:"dddd [om] LT",lastDay:"[juster om] LT",lastWeek:"[ôfrûne] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oer %s",past:"%s lyn",s:"in pear sekonden",ss:"%d sekonden",m:"ien minút",mm:"%d minuten",h:"ien oere",hh:"%d oeren",d:"ien dei",dd:"%d dagen",M:"ien moanne",MM:"%d moannen",y:"ien jier",yy:"%d jierren"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},29295:function(t,e,n){!function(t){"use strict";t.defineLocale("ga",{months:["Eanáir","Feabhra","Márta","Aibreán","Bealtaine","Meitheamh","Iúil","Lúnasa","Meán Fómhair","Deireadh Fómhair","Samhain","Nollaig"],monthsShort:["Ean","Feabh","Márt","Aib","Beal","Meith","Iúil","Lún","M.F.","D.F.","Samh","Noll"],monthsParseExact:!0,weekdays:["Dé Domhnaigh","Dé Luain","Dé Máirt","Dé Céadaoin","Déardaoin","Dé hAoine","Dé Sathairn"],weekdaysShort:["Domh","Luan","Máirt","Céad","Déar","Aoine","Sath"],weekdaysMin:["Do","Lu","Má","Cé","Dé","A","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Inniu ag] LT",nextDay:"[Amárach ag] LT",nextWeek:"dddd [ag] LT",lastDay:"[Inné ag] LT",lastWeek:"dddd [seo caite] [ag] LT",sameElse:"L"},relativeTime:{future:"i %s",past:"%s ó shin",s:"cúpla soicind",ss:"%d soicind",m:"nóiméad",mm:"%d nóiméad",h:"uair an chloig",hh:"%d uair an chloig",d:"lá",dd:"%d lá",M:"mí",MM:"%d míonna",y:"bliain",yy:"%d bliain"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(t){return t+(1===t?"d":t%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n(30381))},2101:function(t,e,n){!function(t){"use strict";t.defineLocale("gd",{months:["Am Faoilleach","An Gearran","Am Màrt","An Giblean","An Cèitean","An t-Ògmhios","An t-Iuchar","An Lùnastal","An t-Sultain","An Dàmhair","An t-Samhain","An Dùbhlachd"],monthsShort:["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],monthsParseExact:!0,weekdays:["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],weekdaysShort:["Did","Dil","Dim","Dic","Dia","Dih","Dis"],weekdaysMin:["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-màireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-dè aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",ss:"%d diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"mìos",MM:"%d mìosan",y:"bliadhna",yy:"%d bliadhna"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(t){return t+(1===t?"d":t%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n(30381))},38794:function(t,e,n){!function(t){"use strict";t.defineLocale("gl",{months:"xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro".split("_"),monthsShort:"xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"domingo_luns_martes_mércores_xoves_venres_sábado".split("_"),weekdaysShort:"dom._lun._mar._mér._xov._ven._sáb.".split("_"),weekdaysMin:"do_lu_ma_mé_xo_ve_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(t){return 0===t.indexOf("un")?"n"+t:"en "+t},past:"hai %s",s:"uns segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},27884:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["थोडया सॅकंडांनी","थोडे सॅकंड"],ss:[t+" सॅकंडांनी",t+" सॅकंड"],m:["एका मिणटान","एक मिनूट"],mm:[t+" मिणटांनी",t+" मिणटां"],h:["एका वरान","एक वर"],hh:[t+" वरांनी",t+" वरां"],d:["एका दिसान","एक दीस"],dd:[t+" दिसांनी",t+" दीस"],M:["एका म्हयन्यान","एक म्हयनो"],MM:[t+" म्हयन्यानी",t+" म्हयने"],y:["एका वर्सान","एक वर्स"],yy:[t+" वर्सांनी",t+" वर्सां"]};return r?i[n][0]:i[n][1]}t.defineLocale("gom-deva",{months:{standalone:"जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),format:"जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार".split("_"),weekdaysShort:"आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.".split("_"),weekdaysMin:"आ_सो_मं_बु_ब्रे_सु_शे".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [वाजतां]",LTS:"A h:mm:ss [वाजतां]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [वाजतां]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [वाजतां]",llll:"ddd, D MMM YYYY, A h:mm [वाजतां]"},calendar:{sameDay:"[आयज] LT",nextDay:"[फाल्यां] LT",nextWeek:"[फुडलो] dddd[,] LT",lastDay:"[काल] LT",lastWeek:"[फाटलो] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s आदीं",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}(वेर)/,ordinal:function(t,e){return"D"===e?t+"वेर":t},week:{dow:0,doy:3},meridiemParse:/राती|सकाळीं|दनपारां|सांजे/,meridiemHour:function(t,e){return 12===t&&(t=0),"राती"===e?t<4?t:t+12:"सकाळीं"===e?t:"दनपारां"===e?t>12?t:t+12:"सांजे"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"राती":t<12?"सकाळीं":t<16?"दनपारां":t<20?"सांजे":"राती"}})}(n(30381))},23168:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["thoddea sekondamni","thodde sekond"],ss:[t+" sekondamni",t+" sekond"],m:["eka mintan","ek minut"],mm:[t+" mintamni",t+" mintam"],h:["eka voran","ek vor"],hh:[t+" voramni",t+" voram"],d:["eka disan","ek dis"],dd:[t+" disamni",t+" dis"],M:["eka mhoinean","ek mhoino"],MM:[t+" mhoineamni",t+" mhoine"],y:["eka vorsan","ek voros"],yy:[t+" vorsamni",t+" vorsam"]};return r?i[n][0]:i[n][1]}t.defineLocale("gom-latn",{months:{standalone:"Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr".split("_"),format:"Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split("_"),weekdaysShort:"Ait._Som._Mon._Bud._Bre._Suk._Son.".split("_"),weekdaysMin:"Ai_Sm_Mo_Bu_Br_Su_Sn".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [vazta]",LTS:"A h:mm:ss [vazta]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [vazta]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [vazta]",llll:"ddd, D MMM YYYY, A h:mm [vazta]"},calendar:{sameDay:"[Aiz] LT",nextDay:"[Faleam] LT",nextWeek:"[Fuddlo] dddd[,] LT",lastDay:"[Kal] LT",lastWeek:"[Fattlo] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s adim",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}(er)/,ordinal:function(t,e){return"D"===e?t+"er":t},week:{dow:0,doy:3},meridiemParse:/rati|sokallim|donparam|sanje/,meridiemHour:function(t,e){return 12===t&&(t=0),"rati"===e?t<4?t:t+12:"sokallim"===e?t:"donparam"===e?t>12?t:t+12:"sanje"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"rati":t<12?"sokallim":t<16?"donparam":t<20?"sanje":"rati"}})}(n(30381))},95349:function(t,e,n){!function(t){"use strict";var e={1:"૧",2:"૨",3:"૩",4:"૪",5:"૫",6:"૬",7:"૭",8:"૮",9:"૯",0:"૦"},n={"૧":"1","૨":"2","૩":"3","૪":"4","૫":"5","૬":"6","૭":"7","૮":"8","૯":"9","૦":"0"};t.defineLocale("gu",{months:"જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર".split("_"),monthsShort:"જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.".split("_"),monthsParseExact:!0,weekdays:"રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર".split("_"),weekdaysShort:"રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ".split("_"),weekdaysMin:"ર_સો_મં_બુ_ગુ_શુ_શ".split("_"),longDateFormat:{LT:"A h:mm વાગ્યે",LTS:"A h:mm:ss વાગ્યે",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm વાગ્યે",LLLL:"dddd, D MMMM YYYY, A h:mm વાગ્યે"},calendar:{sameDay:"[આજ] LT",nextDay:"[કાલે] LT",nextWeek:"dddd, LT",lastDay:"[ગઇકાલે] LT",lastWeek:"[પાછલા] dddd, LT",sameElse:"L"},relativeTime:{future:"%s મા",past:"%s પહેલા",s:"અમુક પળો",ss:"%d સેકંડ",m:"એક મિનિટ",mm:"%d મિનિટ",h:"એક કલાક",hh:"%d કલાક",d:"એક દિવસ",dd:"%d દિવસ",M:"એક મહિનો",MM:"%d મહિનો",y:"એક વર્ષ",yy:"%d વર્ષ"},preparse:function(t){return t.replace(/[૧૨૩૪૫૬૭૮૯૦]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/રાત|બપોર|સવાર|સાંજ/,meridiemHour:function(t,e){return 12===t&&(t=0),"રાત"===e?t<4?t:t+12:"સવાર"===e?t:"બપોર"===e?t>=10?t:t+12:"સાંજ"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"રાત":t<10?"સવાર":t<17?"બપોર":t<20?"સાંજ":"રાત"},week:{dow:0,doy:6}})}(n(30381))},24206:function(t,e,n){!function(t){"use strict";t.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",ss:"%d שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(t){return 2===t?"שעתיים":t+" שעות"},d:"יום",dd:function(t){return 2===t?"יומיים":t+" ימים"},M:"חודש",MM:function(t){return 2===t?"חודשיים":t+" חודשים"},y:"שנה",yy:function(t){return 2===t?"שנתיים":t%10==0&&10!==t?t+" שנה":t+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(t){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(t)},meridiem:function(t,e,n){return t<5?"לפנות בוקר":t<10?"בבוקר":t<12?n?'לפנה"צ':"לפני הצהריים":t<18?n?'אחה"צ':"אחרי הצהריים":"בערב"}})}(n(30381))},30094:function(t,e,n){!function(t){"use strict";var e={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},r=[/^जन/i,/^फ़र|फर/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सितं|सित/i,/^अक्टू/i,/^नव|नवं/i,/^दिसं|दिस/i];t.defineLocale("hi",{months:{format:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),standalone:"जनवरी_फरवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितंबर_अक्टूबर_नवंबर_दिसंबर".split("_")},monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",LTS:"A h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm बजे",LLLL:"dddd, D MMMM YYYY, A h:mm बजे"},monthsParse:r,longMonthsParse:r,shortMonthsParse:[/^जन/i,/^फ़र/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सित/i,/^अक्टू/i,/^नव/i,/^दिस/i],monthsRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsShortRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsStrictRegex:/^(जनवरी?|फ़रवरी|फरवरी?|मार्च?|अप्रैल?|मई?|जून?|जुलाई?|अगस्त?|सितम्बर|सितंबर|सित?\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर?|दिसम्बर|दिसंबर?)/i,monthsShortStrictRegex:/^(जन\.?|फ़र\.?|मार्च?|अप्रै\.?|मई?|जून?|जुल\.?|अग\.?|सित\.?|अक्टू\.?|नव\.?|दिस\.?)/i,calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",ss:"%d सेकंड",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(t){return t.replace(/[१२३४५६७८९०]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(t,e){return 12===t&&(t=0),"रात"===e?t<4?t:t+12:"सुबह"===e?t:"दोपहर"===e?t>=10?t:t+12:"शाम"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"रात":t<10?"सुबह":t<17?"दोपहर":t<20?"शाम":"रात"},week:{dow:0,doy:6}})}(n(30381))},30316:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=t+" ";switch(n){case"ss":return r+(1===t?"sekunda":2===t||3===t||4===t?"sekunde":"sekundi");case"m":return e?"jedna minuta":"jedne minute";case"mm":return r+(1===t?"minuta":2===t||3===t||4===t?"minute":"minuta");case"h":return e?"jedan sat":"jednog sata";case"hh":return r+(1===t?"sat":2===t||3===t||4===t?"sata":"sati");case"dd":return r+(1===t?"dan":"dana");case"MM":return r+(1===t?"mjesec":2===t||3===t||4===t?"mjeseca":"mjeseci");case"yy":return r+(1===t?"godina":2===t||3===t||4===t?"godine":"godina")}}t.defineLocale("hr",{months:{format:"siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),standalone:"siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")},monthsShort:"sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"Do MMMM YYYY",LLL:"Do MMMM YYYY H:mm",LLLL:"dddd, Do MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:return"[prošlu] [nedjelju] [u] LT";case 3:return"[prošlu] [srijedu] [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:e,m:e,mm:e,h:e,hh:e,d:"dan",dd:e,M:"mjesec",MM:e,y:"godinu",yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},22138:function(t,e,n){!function(t){"use strict";var e="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");function n(t,e,n,r){var i=t;switch(n){case"s":return r||e?"néhány másodperc":"néhány másodperce";case"ss":return i+(r||e)?" másodperc":" másodperce";case"m":return"egy"+(r||e?" perc":" perce");case"mm":return i+(r||e?" perc":" perce");case"h":return"egy"+(r||e?" óra":" órája");case"hh":return i+(r||e?" óra":" órája");case"d":return"egy"+(r||e?" nap":" napja");case"dd":return i+(r||e?" nap":" napja");case"M":return"egy"+(r||e?" hónap":" hónapja");case"MM":return i+(r||e?" hónap":" hónapja");case"y":return"egy"+(r||e?" év":" éve");case"yy":return i+(r||e?" év":" éve")}return""}function r(t){return(t?"":"[múlt] ")+"["+e[this.day()]+"] LT[-kor]"}t.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(t){return"u"===t.charAt(1).toLowerCase()},meridiem:function(t,e,n){return t<12?!0===n?"de":"DE":!0===n?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return r.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return r.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:n,ss:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},11423:function(t,e,n){!function(t){"use strict";t.defineLocale("hy-am",{months:{format:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_"),standalone:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_")},monthsShort:"հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_"),weekdays:"կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_"),weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., HH:mm",LLLL:"dddd, D MMMM YYYY թ., HH:mm"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",ss:"%d վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(t){return/^(ցերեկվա|երեկոյան)$/.test(t)},meridiem:function(t){return t<4?"գիշերվա":t<12?"առավոտվա":t<17?"ցերեկվա":"երեկոյան"},dayOfMonthOrdinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(t,e){switch(e){case"DDD":case"w":case"W":case"DDDo":return 1===t?t+"-ին":t+"-րդ";default:return t}},week:{dow:1,doy:7}})}(n(30381))},29218:function(t,e,n){!function(t){"use strict";t.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"siang"===e?t>=11?t:t+12:"sore"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"siang":t<19?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",ss:"%d detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:0,doy:6}})}(n(30381))},90135:function(t,e,n){!function(t){"use strict";function e(t){return t%100==11||t%10!=1}function n(t,n,r,i){var o=t+" ";switch(r){case"s":return n||i?"nokkrar sekúndur":"nokkrum sekúndum";case"ss":return e(t)?o+(n||i?"sekúndur":"sekúndum"):o+"sekúnda";case"m":return n?"mínúta":"mínútu";case"mm":return e(t)?o+(n||i?"mínútur":"mínútum"):n?o+"mínúta":o+"mínútu";case"hh":return e(t)?o+(n||i?"klukkustundir":"klukkustundum"):o+"klukkustund";case"d":return n?"dagur":i?"dag":"degi";case"dd":return e(t)?n?o+"dagar":o+(i?"daga":"dögum"):n?o+"dagur":o+(i?"dag":"degi");case"M":return n?"mánuður":i?"mánuð":"mánuði";case"MM":return e(t)?n?o+"mánuðir":o+(i?"mánuði":"mánuðum"):n?o+"mánuður":o+(i?"mánuð":"mánuði");case"y":return n||i?"ár":"ári";case"yy":return e(t)?o+(n||i?"ár":"árum"):o+(n||i?"ár":"ári")}}t.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:n,ss:n,m:n,mm:n,h:"klukkustund",hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},10150:function(t,e,n){!function(t){"use strict";t.defineLocale("it-ch",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){return 0===this.day()?"[la scorsa] dddd [alle] LT":"[lo scorso] dddd [alle] LT"},sameElse:"L"},relativeTime:{future:function(t){return(/^[0-9].+$/.test(t)?"tra":"in")+" "+t},past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},90626:function(t,e,n){!function(t){"use strict";t.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:function(){return"[Oggi a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextDay:function(){return"[Domani a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextWeek:function(){return"dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastDay:function(){return"[Ieri a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastWeek:function(){return 0===this.day()?"[La scorsa] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT":"[Lo scorso] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},sameElse:"L"},relativeTime:{future:"tra %s",past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",w:"una settimana",ww:"%d settimane",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},39183:function(t,e,n){!function(t){"use strict";t.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"令和",narrow:"㋿",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"平成",narrow:"㍻",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"昭和",narrow:"㍼",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"大正",narrow:"㍽",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"明治",narrow:"㍾",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"西暦",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"紀元前",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(元|\d+)年/,eraYearOrdinalParse:function(t,e){return"元"===e[1]?1:parseInt(e[1]||t,10)},months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日(ddd) HH:mm"},meridiemParse:/午前|午後/i,isPM:function(t){return"午後"===t},meridiem:function(t,e,n){return t<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:function(t){return t.week()!==this.week()?"[来週]dddd LT":"dddd LT"},lastDay:"[昨日] LT",lastWeek:function(t){return this.week()!==t.week()?"[先週]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}日/,ordinal:function(t,e){switch(e){case"y":return 1===t?"元年":t+"年";case"d":case"D":case"DDD":return t+"日";default:return t}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",ss:"%d秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}(n(30381))},24286:function(t,e,n){!function(t){"use strict";t.defineLocale("jv",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),weekdays:"Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),weekdaysShort:"Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/enjing|siyang|sonten|ndalu/,meridiemHour:function(t,e){return 12===t&&(t=0),"enjing"===e?t:"siyang"===e?t>=11?t:t+12:"sonten"===e||"ndalu"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"enjing":t<15?"siyang":t<19?"sonten":"ndalu"},calendar:{sameDay:"[Dinten puniko pukul] LT",nextDay:"[Mbenjang pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kala wingi pukul] LT",lastWeek:"dddd [kepengker pukul] LT",sameElse:"L"},relativeTime:{future:"wonten ing %s",past:"%s ingkang kepengker",s:"sawetawis detik",ss:"%d detik",m:"setunggal menit",mm:"%d menit",h:"setunggal jam",hh:"%d jam",d:"sedinten",dd:"%d dinten",M:"sewulan",MM:"%d wulan",y:"setaun",yy:"%d taun"},week:{dow:1,doy:7}})}(n(30381))},12105:function(t,e,n){!function(t){"use strict";t.defineLocale("ka",{months:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:{standalone:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),format:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),isFormat:/(წინა|შემდეგ)/},weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(t){return t.replace(/(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,(function(t,e,n){return"ი"===n?e+"ში":e+n+"ში"}))},past:function(t){return/(წამი|წუთი|საათი|დღე|თვე)/.test(t)?t.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(t)?t.replace(/წელი$/,"წლის წინ"):t},s:"რამდენიმე წამი",ss:"%d წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},dayOfMonthOrdinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(t){return 0===t?t:1===t?t+"-ლი":t<20||t<=100&&t%20==0||t%100==0?"მე-"+t:t+"-ე"},week:{dow:1,doy:7}})}(n(30381))},47772:function(t,e,n){!function(t){"use strict";var e={0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"};t.defineLocale("kk",{months:"қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан".split("_"),monthsShort:"қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел".split("_"),weekdays:"жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі".split("_"),weekdaysShort:"жек_дүй_сей_сәр_бей_жұм_сен".split("_"),weekdaysMin:"жк_дй_сй_ср_бй_жм_сн".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгін сағат] LT",nextDay:"[Ертең сағат] LT",nextWeek:"dddd [сағат] LT",lastDay:"[Кеше сағат] LT",lastWeek:"[Өткен аптаның] dddd [сағат] LT",sameElse:"L"},relativeTime:{future:"%s ішінде",past:"%s бұрын",s:"бірнеше секунд",ss:"%d секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(t){return t+(e[t]||e[t%10]||e[t>=100?100:null])},week:{dow:1,doy:7}})}(n(30381))},18758:function(t,e,n){!function(t){"use strict";var e={1:"១",2:"២",3:"៣",4:"៤",5:"៥",6:"៦",7:"៧",8:"៨",9:"៩",0:"០"},n={"១":"1","២":"2","៣":"3","៤":"4","៥":"5","៦":"6","៧":"7","៨":"8","៩":"9","០":"0"};t.defineLocale("km",{months:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysMin:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ព្រឹក|ល្ងាច/,isPM:function(t){return"ល្ងាច"===t},meridiem:function(t,e,n){return t<12?"ព្រឹក":"ល្ងាច"},calendar:{sameDay:"[ថ្ងៃនេះ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",ss:"%d វិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},dayOfMonthOrdinalParse:/ទី\d{1,2}/,ordinal:"ទី%d",preparse:function(t){return t.replace(/[១២៣៤៥៦៧៨៩០]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},week:{dow:1,doy:4}})}(n(30381))},79282:function(t,e,n){!function(t){"use strict";var e={1:"೧",2:"೨",3:"೩",4:"೪",5:"೫",6:"೬",7:"೭",8:"೮",9:"೯",0:"೦"},n={"೧":"1","೨":"2","೩":"3","೪":"4","೫":"5","೬":"6","೭":"7","೮":"8","೯":"9","೦":"0"};t.defineLocale("kn",{months:"ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್".split("_"),monthsShort:"ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ".split("_"),monthsParseExact:!0,weekdays:"ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ".split("_"),weekdaysShort:"ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ".split("_"),weekdaysMin:"ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[ಇಂದು] LT",nextDay:"[ನಾಳೆ] LT",nextWeek:"dddd, LT",lastDay:"[ನಿನ್ನೆ] LT",lastWeek:"[ಕೊನೆಯ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ನಂತರ",past:"%s ಹಿಂದೆ",s:"ಕೆಲವು ಕ್ಷಣಗಳು",ss:"%d ಸೆಕೆಂಡುಗಳು",m:"ಒಂದು ನಿಮಿಷ",mm:"%d ನಿಮಿಷ",h:"ಒಂದು ಗಂಟೆ",hh:"%d ಗಂಟೆ",d:"ಒಂದು ದಿನ",dd:"%d ದಿನ",M:"ಒಂದು ತಿಂಗಳು",MM:"%d ತಿಂಗಳು",y:"ಒಂದು ವರ್ಷ",yy:"%d ವರ್ಷ"},preparse:function(t){return t.replace(/[೧೨೩೪೫೬೭೮೯೦]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,meridiemHour:function(t,e){return 12===t&&(t=0),"ರಾತ್ರಿ"===e?t<4?t:t+12:"ಬೆಳಿಗ್ಗೆ"===e?t:"ಮಧ್ಯಾಹ್ನ"===e?t>=10?t:t+12:"ಸಂಜೆ"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"ರಾತ್ರಿ":t<10?"ಬೆಳಿಗ್ಗೆ":t<17?"ಮಧ್ಯಾಹ್ನ":t<20?"ಸಂಜೆ":"ರಾತ್ರಿ"},dayOfMonthOrdinalParse:/\d{1,2}(ನೇ)/,ordinal:function(t){return t+"ನೇ"},week:{dow:0,doy:6}})}(n(30381))},33730:function(t,e,n){!function(t){"use strict";t.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h:mm",LLLL:"YYYY년 MMMM D일 dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY년 MMMM D일",lll:"YYYY년 MMMM D일 A h:mm",llll:"YYYY년 MMMM D일 dddd A h:mm"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"1분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},dayOfMonthOrdinalParse:/\d{1,2}(일|월|주)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"일";case"M":return t+"월";case"w":case"W":return t+"주";default:return t}},meridiemParse:/오전|오후/,isPM:function(t){return"오후"===t},meridiem:function(t,e,n){return t<12?"오전":"오후"}})}(n(30381))},90563:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["çend sanîye","çend sanîyeyan"],ss:[t+" sanîye",t+" sanîyeyan"],m:["deqîqeyek","deqîqeyekê"],mm:[t+" deqîqe",t+" deqîqeyan"],h:["saetek","saetekê"],hh:[t+" saet",t+" saetan"],d:["rojek","rojekê"],dd:[t+" roj",t+" rojan"],w:["hefteyek","hefteyekê"],ww:[t+" hefte",t+" hefteyan"],M:["mehek","mehekê"],MM:[t+" meh",t+" mehan"],y:["salek","salekê"],yy:[t+" sal",t+" salan"]};return e?i[n][0]:i[n][1]}t.defineLocale("ku-kmr",{months:"Rêbendan_Sibat_Adar_Nîsan_Gulan_Hezîran_Tîrmeh_Tebax_Îlon_Cotmeh_Mijdar_Berfanbar".split("_"),monthsShort:"Rêb_Sib_Ada_Nîs_Gul_Hez_Tîr_Teb_Îlo_Cot_Mij_Ber".split("_"),monthsParseExact:!0,weekdays:"Yekşem_Duşem_Sêşem_Çarşem_Pêncşem_În_Şemî".split("_"),weekdaysShort:"Yek_Du_Sê_Çar_Pên_În_Şem".split("_"),weekdaysMin:"Ye_Du_Sê_Ça_Pê_În_Şe".split("_"),meridiem:function(t,e,n){return t<12?n?"bn":"BN":n?"pn":"PN"},meridiemParse:/bn|BN|pn|PN/,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"Do MMMM[a] YYYY[an]",LLL:"Do MMMM[a] YYYY[an] HH:mm",LLLL:"dddd, Do MMMM[a] YYYY[an] HH:mm",ll:"Do MMM[.] YYYY[an]",lll:"Do MMM[.] YYYY[an] HH:mm",llll:"ddd[.], Do MMM[.] YYYY[an] HH:mm"},calendar:{sameDay:"[Îro di saet] LT [de]",nextDay:"[Sibê di saet] LT [de]",nextWeek:"dddd [di saet] LT [de]",lastDay:"[Duh di saet] LT [de]",lastWeek:"dddd[a borî di saet] LT [de]",sameElse:"L"},relativeTime:{future:"di %s de",past:"berî %s",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,w:e,ww:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}(?:yê|ê|\.)/,ordinal:function(t,e){var n=e.toLowerCase();return n.includes("w")||n.includes("m")?t+".":t+function(t){var e=(t=""+t).substring(t.length-1),n=t.length>1?t.substring(t.length-2):"";return 12==n||13==n||"2"!=e&&"3"!=e&&"50"!=n&&"70"!=e&&"80"!=e?"ê":"yê"}(t)},week:{dow:1,doy:4}})}(n(30381))},1408:function(t,e,n){!function(t){"use strict";var e={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},r=["کانونی دووەم","شوبات","ئازار","نیسان","ئایار","حوزەیران","تەمموز","ئاب","ئەیلوول","تشرینی یەكەم","تشرینی دووەم","كانونی یەکەم"];t.defineLocale("ku",{months:r,monthsShort:r,weekdays:"یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌".split("_"),weekdaysShort:"یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌".split("_"),weekdaysMin:"ی_د_س_چ_پ_ه_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ئێواره‌|به‌یانی/,isPM:function(t){return/ئێواره‌/.test(t)},meridiem:function(t,e,n){return t<12?"به‌یانی":"ئێواره‌"},calendar:{sameDay:"[ئه‌مرۆ كاتژمێر] LT",nextDay:"[به‌یانی كاتژمێر] LT",nextWeek:"dddd [كاتژمێر] LT",lastDay:"[دوێنێ كاتژمێر] LT",lastWeek:"dddd [كاتژمێر] LT",sameElse:"L"},relativeTime:{future:"له‌ %s",past:"%s",s:"چه‌ند چركه‌یه‌ك",ss:"چركه‌ %d",m:"یه‌ك خوله‌ك",mm:"%d خوله‌ك",h:"یه‌ك كاتژمێر",hh:"%d كاتژمێر",d:"یه‌ك ڕۆژ",dd:"%d ڕۆژ",M:"یه‌ك مانگ",MM:"%d مانگ",y:"یه‌ك ساڵ",yy:"%d ساڵ"},preparse:function(t){return t.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(t){return n[t]})).replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n(30381))},33291:function(t,e,n){!function(t){"use strict";var e={0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"};t.defineLocale("ky",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),weekdays:"Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),weekdaysShort:"Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),weekdaysMin:"Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгүн саат] LT",nextDay:"[Эртең саат] LT",nextWeek:"dddd [саат] LT",lastDay:"[Кечээ саат] LT",lastWeek:"[Өткөн аптанын] dddd [күнү] [саат] LT",sameElse:"L"},relativeTime:{future:"%s ичинде",past:"%s мурун",s:"бирнече секунд",ss:"%d секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(t){return t+(e[t]||e[t%10]||e[t>=100?100:null])},week:{dow:1,doy:7}})}(n(30381))},36841:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return e?i[n][0]:i[n][1]}function n(t){if(t=parseInt(t,10),isNaN(t))return!1;if(t<0)return!0;if(t<10)return 4<=t&&t<=7;if(t<100){var e=t%10;return n(0===e?t/10:e)}if(t<1e4){for(;t>=10;)t/=10;return n(t)}return n(t/=1e3)}t.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:function(t){return n(t.substr(0,t.indexOf(" ")))?"a "+t:"an "+t},past:function(t){return n(t.substr(0,t.indexOf(" ")))?"viru "+t:"virun "+t},s:"e puer Sekonnen",ss:"%d Sekonnen",m:e,mm:"%d Minutten",h:e,hh:"%d Stonnen",d:e,dd:"%d Deeg",M:e,MM:"%d Méint",y:e,yy:"%d Joer"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},55466:function(t,e,n){!function(t){"use strict";t.defineLocale("lo",{months:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),monthsShort:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),weekdays:"ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysShort:"ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysMin:"ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"ວັນdddd D MMMM YYYY HH:mm"},meridiemParse:/ຕອນເຊົ້າ|ຕອນແລງ/,isPM:function(t){return"ຕອນແລງ"===t},meridiem:function(t,e,n){return t<12?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",ss:"%d ວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},dayOfMonthOrdinalParse:/(ທີ່)\d{1,2}/,ordinal:function(t){return"ທີ່"+t}})}(n(30381))},57010:function(t,e,n){!function(t){"use strict";var e={ss:"sekundė_sekundžių_sekundes",m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"};function n(t,e,n,r){return e?i(n)[0]:r?i(n)[1]:i(n)[2]}function r(t){return t%10==0||t>10&&t<20}function i(t){return e[t].split("_")}function o(t,e,o,s){var a=t+" ";return 1===t?a+n(0,e,o[0],s):e?a+(r(t)?i(o)[1]:i(o)[0]):s?a+i(o)[1]:a+(r(t)?i(o)[1]:i(o)[2])}t.defineLocale("lt",{months:{format:"sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),standalone:"sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis".split("_"),isFormat:/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/},monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:{format:"sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį".split("_"),standalone:"sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_"),isFormat:/dddd HH:mm/},weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], HH:mm [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], HH:mm [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:function(t,e,n,r){return e?"kelios sekundės":r?"kelių sekundžių":"kelias sekundes"},ss:o,m:n,mm:o,h:n,hh:o,d:n,dd:o,M:n,MM:o,y:n,yy:o},dayOfMonthOrdinalParse:/\d{1,2}-oji/,ordinal:function(t){return t+"-oji"},week:{dow:1,doy:4}})}(n(30381))},37595:function(t,e,n){!function(t){"use strict";var e={ss:"sekundes_sekundēm_sekunde_sekundes".split("_"),m:"minūtes_minūtēm_minūte_minūtes".split("_"),mm:"minūtes_minūtēm_minūte_minūtes".split("_"),h:"stundas_stundām_stunda_stundas".split("_"),hh:"stundas_stundām_stunda_stundas".split("_"),d:"dienas_dienām_diena_dienas".split("_"),dd:"dienas_dienām_diena_dienas".split("_"),M:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),MM:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")};function n(t,e,n){return n?e%10==1&&e%100!=11?t[2]:t[3]:e%10==1&&e%100!=11?t[0]:t[1]}function r(t,r,i){return t+" "+n(e[i],t,r)}function i(t,r,i){return n(e[i],t,r)}t.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"pēc %s",past:"pirms %s",s:function(t,e){return e?"dažas sekundes":"dažām sekundēm"},ss:r,m:i,mm:r,h:i,hh:r,d:i,dd:r,M:i,MM:r,y:i,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},39861:function(t,e,n){!function(t){"use strict";var e={words:{ss:["sekund","sekunda","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mjesec","mjeseca","mjeseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(t,e){return 1===t?e[0]:t>=2&&t<=4?e[1]:e[2]},translate:function(t,n,r){var i=e.words[r];return 1===r.length?n?i[0]:i[1]:t+" "+e.correctGrammaticalCase(t,i)}};t.defineLocale("me",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sjutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedjelje] [u] LT","[prošlog] [ponedjeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srijede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:"dan",dd:e.translate,M:"mjesec",MM:e.translate,y:"godinu",yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},35493:function(t,e,n){!function(t){"use strict";t.defineLocale("mi",{months:"Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea".split("_"),monthsShort:"Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki".split("_"),monthsRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,weekdays:"Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei".split("_"),weekdaysShort:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),weekdaysMin:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [i] HH:mm",LLLL:"dddd, D MMMM YYYY [i] HH:mm"},calendar:{sameDay:"[i teie mahana, i] LT",nextDay:"[apopo i] LT",nextWeek:"dddd [i] LT",lastDay:"[inanahi i] LT",lastWeek:"dddd [whakamutunga i] LT",sameElse:"L"},relativeTime:{future:"i roto i %s",past:"%s i mua",s:"te hēkona ruarua",ss:"%d hēkona",m:"he meneti",mm:"%d meneti",h:"te haora",hh:"%d haora",d:"he ra",dd:"%d ra",M:"he marama",MM:"%d marama",y:"he tau",yy:"%d tau"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},95966:function(t,e,n){!function(t){"use strict";t.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"[Во] dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"за %s",past:"пред %s",s:"неколку секунди",ss:"%d секунди",m:"една минута",mm:"%d минути",h:"еден час",hh:"%d часа",d:"еден ден",dd:"%d дена",M:"еден месец",MM:"%d месеци",y:"една година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(t){var e=t%10,n=t%100;return 0===t?t+"-ев":0===n?t+"-ен":n>10&&n<20?t+"-ти":1===e?t+"-ви":2===e?t+"-ри":7===e||8===e?t+"-ми":t+"-ти"},week:{dow:1,doy:7}})}(n(30381))},87341:function(t,e,n){!function(t){"use strict";t.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),monthsParseExact:!0,weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",LTS:"A h:mm:ss -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm -നു",LLLL:"dddd, D MMMM YYYY, A h:mm -നു"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",ss:"%d സെക്കൻഡ്",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(t,e){return 12===t&&(t=0),"രാത്രി"===e&&t>=4||"ഉച്ച കഴിഞ്ഞ്"===e||"വൈകുന്നേരം"===e?t+12:t},meridiem:function(t,e,n){return t<4?"രാത്രി":t<12?"രാവിലെ":t<17?"ഉച്ച കഴിഞ്ഞ്":t<20?"വൈകുന്നേരം":"രാത്രി"}})}(n(30381))},5115:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){switch(n){case"s":return e?"хэдхэн секунд":"хэдхэн секундын";case"ss":return t+(e?" секунд":" секундын");case"m":case"mm":return t+(e?" минут":" минутын");case"h":case"hh":return t+(e?" цаг":" цагийн");case"d":case"dd":return t+(e?" өдөр":" өдрийн");case"M":case"MM":return t+(e?" сар":" сарын");case"y":case"yy":return t+(e?" жил":" жилийн");default:return t}}t.defineLocale("mn",{months:"Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар".split("_"),monthsShort:"1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар".split("_"),monthsParseExact:!0,weekdays:"Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба".split("_"),weekdaysShort:"Ням_Дав_Мяг_Лха_Пүр_Баа_Бям".split("_"),weekdaysMin:"Ня_Да_Мя_Лх_Пү_Ба_Бя".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY оны MMMMын D",LLL:"YYYY оны MMMMын D HH:mm",LLLL:"dddd, YYYY оны MMMMын D HH:mm"},meridiemParse:/ҮӨ|ҮХ/i,isPM:function(t){return"ҮХ"===t},meridiem:function(t,e,n){return t<12?"ҮӨ":"ҮХ"},calendar:{sameDay:"[Өнөөдөр] LT",nextDay:"[Маргааш] LT",nextWeek:"[Ирэх] dddd LT",lastDay:"[Өчигдөр] LT",lastWeek:"[Өнгөрсөн] dddd LT",sameElse:"L"},relativeTime:{future:"%s дараа",past:"%s өмнө",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2} өдөр/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+" өдөр";default:return t}}})}(n(30381))},10370:function(t,e,n){!function(t){"use strict";var e={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};function r(t,e,n,r){var i="";if(e)switch(n){case"s":i="काही सेकंद";break;case"ss":i="%d सेकंद";break;case"m":i="एक मिनिट";break;case"mm":i="%d मिनिटे";break;case"h":i="एक तास";break;case"hh":i="%d तास";break;case"d":i="एक दिवस";break;case"dd":i="%d दिवस";break;case"M":i="एक महिना";break;case"MM":i="%d महिने";break;case"y":i="एक वर्ष";break;case"yy":i="%d वर्षे"}else switch(n){case"s":i="काही सेकंदां";break;case"ss":i="%d सेकंदां";break;case"m":i="एका मिनिटा";break;case"mm":i="%d मिनिटां";break;case"h":i="एका तासा";break;case"hh":i="%d तासां";break;case"d":i="एका दिवसा";break;case"dd":i="%d दिवसां";break;case"M":i="एका महिन्या";break;case"MM":i="%d महिन्यां";break;case"y":i="एका वर्षा";break;case"yy":i="%d वर्षां"}return i.replace(/%d/i,t)}t.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",LTS:"A h:mm:ss वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm वाजता",LLLL:"dddd, D MMMM YYYY, A h:mm वाजता"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%sमध्ये",past:"%sपूर्वी",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},preparse:function(t){return t.replace(/[१२३४५६७८९०]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/,meridiemHour:function(t,e){return 12===t&&(t=0),"पहाटे"===e||"सकाळी"===e?t:"दुपारी"===e||"सायंकाळी"===e||"रात्री"===e?t>=12?t:t+12:void 0},meridiem:function(t,e,n){return t>=0&&t<6?"पहाटे":t<12?"सकाळी":t<17?"दुपारी":t<20?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}})}(n(30381))},41237:function(t,e,n){!function(t){"use strict";t.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"tengahari"===e?t>=11?t:t+12:"petang"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"tengahari":t<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n(30381))},9847:function(t,e,n){!function(t){"use strict";t.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"tengahari"===e?t>=11?t:t+12:"petang"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"tengahari":t<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n(30381))},72126:function(t,e,n){!function(t){"use strict";t.defineLocale("mt",{months:"Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru".split("_"),monthsShort:"Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ".split("_"),weekdays:"Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt".split("_"),weekdaysShort:"Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib".split("_"),weekdaysMin:"Ħa_Tn_Tl_Er_Ħa_Ġi_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Illum fil-]LT",nextDay:"[Għada fil-]LT",nextWeek:"dddd [fil-]LT",lastDay:"[Il-bieraħ fil-]LT",lastWeek:"dddd [li għadda] [fil-]LT",sameElse:"L"},relativeTime:{future:"f’ %s",past:"%s ilu",s:"ftit sekondi",ss:"%d sekondi",m:"minuta",mm:"%d minuti",h:"siegħa",hh:"%d siegħat",d:"ġurnata",dd:"%d ġranet",M:"xahar",MM:"%d xhur",y:"sena",yy:"%d sni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},56165:function(t,e,n){!function(t){"use strict";var e={1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"},n={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"};t.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",ss:"%d စက္ကန့်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(t){return t.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},week:{dow:1,doy:4}})}(n(30381))},64924:function(t,e,n){!function(t){"use strict";t.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",ss:"%d sekunder",m:"ett minutt",mm:"%d minutter",h:"én time",hh:"%d timer",d:"én dag",dd:"%d dager",w:"én uke",ww:"%d uker",M:"én måned",MM:"%d måneder",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},16744:function(t,e,n){!function(t){"use strict";var e={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};t.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),monthsParseExact:!0,weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आ._सो._मं._बु._बि._शु._श.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"Aको h:mm बजे",LTS:"Aको h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, Aको h:mm बजे",LLLL:"dddd, D MMMM YYYY, Aको h:mm बजे"},preparse:function(t){return t.replace(/[१२३४५६७८९०]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(t,e){return 12===t&&(t=0),"राति"===e?t<4?t:t+12:"बिहान"===e?t:"दिउँसो"===e?t>=10?t:t+12:"साँझ"===e?t+12:void 0},meridiem:function(t,e,n){return t<3?"राति":t<12?"बिहान":t<16?"दिउँसो":t<20?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडि",s:"केही क्षण",ss:"%d सेकेण्ड",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:0,doy:6}})}(n(30381))},59814:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),r=[/^jan/i,/^feb/i,/^(maart|mrt\.?)$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],i=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;t.defineLocale("nl-be",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},93901:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),r=[/^jan/i,/^feb/i,/^(maart|mrt\.?)$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],i=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;t.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",w:"één week",ww:"%d weken",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},83877:function(t,e,n){!function(t){"use strict";t.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"su._må._ty._on._to._fr._lau.".split("_"),weekdaysMin:"su_må_ty_on_to_fr_la".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",ss:"%d sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",w:"ei veke",ww:"%d veker",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},92135:function(t,e,n){!function(t){"use strict";t.defineLocale("oc-lnc",{months:{standalone:"genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre".split("_"),format:"de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dm._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dm_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:"[uèi a] LT",nextDay:"[deman a] LT",nextWeek:"dddd [a] LT",lastDay:"[ièr a] LT",lastWeek:"dddd [passat a] LT",sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"unas segondas",ss:"%d segondas",m:"una minuta",mm:"%d minutas",h:"una ora",hh:"%d oras",d:"un jorn",dd:"%d jorns",M:"un mes",MM:"%d meses",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(t,e){var n=1===t?"r":2===t?"n":3===t?"r":4===t?"t":"è";return"w"!==e&&"W"!==e||(n="a"),t+n},week:{dow:1,doy:4}})}(n(30381))},15858:function(t,e,n){!function(t){"use strict";var e={1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"},n={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"};t.defineLocale("pa-in",{months:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),monthsShort:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),weekdays:"ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ".split("_"),weekdaysShort:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),weekdaysMin:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),longDateFormat:{LT:"A h:mm ਵਜੇ",LTS:"A h:mm:ss ਵਜੇ",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm ਵਜੇ",LLLL:"dddd, D MMMM YYYY, A h:mm ਵਜੇ"},calendar:{sameDay:"[ਅਜ] LT",nextDay:"[ਕਲ] LT",nextWeek:"[ਅਗਲਾ] dddd, LT",lastDay:"[ਕਲ] LT",lastWeek:"[ਪਿਛਲੇ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ਵਿੱਚ",past:"%s ਪਿਛਲੇ",s:"ਕੁਝ ਸਕਿੰਟ",ss:"%d ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(t){return t.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(t,e){return 12===t&&(t=0),"ਰਾਤ"===e?t<4?t:t+12:"ਸਵੇਰ"===e?t:"ਦੁਪਹਿਰ"===e?t>=10?t:t+12:"ਸ਼ਾਮ"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"ਰਾਤ":t<10?"ਸਵੇਰ":t<17?"ਦੁਪਹਿਰ":t<20?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}})}(n(30381))},64495:function(t,e,n){!function(t){"use strict";var e="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),n="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),r=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^paź/i,/^lis/i,/^gru/i];function i(t){return t%10<5&&t%10>1&&~~(t/10)%10!=1}function o(t,e,n){var r=t+" ";switch(n){case"ss":return r+(i(t)?"sekundy":"sekund");case"m":return e?"minuta":"minutę";case"mm":return r+(i(t)?"minuty":"minut");case"h":return e?"godzina":"godzinę";case"hh":return r+(i(t)?"godziny":"godzin");case"ww":return r+(i(t)?"tygodnie":"tygodni");case"MM":return r+(i(t)?"miesiące":"miesięcy");case"yy":return r+(i(t)?"lata":"lat")}}t.defineLocale("pl",{months:function(t,r){return t?/D MMMM/.test(r)?n[t.month()]:e[t.month()]:e},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_śr_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedzielę o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W środę o] LT";case 6:return"[W sobotę o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:o,m:o,mm:o,h:o,hh:o,d:"1 dzień",dd:"%d dni",w:"tydzień",ww:o,M:"miesiąc",MM:o,y:"rok",yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},57971:function(t,e,n){!function(t){"use strict";t.defineLocale("pt-br",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"do_2ª_3ª_4ª_5ª_6ª_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"poucos segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",invalidDate:"Data inválida"})}(n(30381))},89520:function(t,e,n){!function(t){"use strict";t.defineLocale("pt",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",w:"uma semana",ww:"%d semanas",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},96459:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=" ";return(t%100>=20||t>=100&&t%100==0)&&(r=" de "),t+r+{ss:"secunde",mm:"minute",hh:"ore",dd:"zile",ww:"săptămâni",MM:"luni",yy:"ani"}[n]}t.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",ss:e,m:"un minut",mm:e,h:"o oră",hh:e,d:"o zi",dd:e,w:"o săptămână",ww:e,M:"o lună",MM:e,y:"un an",yy:e},week:{dow:1,doy:7}})}(n(30381))},21793:function(t,e,n){!function(t){"use strict";function e(t,e,n){return"m"===n?e?"минута":"минуту":t+" "+(r=+t,i={ss:e?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:e?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",ww:"неделя_недели_недель",MM:"месяц_месяца_месяцев",yy:"год_года_лет"}[n].split("_"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2]);var r,i}var n=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i];t.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:n,longMonthsParse:n,shortMonthsParse:n,monthsRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsShortRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsStrictRegex:/^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,monthsShortStrictRegex:/^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},calendar:{sameDay:"[Сегодня, в] LT",nextDay:"[Завтра, в] LT",lastDay:"[Вчера, в] LT",nextWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В следующее] dddd, [в] LT";case 1:case 2:case 4:return"[В следующий] dddd, [в] LT";case 3:case 5:case 6:return"[В следующую] dddd, [в] LT"}},lastWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd, [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd, [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd, [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",ss:e,m:e,mm:e,h:"час",hh:e,d:"день",dd:e,w:"неделя",ww:e,M:"месяц",MM:e,y:"год",yy:e},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(t){return/^(дня|вечера)$/.test(t)},meridiem:function(t,e,n){return t<4?"ночи":t<12?"утра":t<17?"дня":"вечера"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":return t+"-й";case"D":return t+"-го";case"w":case"W":return t+"-я";default:return t}},week:{dow:1,doy:4}})}(n(30381))},40950:function(t,e,n){!function(t){"use strict";var e=["جنوري","فيبروري","مارچ","اپريل","مئي","جون","جولاءِ","آگسٽ","سيپٽمبر","آڪٽوبر","نومبر","ڊسمبر"],n=["آچر","سومر","اڱارو","اربع","خميس","جمع","ڇنڇر"];t.defineLocale("sd",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(t){return"شام"===t},meridiem:function(t,e,n){return t<12?"صبح":"شام"},calendar:{sameDay:"[اڄ] LT",nextDay:"[سڀاڻي] LT",nextWeek:"dddd [اڳين هفتي تي] LT",lastDay:"[ڪالهه] LT",lastWeek:"[گزريل هفتي] dddd [تي] LT",sameElse:"L"},relativeTime:{future:"%s پوء",past:"%s اڳ",s:"چند سيڪنڊ",ss:"%d سيڪنڊ",m:"هڪ منٽ",mm:"%d منٽ",h:"هڪ ڪلاڪ",hh:"%d ڪلاڪ",d:"هڪ ڏينهن",dd:"%d ڏينهن",M:"هڪ مهينو",MM:"%d مهينا",y:"هڪ سال",yy:"%d سال"},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n(30381))},10490:function(t,e,n){!function(t){"use strict";t.defineLocale("se",{months:"ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu".split("_"),monthsShort:"ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov".split("_"),weekdays:"sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat".split("_"),weekdaysShort:"sotn_vuos_maŋ_gask_duor_bear_láv".split("_"),weekdaysMin:"s_v_m_g_d_b_L".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"MMMM D. [b.] YYYY",LLL:"MMMM D. [b.] YYYY [ti.] HH:mm",LLLL:"dddd, MMMM D. [b.] YYYY [ti.] HH:mm"},calendar:{sameDay:"[otne ti] LT",nextDay:"[ihttin ti] LT",nextWeek:"dddd [ti] LT",lastDay:"[ikte ti] LT",lastWeek:"[ovddit] dddd [ti] LT",sameElse:"L"},relativeTime:{future:"%s geažes",past:"maŋit %s",s:"moadde sekunddat",ss:"%d sekunddat",m:"okta minuhta",mm:"%d minuhtat",h:"okta diimmu",hh:"%d diimmut",d:"okta beaivi",dd:"%d beaivvit",M:"okta mánnu",MM:"%d mánut",y:"okta jahki",yy:"%d jagit"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},90124:function(t,e,n){!function(t){"use strict";t.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),weekdays:"ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),weekdaysShort:"ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන".split("_"),weekdaysMin:"ඉ_ස_අ_බ_බ්‍ර_සි_සෙ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"a h:mm",LTS:"a h:mm:ss",L:"YYYY/MM/DD",LL:"YYYY MMMM D",LLL:"YYYY MMMM D, a h:mm",LLLL:"YYYY MMMM D [වැනි] dddd, a h:mm:ss"},calendar:{sameDay:"[අද] LT[ට]",nextDay:"[හෙට] LT[ට]",nextWeek:"dddd LT[ට]",lastDay:"[ඊයේ] LT[ට]",lastWeek:"[පසුගිය] dddd LT[ට]",sameElse:"L"},relativeTime:{future:"%sකින්",past:"%sකට පෙර",s:"තත්පර කිහිපය",ss:"තත්පර %d",m:"මිනිත්තුව",mm:"මිනිත්තු %d",h:"පැය",hh:"පැය %d",d:"දිනය",dd:"දින %d",M:"මාසය",MM:"මාස %d",y:"වසර",yy:"වසර %d"},dayOfMonthOrdinalParse:/\d{1,2} වැනි/,ordinal:function(t){return t+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(t){return"ප.ව."===t||"පස් වරු"===t},meridiem:function(t,e,n){return t>11?n?"ප.ව.":"පස් වරු":n?"පෙ.ව.":"පෙර වරු"}})}(n(30381))},64249:function(t,e,n){!function(t){"use strict";var e="január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),n="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");function r(t){return t>1&&t<5}function i(t,e,n,i){var o=t+" ";switch(n){case"s":return e||i?"pár sekúnd":"pár sekundami";case"ss":return e||i?o+(r(t)?"sekundy":"sekúnd"):o+"sekundami";case"m":return e?"minúta":i?"minútu":"minútou";case"mm":return e||i?o+(r(t)?"minúty":"minút"):o+"minútami";case"h":return e?"hodina":i?"hodinu":"hodinou";case"hh":return e||i?o+(r(t)?"hodiny":"hodín"):o+"hodinami";case"d":return e||i?"deň":"dňom";case"dd":return e||i?o+(r(t)?"dni":"dní"):o+"dňami";case"M":return e||i?"mesiac":"mesiacom";case"MM":return e||i?o+(r(t)?"mesiace":"mesiacov"):o+"mesiacmi";case"y":return e||i?"rok":"rokom";case"yy":return e||i?o+(r(t)?"roky":"rokov"):o+"rokmi"}}t.defineLocale("sk",{months:e,monthsShort:n,weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:case 4:case 5:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:i,ss:i,m:i,mm:i,h:i,hh:i,d:i,dd:i,M:i,MM:i,y:i,yy:i},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},14985:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i=t+" ";switch(n){case"s":return e||r?"nekaj sekund":"nekaj sekundami";case"ss":return i+(1===t?e?"sekundo":"sekundi":2===t?e||r?"sekundi":"sekundah":t<5?e||r?"sekunde":"sekundah":"sekund");case"m":return e?"ena minuta":"eno minuto";case"mm":return i+(1===t?e?"minuta":"minuto":2===t?e||r?"minuti":"minutama":t<5?e||r?"minute":"minutami":e||r?"minut":"minutami");case"h":return e?"ena ura":"eno uro";case"hh":return i+(1===t?e?"ura":"uro":2===t?e||r?"uri":"urama":t<5?e||r?"ure":"urami":e||r?"ur":"urami");case"d":return e||r?"en dan":"enim dnem";case"dd":return i+(1===t?e||r?"dan":"dnem":2===t?e||r?"dni":"dnevoma":e||r?"dni":"dnevi");case"M":return e||r?"en mesec":"enim mesecem";case"MM":return i+(1===t?e||r?"mesec":"mesecem":2===t?e||r?"meseca":"mesecema":t<5?e||r?"mesece":"meseci":e||r?"mesecev":"meseci");case"y":return e||r?"eno leto":"enim letom";case"yy":return i+(1===t?e||r?"leto":"letom":2===t?e||r?"leti":"letoma":t<5?e||r?"leta":"leti":e||r?"let":"leti")}}t.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prejšnjo] [nedeljo] [ob] LT";case 3:return"[prejšnjo] [sredo] [ob] LT";case 6:return"[prejšnjo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"pred %s",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},51104:function(t,e,n){!function(t){"use strict";t.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),weekdaysParseExact:!0,meridiemParse:/PD|MD/,isPM:function(t){return"M"===t.charAt(0)},meridiem:function(t,e,n){return t<12?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",ss:"%d sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},79915:function(t,e,n){!function(t){"use strict";var e={words:{ss:["секунда","секунде","секунди"],m:["један минут","једног минута"],mm:["минут","минута","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],d:["један дан","једног дана"],dd:["дан","дана","дана"],M:["један месец","једног месеца"],MM:["месец","месеца","месеци"],y:["једну годину","једне године"],yy:["годину","године","година"]},correctGrammaticalCase:function(t,e){return t%10>=1&&t%10<=4&&(t%100<10||t%100>=20)?t%10==1?e[0]:e[1]:e[2]},translate:function(t,n,r,i){var o,s=e.words[r];return 1===r.length?"y"===r&&n?"једна година":i||n?s[0]:s[1]:(o=e.correctGrammaticalCase(t,s),"yy"===r&&n&&"годину"===o?t+" година":t+" "+o)}};t.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){return["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:e.translate,dd:e.translate,M:e.translate,MM:e.translate,y:e.translate,yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},49131:function(t,e,n){!function(t){"use strict";var e={words:{ss:["sekunda","sekunde","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],d:["jedan dan","jednog dana"],dd:["dan","dana","dana"],M:["jedan mesec","jednog meseca"],MM:["mesec","meseca","meseci"],y:["jednu godinu","jedne godine"],yy:["godinu","godine","godina"]},correctGrammaticalCase:function(t,e){return t%10>=1&&t%10<=4&&(t%100<10||t%100>=20)?t%10==1?e[0]:e[1]:e[2]},translate:function(t,n,r,i){var o,s=e.words[r];return 1===r.length?"y"===r&&n?"jedna godina":i||n?s[0]:s[1]:(o=e.correctGrammaticalCase(t,s),"yy"===r&&n&&"godinu"===o?t+" godina":t+" "+o)}};t.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:e.translate,dd:e.translate,M:e.translate,MM:e.translate,y:e.translate,yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},85893:function(t,e,n){!function(t){"use strict";t.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",ss:"%d mzuzwana",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(t,e,n){return t<11?"ekuseni":t<15?"emini":t<19?"entsambama":"ebusuku"},meridiemHour:function(t,e){return 12===t&&(t=0),"ekuseni"===e?t:"emini"===e?t>=11?t:t+12:"entsambama"===e||"ebusuku"===e?0===t?0:t+12:void 0},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}})}(n(30381))},98760:function(t,e,n){!function(t){"use strict";t.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",ss:"%d sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}(\:e|\:a)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?":e":1===e||2===e?":a":":e")},week:{dow:1,doy:4}})}(n(30381))},91172:function(t,e,n){!function(t){"use strict";t.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"hh:mm A",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",ss:"sekunde %d",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"siku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}})}(n(30381))},27333:function(t,e,n){!function(t){"use strict";var e={1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"},n={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"};t.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",ss:"%d விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},dayOfMonthOrdinalParse:/\d{1,2}வது/,ordinal:function(t){return t+"வது"},preparse:function(t){return t.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(t,e,n){return t<2?" யாமம்":t<6?" வைகறை":t<10?" காலை":t<14?" நண்பகல்":t<18?" எற்பாடு":t<22?" மாலை":" யாமம்"},meridiemHour:function(t,e){return 12===t&&(t=0),"யாமம்"===e?t<2?t:t+12:"வைகறை"===e||"காலை"===e||"நண்பகல்"===e&&t>=10?t:t+12},week:{dow:0,doy:6}})}(n(30381))},23110:function(t,e,n){!function(t){"use strict";t.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,weekdays:"ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),weekdaysShort:"ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),weekdaysMin:"ఆ_సో_మం_బు_గు_శు_శ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[నేడు] LT",nextDay:"[రేపు] LT",nextWeek:"dddd, LT",lastDay:"[నిన్న] LT",lastWeek:"[గత] dddd, LT",sameElse:"L"},relativeTime:{future:"%s లో",past:"%s క్రితం",s:"కొన్ని క్షణాలు",ss:"%d సెకన్లు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},dayOfMonthOrdinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(t,e){return 12===t&&(t=0),"రాత్రి"===e?t<4?t:t+12:"ఉదయం"===e?t:"మధ్యాహ్నం"===e?t>=10?t:t+12:"సాయంత్రం"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"రాత్రి":t<10?"ఉదయం":t<17?"మధ్యాహ్నం":t<20?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}})}(n(30381))},52095:function(t,e,n){!function(t){"use strict";t.defineLocale("tet",{months:"Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu".split("_"),weekdaysShort:"Dom_Seg_Ters_Kua_Kint_Sest_Sab".split("_"),weekdaysMin:"Do_Seg_Te_Ku_Ki_Ses_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Ohin iha] LT",nextDay:"[Aban iha] LT",nextWeek:"dddd [iha] LT",lastDay:"[Horiseik iha] LT",lastWeek:"dddd [semana kotuk] [iha] LT",sameElse:"L"},relativeTime:{future:"iha %s",past:"%s liuba",s:"segundu balun",ss:"segundu %d",m:"minutu ida",mm:"minutu %d",h:"oras ida",hh:"oras %d",d:"loron ida",dd:"loron %d",M:"fulan ida",MM:"fulan %d",y:"tinan ida",yy:"tinan %d"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},27321:function(t,e,n){!function(t){"use strict";var e={0:"-ум",1:"-ум",2:"-юм",3:"-юм",4:"-ум",5:"-ум",6:"-ум",7:"-ум",8:"-ум",9:"-ум",10:"-ум",12:"-ум",13:"-ум",20:"-ум",30:"-юм",40:"-ум",50:"-ум",60:"-ум",70:"-ум",80:"-ум",90:"-ум",100:"-ум"};t.defineLocale("tg",{months:{format:"январи_феврали_марти_апрели_майи_июни_июли_августи_сентябри_октябри_ноябри_декабри".split("_"),standalone:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_")},monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе".split("_"),weekdaysShort:"яшб_дшб_сшб_чшб_пшб_ҷум_шнб".split("_"),weekdaysMin:"яш_дш_сш_чш_пш_ҷм_шб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Имрӯз соати] LT",nextDay:"[Фардо соати] LT",lastDay:"[Дирӯз соати] LT",nextWeek:"dddd[и] [ҳафтаи оянда соати] LT",lastWeek:"dddd[и] [ҳафтаи гузашта соати] LT",sameElse:"L"},relativeTime:{future:"баъди %s",past:"%s пеш",s:"якчанд сония",m:"як дақиқа",mm:"%d дақиқа",h:"як соат",hh:"%d соат",d:"як рӯз",dd:"%d рӯз",M:"як моҳ",MM:"%d моҳ",y:"як сол",yy:"%d сол"},meridiemParse:/шаб|субҳ|рӯз|бегоҳ/,meridiemHour:function(t,e){return 12===t&&(t=0),"шаб"===e?t<4?t:t+12:"субҳ"===e?t:"рӯз"===e?t>=11?t:t+12:"бегоҳ"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"шаб":t<11?"субҳ":t<16?"рӯз":t<19?"бегоҳ":"шаб"},dayOfMonthOrdinalParse:/\d{1,2}-(ум|юм)/,ordinal:function(t){return t+(e[t]||e[t%10]||e[t>=100?100:null])},week:{dow:1,doy:7}})}(n(30381))},9041:function(t,e,n){!function(t){"use strict";t.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.".split("_"),monthsParseExact:!0,weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H:mm",LLLL:"วันddddที่ D MMMM YYYY เวลา H:mm"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(t){return"หลังเที่ยง"===t},meridiem:function(t,e,n){return t<12?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",ss:"%d วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",w:"1 สัปดาห์",ww:"%d สัปดาห์",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}})}(n(30381))},19005:function(t,e,n){!function(t){"use strict";var e={1:"'inji",5:"'inji",8:"'inji",70:"'inji",80:"'inji",2:"'nji",7:"'nji",20:"'nji",50:"'nji",3:"'ünji",4:"'ünji",100:"'ünji",6:"'njy",9:"'unjy",10:"'unjy",30:"'unjy",60:"'ynjy",90:"'ynjy"};t.defineLocale("tk",{months:"Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr".split("_"),monthsShort:"Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek".split("_"),weekdays:"Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe".split("_"),weekdaysShort:"Ýek_Duş_Siş_Çar_Pen_Ann_Şen".split("_"),weekdaysMin:"Ýk_Dş_Sş_Çr_Pn_An_Şn".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün sagat] LT",nextDay:"[ertir sagat] LT",nextWeek:"[indiki] dddd [sagat] LT",lastDay:"[düýn] LT",lastWeek:"[geçen] dddd [sagat] LT",sameElse:"L"},relativeTime:{future:"%s soň",past:"%s öň",s:"birnäçe sekunt",m:"bir minut",mm:"%d minut",h:"bir sagat",hh:"%d sagat",d:"bir gün",dd:"%d gün",M:"bir aý",MM:"%d aý",y:"bir ýyl",yy:"%d ýyl"},ordinal:function(t,n){switch(n){case"d":case"D":case"Do":case"DD":return t;default:if(0===t)return t+"'unjy";var r=t%10;return t+(e[r]||e[t%100-r]||e[t>=100?100:null])}},week:{dow:1,doy:7}})}(n(30381))},75768:function(t,e,n){!function(t){"use strict";t.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},89444:function(t,e,n){!function(t){"use strict";var e="pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_");function n(t,n,r,i){var o=function(t){var n=Math.floor(t%1e3/100),r=Math.floor(t%100/10),i=t%10,o="";return n>0&&(o+=e[n]+"vatlh"),r>0&&(o+=(""!==o?" ":"")+e[r]+"maH"),i>0&&(o+=(""!==o?" ":"")+e[i]),""===o?"pagh":o}(t);switch(r){case"ss":return o+" lup";case"mm":return o+" tup";case"hh":return o+" rep";case"dd":return o+" jaj";case"MM":return o+" jar";case"yy":return o+" DIS"}}t.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:function(t){var e=t;return-1!==t.indexOf("jaj")?e.slice(0,-3)+"leS":-1!==t.indexOf("jar")?e.slice(0,-3)+"waQ":-1!==t.indexOf("DIS")?e.slice(0,-3)+"nem":e+" pIq"},past:function(t){var e=t;return-1!==t.indexOf("jaj")?e.slice(0,-3)+"Hu’":-1!==t.indexOf("jar")?e.slice(0,-3)+"wen":-1!==t.indexOf("DIS")?e.slice(0,-3)+"ben":e+" ret"},s:"puS lup",ss:n,m:"wa’ tup",mm:n,h:"wa’ rep",hh:n,d:"wa’ jaj",dd:n,M:"wa’ jar",MM:n,y:"wa’ DIS",yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},72397:function(t,e,n){!function(t){"use strict";var e={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"};t.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pzt_Sal_Çar_Per_Cum_Cmt".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),meridiem:function(t,e,n){return t<12?n?"öö":"ÖÖ":n?"ös":"ÖS"},meridiemParse:/öö|ÖÖ|ös|ÖS/,isPM:function(t){return"ös"===t||"ÖS"===t},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[gelecek] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",ss:"%d saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",w:"bir hafta",ww:"%d hafta",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(t,n){switch(n){case"d":case"D":case"Do":case"DD":return t;default:if(0===t)return t+"'ıncı";var r=t%10;return t+(e[r]||e[t%100-r]||e[t>=100?100:null])}},week:{dow:1,doy:7}})}(n(30381))},28254:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["viensas secunds","'iensas secunds"],ss:[t+" secunds",t+" secunds"],m:["'n míut","'iens míut"],mm:[t+" míuts",t+" míuts"],h:["'n þora","'iensa þora"],hh:[t+" þoras",t+" þoras"],d:["'n ziua","'iensa ziua"],dd:[t+" ziuas",t+" ziuas"],M:["'n mes","'iens mes"],MM:[t+" mesen",t+" mesen"],y:["'n ar","'iens ar"],yy:[t+" ars",t+" ars"]};return r||e?i[n][0]:i[n][1]}t.defineLocale("tzl",{months:"Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),weekdaysShort:"Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),weekdaysMin:"Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(t){return"d'o"===t.toLowerCase()},meridiem:function(t,e,n){return t>11?n?"d'o":"D'O":n?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},30699:function(t,e,n){!function(t){"use strict";t.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",ss:"%d imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}(n(30381))},51106:function(t,e,n){!function(t){"use strict";t.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",ss:"%d ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}(n(30381))},9288:function(t,e,n){!function(t){"use strict";t.defineLocale("ug-cn",{months:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),monthsShort:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),weekdays:"يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە".split("_"),weekdaysShort:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),weekdaysMin:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY-يىلىM-ئاينىڭD-كۈنى",LLL:"YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm",LLLL:"dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm"},meridiemParse:/يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/,meridiemHour:function(t,e){return 12===t&&(t=0),"يېرىم كېچە"===e||"سەھەر"===e||"چۈشتىن بۇرۇن"===e?t:"چۈشتىن كېيىن"===e||"كەچ"===e?t+12:t>=11?t:t+12},meridiem:function(t,e,n){var r=100*t+e;return r<600?"يېرىم كېچە":r<900?"سەھەر":r<1130?"چۈشتىن بۇرۇن":r<1230?"چۈش":r<1800?"چۈشتىن كېيىن":"كەچ"},calendar:{sameDay:"[بۈگۈن سائەت] LT",nextDay:"[ئەتە سائەت] LT",nextWeek:"[كېلەركى] dddd [سائەت] LT",lastDay:"[تۆنۈگۈن] LT",lastWeek:"[ئالدىنقى] dddd [سائەت] LT",sameElse:"L"},relativeTime:{future:"%s كېيىن",past:"%s بۇرۇن",s:"نەچچە سېكونت",ss:"%d سېكونت",m:"بىر مىنۇت",mm:"%d مىنۇت",h:"بىر سائەت",hh:"%d سائەت",d:"بىر كۈن",dd:"%d كۈن",M:"بىر ئاي",MM:"%d ئاي",y:"بىر يىل",yy:"%d يىل"},dayOfMonthOrdinalParse:/\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"-كۈنى";case"w":case"W":return t+"-ھەپتە";default:return t}},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:1,doy:7}})}(n(30381))},67691:function(t,e,n){!function(t){"use strict";function e(t,e,n){return"m"===n?e?"хвилина":"хвилину":"h"===n?e?"година":"годину":t+" "+(r=+t,i={ss:e?"секунда_секунди_секунд":"секунду_секунди_секунд",mm:e?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:e?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"}[n].split("_"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2]);var r,i}function n(t){return function(){return t+"о"+(11===this.hours()?"б":"")+"] LT"}}t.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:function(t,e){var n={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")};return!0===t?n.nominative.slice(1,7).concat(n.nominative.slice(0,1)):t?n[/(\[[ВвУу]\]) ?dddd/.test(e)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(e)?"genitive":"nominative"][t.day()]:n.nominative},weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:n("[Сьогодні "),nextDay:n("[Завтра "),lastDay:n("[Вчора "),nextWeek:n("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return n("[Минулої] dddd [").call(this);case 1:case 2:case 4:return n("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",ss:e,m:e,mm:e,h:"годину",hh:e,d:"день",dd:e,M:"місяць",MM:e,y:"рік",yy:e},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(t){return/^(дня|вечора)$/.test(t)},meridiem:function(t,e,n){return t<4?"ночі":t<12?"ранку":t<17?"дня":"вечора"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":case"w":case"W":return t+"-й";case"D":return t+"-го";default:return t}},week:{dow:1,doy:7}})}(n(30381))},13795:function(t,e,n){!function(t){"use strict";var e=["جنوری","فروری","مارچ","اپریل","مئی","جون","جولائی","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],n=["اتوار","پیر","منگل","بدھ","جمعرات","جمعہ","ہفتہ"];t.defineLocale("ur",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(t){return"شام"===t},meridiem:function(t,e,n){return t<12?"صبح":"شام"},calendar:{sameDay:"[آج بوقت] LT",nextDay:"[کل بوقت] LT",nextWeek:"dddd [بوقت] LT",lastDay:"[گذشتہ روز بوقت] LT",lastWeek:"[گذشتہ] dddd [بوقت] LT",sameElse:"L"},relativeTime:{future:"%s بعد",past:"%s قبل",s:"چند سیکنڈ",ss:"%d سیکنڈ",m:"ایک منٹ",mm:"%d منٹ",h:"ایک گھنٹہ",hh:"%d گھنٹے",d:"ایک دن",dd:"%d دن",M:"ایک ماہ",MM:"%d ماہ",y:"ایک سال",yy:"%d سال"},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n(30381))},60588:function(t,e,n){!function(t){"use strict";t.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}})}(n(30381))},6791:function(t,e,n){!function(t){"use strict";t.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",ss:"%d фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}})}(n(30381))},65666:function(t,e,n){!function(t){"use strict";t.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(t){return/^ch$/i.test(t)},meridiem:function(t,e,n){return t<12?n?"sa":"SA":n?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần trước lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",ss:"%d giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",w:"một tuần",ww:"%d tuần",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},14378:function(t,e,n){!function(t){"use strict";t.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",ss:"%d s~écóñ~ds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},75805:function(t,e,n){!function(t){"use strict";t.defineLocale("yo",{months:"Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),monthsShort:"Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),weekdays:"Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),weekdaysShort:"Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),weekdaysMin:"Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Ònì ni] LT",nextDay:"[Ọ̀la ni] LT",nextWeek:"dddd [Ọsẹ̀ tón'bọ] [ni] LT",lastDay:"[Àna ni] LT",lastWeek:"dddd [Ọsẹ̀ tólọ́] [ni] LT",sameElse:"L"},relativeTime:{future:"ní %s",past:"%s kọjá",s:"ìsẹjú aayá die",ss:"aayá %d",m:"ìsẹjú kan",mm:"ìsẹjú %d",h:"wákati kan",hh:"wákati %d",d:"ọjọ́ kan",dd:"ọjọ́ %d",M:"osù kan",MM:"osù %d",y:"ọdún kan",yy:"ọdún %d"},dayOfMonthOrdinalParse:/ọjọ́\s\d{1,2}/,ordinal:"ọjọ́ %d",week:{dow:1,doy:4}})}(n(30381))},83839:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(t,e){return 12===t&&(t=0),"凌晨"===e||"早上"===e||"上午"===e?t:"下午"===e||"晚上"===e?t+12:t>=11?t:t+12},meridiem:function(t,e,n){var r=100*t+e;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:function(t){return t.week()!==this.week()?"[下]dddLT":"[本]dddLT"},lastDay:"[昨天]LT",lastWeek:function(t){return this.week()!==t.week()?"[上]dddLT":"[本]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"日";case"M":return t+"月";case"w":case"W":return t+"周";default:return t}},relativeTime:{future:"%s后",past:"%s前",s:"几秒",ss:"%d 秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",w:"1 周",ww:"%d 周",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}})}(n(30381))},55726:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(t,e){return 12===t&&(t=0),"凌晨"===e||"早上"===e||"上午"===e?t:"中午"===e?t>=11?t:t+12:"下午"===e||"晚上"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"凌晨":r<900?"早上":r<1200?"上午":1200===r?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"日";case"M":return t+"月";case"w":case"W":return t+"週";default:return t}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(30381))},99807:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(t,e){return 12===t&&(t=0),"凌晨"===e||"早上"===e||"上午"===e?t:"中午"===e?t>=11?t:t+12:"下午"===e||"晚上"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"日";case"M":return t+"月";case"w":case"W":return t+"週";default:return t}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(30381))},74152:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(t,e){return 12===t&&(t=0),"凌晨"===e||"早上"===e||"上午"===e?t:"中午"===e?t>=11?t:t+12:"下午"===e||"晚上"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"日";case"M":return t+"月";case"w":case"W":return t+"週";default:return t}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(30381))},46700:(t,e,n)=>{var r={"./af":42786,"./af.js":42786,"./ar":30867,"./ar-dz":14130,"./ar-dz.js":14130,"./ar-kw":96135,"./ar-kw.js":96135,"./ar-ly":56440,"./ar-ly.js":56440,"./ar-ma":47702,"./ar-ma.js":47702,"./ar-ps":20315,"./ar-ps.js":20315,"./ar-sa":16040,"./ar-sa.js":16040,"./ar-tn":37100,"./ar-tn.js":37100,"./ar.js":30867,"./az":31083,"./az.js":31083,"./be":9808,"./be.js":9808,"./bg":68338,"./bg.js":68338,"./bm":67438,"./bm.js":67438,"./bn":8905,"./bn-bd":76225,"./bn-bd.js":76225,"./bn.js":8905,"./bo":11560,"./bo.js":11560,"./br":1278,"./br.js":1278,"./bs":80622,"./bs.js":80622,"./ca":2468,"./ca.js":2468,"./cs":5822,"./cs.js":5822,"./cv":50877,"./cv.js":50877,"./cy":47373,"./cy.js":47373,"./da":24780,"./da.js":24780,"./de":59740,"./de-at":60217,"./de-at.js":60217,"./de-ch":60894,"./de-ch.js":60894,"./de.js":59740,"./dv":5300,"./dv.js":5300,"./el":50837,"./el.js":50837,"./en-au":78348,"./en-au.js":78348,"./en-ca":77925,"./en-ca.js":77925,"./en-gb":22243,"./en-gb.js":22243,"./en-ie":46436,"./en-ie.js":46436,"./en-il":47207,"./en-il.js":47207,"./en-in":44175,"./en-in.js":44175,"./en-nz":76319,"./en-nz.js":76319,"./en-sg":31662,"./en-sg.js":31662,"./eo":92915,"./eo.js":92915,"./es":55655,"./es-do":55251,"./es-do.js":55251,"./es-mx":96112,"./es-mx.js":96112,"./es-us":71146,"./es-us.js":71146,"./es.js":55655,"./et":5603,"./et.js":5603,"./eu":77763,"./eu.js":77763,"./fa":76959,"./fa.js":76959,"./fi":11897,"./fi.js":11897,"./fil":42549,"./fil.js":42549,"./fo":94694,"./fo.js":94694,"./fr":94470,"./fr-ca":63049,"./fr-ca.js":63049,"./fr-ch":52330,"./fr-ch.js":52330,"./fr.js":94470,"./fy":5044,"./fy.js":5044,"./ga":29295,"./ga.js":29295,"./gd":2101,"./gd.js":2101,"./gl":38794,"./gl.js":38794,"./gom-deva":27884,"./gom-deva.js":27884,"./gom-latn":23168,"./gom-latn.js":23168,"./gu":95349,"./gu.js":95349,"./he":24206,"./he.js":24206,"./hi":30094,"./hi.js":30094,"./hr":30316,"./hr.js":30316,"./hu":22138,"./hu.js":22138,"./hy-am":11423,"./hy-am.js":11423,"./id":29218,"./id.js":29218,"./is":90135,"./is.js":90135,"./it":90626,"./it-ch":10150,"./it-ch.js":10150,"./it.js":90626,"./ja":39183,"./ja.js":39183,"./jv":24286,"./jv.js":24286,"./ka":12105,"./ka.js":12105,"./kk":47772,"./kk.js":47772,"./km":18758,"./km.js":18758,"./kn":79282,"./kn.js":79282,"./ko":33730,"./ko.js":33730,"./ku":1408,"./ku-kmr":90563,"./ku-kmr.js":90563,"./ku.js":1408,"./ky":33291,"./ky.js":33291,"./lb":36841,"./lb.js":36841,"./lo":55466,"./lo.js":55466,"./lt":57010,"./lt.js":57010,"./lv":37595,"./lv.js":37595,"./me":39861,"./me.js":39861,"./mi":35493,"./mi.js":35493,"./mk":95966,"./mk.js":95966,"./ml":87341,"./ml.js":87341,"./mn":5115,"./mn.js":5115,"./mr":10370,"./mr.js":10370,"./ms":9847,"./ms-my":41237,"./ms-my.js":41237,"./ms.js":9847,"./mt":72126,"./mt.js":72126,"./my":56165,"./my.js":56165,"./nb":64924,"./nb.js":64924,"./ne":16744,"./ne.js":16744,"./nl":93901,"./nl-be":59814,"./nl-be.js":59814,"./nl.js":93901,"./nn":83877,"./nn.js":83877,"./oc-lnc":92135,"./oc-lnc.js":92135,"./pa-in":15858,"./pa-in.js":15858,"./pl":64495,"./pl.js":64495,"./pt":89520,"./pt-br":57971,"./pt-br.js":57971,"./pt.js":89520,"./ro":96459,"./ro.js":96459,"./ru":21793,"./ru.js":21793,"./sd":40950,"./sd.js":40950,"./se":10490,"./se.js":10490,"./si":90124,"./si.js":90124,"./sk":64249,"./sk.js":64249,"./sl":14985,"./sl.js":14985,"./sq":51104,"./sq.js":51104,"./sr":49131,"./sr-cyrl":79915,"./sr-cyrl.js":79915,"./sr.js":49131,"./ss":85893,"./ss.js":85893,"./sv":98760,"./sv.js":98760,"./sw":91172,"./sw.js":91172,"./ta":27333,"./ta.js":27333,"./te":23110,"./te.js":23110,"./tet":52095,"./tet.js":52095,"./tg":27321,"./tg.js":27321,"./th":9041,"./th.js":9041,"./tk":19005,"./tk.js":19005,"./tl-ph":75768,"./tl-ph.js":75768,"./tlh":89444,"./tlh.js":89444,"./tr":72397,"./tr.js":72397,"./tzl":28254,"./tzl.js":28254,"./tzm":51106,"./tzm-latn":30699,"./tzm-latn.js":30699,"./tzm.js":51106,"./ug-cn":9288,"./ug-cn.js":9288,"./uk":67691,"./uk.js":67691,"./ur":13795,"./ur.js":13795,"./uz":6791,"./uz-latn":60588,"./uz-latn.js":60588,"./uz.js":6791,"./vi":65666,"./vi.js":65666,"./x-pseudo":14378,"./x-pseudo.js":14378,"./yo":75805,"./yo.js":75805,"./zh-cn":83839,"./zh-cn.js":83839,"./zh-hk":55726,"./zh-hk.js":55726,"./zh-mo":99807,"./zh-mo.js":99807,"./zh-tw":74152,"./zh-tw.js":74152};function i(t){var e=o(t);return n(e)}function o(t){if(!n.o(r,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r[t]}i.keys=function(){return Object.keys(r)},i.resolve=o,t.exports=i,i.id=46700},30381:function(t,e,n){(t=n.nmd(t)).exports=function(){"use strict";var e,r;function i(){return e.apply(null,arguments)}function o(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function s(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function u(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(a(t,e))return!1;return!0}function c(t){return void 0===t}function d(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function l(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function h(t,e){var n,r=[],i=t.length;for(n=0;n>>0;for(e=0;e0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var L=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,$=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,R={},O={};function D(t,e,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),t&&(O[t]=i),e&&(O[e[0]]=function(){return B(i.apply(this,arguments),e[1],e[2])}),n&&(O[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function C(t,e){return t.isValid()?(e=N(e,t.localeData()),R[e]=R[e]||function(t){var e,n,r,i=t.match(L);for(e=0,n=i.length;e=0&&$.test(t);)t=t.replace($,r),$.lastIndex=0,n-=1;return t}var z={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function U(t){return"string"==typeof t?z[t]||z[t.toLowerCase()]:void 0}function j(t){var e,n,r={};for(n in t)a(t,n)&&(e=U(n))&&(r[e]=t[n]);return r}var Y={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};var F,W=/\d/,H=/\d\d/,K=/\d{3}/,q=/\d{4}/,V=/[+-]?\d{6}/,G=/\d\d?/,Z=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,J=/\d{1,3}/,Q=/\d{1,4}/,tt=/[+-]?\d{1,6}/,et=/\d+/,nt=/[+-]?\d+/,rt=/Z|[+-]\d\d:?\d\d/gi,it=/Z|[+-]\d\d(?::?\d\d)?/gi,ot=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,st=/^[1-9]\d?/,at=/^([1-9]\d|\d)/;function ut(t,e,n){F[t]=E(e)?e:function(t,r){return t&&n?n:e}}function ct(t,e){return a(F,t)?F[t](e._strict,e._locale):new RegExp(dt(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(t,e,n,r,i){return e||n||r||i}))))}function dt(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function lt(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function ht(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=lt(e)),n}F={};var ft={};function pt(t,e){var n,r,i=e;for("string"==typeof t&&(t=[t]),d(e)&&(i=function(t,n){n[e]=ht(t)}),r=t.length,n=0;n68?1900:2e3)};var Et,Tt=Pt("FullYear",!0);function Pt(t,e){return function(n){return null!=n?(Lt(this,t,n),i.updateOffset(this,e),this):Bt(this,t)}}function Bt(t,e){if(!t.isValid())return NaN;var n=t._d,r=t._isUTC;switch(e){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Lt(t,e,n){var r,i,o,s,a;if(t.isValid()&&!isNaN(n)){switch(r=t._d,i=t._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(i?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(i?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(i?r.setUTCHours(n):r.setHours(n));case"Date":return void(i?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}o=n,s=t.month(),a=29!==(a=t.date())||1!==s||yt(o)?a:28,i?r.setUTCFullYear(o,s,a):r.setFullYear(o,s,a)}}function $t(t,e){if(isNaN(t)||isNaN(e))return NaN;var n,r=(e%(n=12)+n)%n;return t+=(e-r)/12,1===r?yt(t)?29:28:31-r%7%2}Et=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e=0?(a=new Date(t+400,e,n,r,i,o,s),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,n,r,i,o,s),a}function Wt(t){var e,n;return t<100&&t>=0?((n=Array.prototype.slice.call(arguments))[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function Ht(t,e,n){var r=7+e-n;return-(7+Wt(t,0,r).getUTCDay()-e)%7+r-1}function Kt(t,e,n,r,i){var o,s,a=1+7*(e-1)+(7+n-r)%7+Ht(t,r,i);return a<=0?s=xt(o=t-1)+a:a>xt(t)?(o=t+1,s=a-xt(t)):(o=t,s=a),{year:o,dayOfYear:s}}function qt(t,e,n){var r,i,o=Ht(t.year(),e,n),s=Math.floor((t.dayOfYear()-o-1)/7)+1;return s<1?r=s+Vt(i=t.year()-1,e,n):s>Vt(t.year(),e,n)?(r=s-Vt(t.year(),e,n),i=t.year()+1):(i=t.year(),r=s),{week:r,year:i}}function Vt(t,e,n){var r=Ht(t,e,n),i=Ht(t+1,e,n);return(xt(t)-r+i)/7}D("w",["ww",2],"wo","week"),D("W",["WW",2],"Wo","isoWeek"),ut("w",G,st),ut("ww",G,H),ut("W",G,st),ut("WW",G,H),mt(["w","ww","W","WW"],(function(t,e,n,r){e[r.substr(0,1)]=ht(t)}));function Gt(t,e){return t.slice(e,7).concat(t.slice(0,e))}D("d",0,"do","day"),D("dd",0,0,(function(t){return this.localeData().weekdaysMin(this,t)})),D("ddd",0,0,(function(t){return this.localeData().weekdaysShort(this,t)})),D("dddd",0,0,(function(t){return this.localeData().weekdays(this,t)})),D("e",0,0,"weekday"),D("E",0,0,"isoWeekday"),ut("d",G),ut("e",G),ut("E",G),ut("dd",(function(t,e){return e.weekdaysMinRegex(t)})),ut("ddd",(function(t,e){return e.weekdaysShortRegex(t)})),ut("dddd",(function(t,e){return e.weekdaysRegex(t)})),mt(["dd","ddd","dddd"],(function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);null!=i?e.d=i:m(n).invalidWeekday=t})),mt(["d","e","E"],(function(t,e,n,r){e[r]=ht(t)}));var Zt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Xt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Jt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Qt=ot,te=ot,ee=ot;function ne(t,e,n){var r,i,o,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)o=p([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===e?-1!==(i=Et.call(this._weekdaysParse,s))?i:null:"ddd"===e?-1!==(i=Et.call(this._shortWeekdaysParse,s))?i:null:-1!==(i=Et.call(this._minWeekdaysParse,s))?i:null:"dddd"===e?-1!==(i=Et.call(this._weekdaysParse,s))||-1!==(i=Et.call(this._shortWeekdaysParse,s))||-1!==(i=Et.call(this._minWeekdaysParse,s))?i:null:"ddd"===e?-1!==(i=Et.call(this._shortWeekdaysParse,s))||-1!==(i=Et.call(this._weekdaysParse,s))||-1!==(i=Et.call(this._minWeekdaysParse,s))?i:null:-1!==(i=Et.call(this._minWeekdaysParse,s))||-1!==(i=Et.call(this._weekdaysParse,s))||-1!==(i=Et.call(this._shortWeekdaysParse,s))?i:null}function re(){function t(t,e){return e.length-t.length}var e,n,r,i,o,s=[],a=[],u=[],c=[];for(e=0;e<7;e++)n=p([2e3,1]).day(e),r=dt(this.weekdaysMin(n,"")),i=dt(this.weekdaysShort(n,"")),o=dt(this.weekdays(n,"")),s.push(r),a.push(i),u.push(o),c.push(r),c.push(i),c.push(o);s.sort(t),a.sort(t),u.sort(t),c.sort(t),this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function ie(){return this.hours()%12||12}function oe(t,e){D(t,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)}))}function se(t,e){return e._meridiemParse}D("H",["HH",2],0,"hour"),D("h",["hh",2],0,ie),D("k",["kk",2],0,(function(){return this.hours()||24})),D("hmm",0,0,(function(){return""+ie.apply(this)+B(this.minutes(),2)})),D("hmmss",0,0,(function(){return""+ie.apply(this)+B(this.minutes(),2)+B(this.seconds(),2)})),D("Hmm",0,0,(function(){return""+this.hours()+B(this.minutes(),2)})),D("Hmmss",0,0,(function(){return""+this.hours()+B(this.minutes(),2)+B(this.seconds(),2)})),oe("a",!0),oe("A",!1),ut("a",se),ut("A",se),ut("H",G,at),ut("h",G,st),ut("k",G,st),ut("HH",G,H),ut("hh",G,H),ut("kk",G,H),ut("hmm",Z),ut("hmmss",X),ut("Hmm",Z),ut("Hmmss",X),pt(["H","HH"],vt),pt(["k","kk"],(function(t,e,n){var r=ht(t);e[vt]=24===r?0:r})),pt(["a","A"],(function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t})),pt(["h","hh"],(function(t,e,n){e[vt]=ht(t),m(n).bigHour=!0})),pt("hmm",(function(t,e,n){var r=t.length-2;e[vt]=ht(t.substr(0,r)),e[kt]=ht(t.substr(r)),m(n).bigHour=!0})),pt("hmmss",(function(t,e,n){var r=t.length-4,i=t.length-2;e[vt]=ht(t.substr(0,r)),e[kt]=ht(t.substr(r,2)),e[Mt]=ht(t.substr(i)),m(n).bigHour=!0})),pt("Hmm",(function(t,e,n){var r=t.length-2;e[vt]=ht(t.substr(0,r)),e[kt]=ht(t.substr(r))})),pt("Hmmss",(function(t,e,n){var r=t.length-4,i=t.length-2;e[vt]=ht(t.substr(0,r)),e[kt]=ht(t.substr(r,2)),e[Mt]=ht(t.substr(i))}));var ae=Pt("Hours",!0);var ue,ce={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Rt,monthsShort:Ot,week:{dow:0,doy:6},weekdays:Zt,weekdaysMin:Jt,weekdaysShort:Xt,meridiemParse:/[ap]\.?m?\.?/i},de={},le={};function he(t,e){var n,r=Math.min(t.length,e.length);for(n=0;n0;){if(r=pe(i.slice(0,e).join("-")))return r;if(n&&n.length>=e&&he(i,n)>=e-1)break;e--}o++}return ue}(t)}function be(t){var e,n=t._a;return n&&-2===m(t).overflow&&(e=n[wt]<0||n[wt]>11?wt:n[_t]<1||n[_t]>$t(n[bt],n[wt])?_t:n[vt]<0||n[vt]>24||24===n[vt]&&(0!==n[kt]||0!==n[Mt]||0!==n[At])?vt:n[kt]<0||n[kt]>59?kt:n[Mt]<0||n[Mt]>59?Mt:n[At]<0||n[At]>999?At:-1,m(t)._overflowDayOfYear&&(e_t)&&(e=_t),m(t)._overflowWeeks&&-1===e&&(e=St),m(t)._overflowWeekday&&-1===e&&(e=It),m(t).overflow=e),t}var we=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_e=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ve=/Z|[+-]\d\d(?::?\d\d)?/,ke=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Me=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ae=/^\/?Date\((-?\d+)/i,Se=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Ie={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function xe(t){var e,n,r,i,o,s,a=t._i,u=we.exec(a)||_e.exec(a),c=ke.length,d=Me.length;if(u){for(m(t).iso=!0,e=0,n=c;e7)&&(u=!0)):(o=t._locale._week.dow,s=t._locale._week.doy,c=qt(Oe(),o,s),n=Pe(e.gg,t._a[bt],c.year),r=Pe(e.w,c.week),null!=e.d?((i=e.d)<0||i>6)&&(u=!0):null!=e.e?(i=e.e+o,(e.e<0||e.e>6)&&(u=!0)):i=o),r<1||r>Vt(n,o,s)?m(t)._overflowWeeks=!0:null!=u?m(t)._overflowWeekday=!0:(a=Kt(n,r,i,o,s),t._a[bt]=a.year,t._dayOfYear=a.dayOfYear)}(t),null!=t._dayOfYear&&(s=Pe(t._a[bt],r[bt]),(t._dayOfYear>xt(s)||0===t._dayOfYear)&&(m(t)._overflowDayOfYear=!0),n=Wt(s,0,t._dayOfYear),t._a[wt]=n.getUTCMonth(),t._a[_t]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=a[e]=r[e];for(;e<7;e++)t._a[e]=a[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[vt]&&0===t._a[kt]&&0===t._a[Mt]&&0===t._a[At]&&(t._nextDay=!0,t._a[vt]=0),t._d=(t._useUTC?Wt:Ft).apply(null,a),o=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[vt]=24),t._w&&void 0!==t._w.d&&t._w.d!==o&&(m(t).weekdayMismatch=!0)}}function Le(t){if(t._f!==i.ISO_8601)if(t._f!==i.RFC_2822){t._a=[],m(t).empty=!0;var e,n,r,o,s,a,u,c=""+t._i,d=c.length,l=0;for(u=(r=N(t._f,t._locale).match(L)||[]).length,e=0;e0&&m(t).unusedInput.push(s),c=c.slice(c.indexOf(n)+n.length),l+=n.length),O[o]?(n?m(t).empty=!1:m(t).unusedTokens.push(o),gt(o,n,t)):t._strict&&!n&&m(t).unusedTokens.push(o);m(t).charsLeftOver=d-l,c.length>0&&m(t).unusedInput.push(c),t._a[vt]<=12&&!0===m(t).bigHour&&t._a[vt]>0&&(m(t).bigHour=void 0),m(t).parsedDateParts=t._a.slice(0),m(t).meridiem=t._meridiem,t._a[vt]=function(t,e,n){var r;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?((r=t.isPM(n))&&e<12&&(e+=12),r||12!==e||(e=0),e):e}(t._locale,t._a[vt],t._meridiem),null!==(a=m(t).era)&&(t._a[bt]=t._locale.erasConvertYear(a,t._a[bt])),Be(t),be(t)}else Te(t);else xe(t)}function $e(t){var e=t._i,n=t._f;return t._locale=t._locale||ye(t._l),null===e||void 0===n&&""===e?y({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),k(e)?new v(be(e)):(l(e)?t._d=e:o(n)?function(t){var e,n,r,i,o,s,a=!1,u=t._f.length;if(0===u)return m(t).invalidFormat=!0,void(t._d=new Date(NaN));for(i=0;ithis?this:t:y()}));function Ne(t,e){var n,r;if(1===e.length&&o(e[0])&&(e=e[0]),!e.length)return Oe();for(n=e[0],r=1;r=0?new Date(t+400,e,n)-pn:new Date(t,e,n).valueOf()}function yn(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-pn:Date.UTC(t,e,n)}function bn(t,e){return e.erasAbbrRegex(t)}function wn(){var t,e,n,r,i,o=[],s=[],a=[],u=[],c=this.eras();for(t=0,e=c.length;t(o=Vt(t,r,i))&&(e=o),kn.call(this,t,e,n,r,i))}function kn(t,e,n,r,i){var o=Kt(t,e,n,r,i),s=Wt(o.year,0,o.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}D("N",0,0,"eraAbbr"),D("NN",0,0,"eraAbbr"),D("NNN",0,0,"eraAbbr"),D("NNNN",0,0,"eraName"),D("NNNNN",0,0,"eraNarrow"),D("y",["y",1],"yo","eraYear"),D("y",["yy",2],0,"eraYear"),D("y",["yyy",3],0,"eraYear"),D("y",["yyyy",4],0,"eraYear"),ut("N",bn),ut("NN",bn),ut("NNN",bn),ut("NNNN",(function(t,e){return e.erasNameRegex(t)})),ut("NNNNN",(function(t,e){return e.erasNarrowRegex(t)})),pt(["N","NN","NNN","NNNN","NNNNN"],(function(t,e,n,r){var i=n._locale.erasParse(t,r,n._strict);i?m(n).era=i:m(n).invalidEra=t})),ut("y",et),ut("yy",et),ut("yyy",et),ut("yyyy",et),ut("yo",(function(t,e){return e._eraYearOrdinalRegex||et})),pt(["y","yy","yyy","yyyy"],bt),pt(["yo"],(function(t,e,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[bt]=n._locale.eraYearOrdinalParse(t,i):e[bt]=parseInt(t,10)})),D(0,["gg",2],0,(function(){return this.weekYear()%100})),D(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),_n("gggg","weekYear"),_n("ggggg","weekYear"),_n("GGGG","isoWeekYear"),_n("GGGGG","isoWeekYear"),ut("G",nt),ut("g",nt),ut("GG",G,H),ut("gg",G,H),ut("GGGG",Q,q),ut("gggg",Q,q),ut("GGGGG",tt,V),ut("ggggg",tt,V),mt(["gggg","ggggg","GGGG","GGGGG"],(function(t,e,n,r){e[r.substr(0,2)]=ht(t)})),mt(["gg","GG"],(function(t,e,n,r){e[r]=i.parseTwoDigitYear(t)})),D("Q",0,"Qo","quarter"),ut("Q",W),pt("Q",(function(t,e){e[wt]=3*(ht(t)-1)})),D("D",["DD",2],"Do","date"),ut("D",G,st),ut("DD",G,H),ut("Do",(function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient})),pt(["D","DD"],_t),pt("Do",(function(t,e){e[_t]=ht(t.match(G)[0])}));var Mn=Pt("Date",!0);D("DDD",["DDDD",3],"DDDo","dayOfYear"),ut("DDD",J),ut("DDDD",K),pt(["DDD","DDDD"],(function(t,e,n){n._dayOfYear=ht(t)})),D("m",["mm",2],0,"minute"),ut("m",G,at),ut("mm",G,H),pt(["m","mm"],kt);var An=Pt("Minutes",!1);D("s",["ss",2],0,"second"),ut("s",G,at),ut("ss",G,H),pt(["s","ss"],Mt);var Sn,In,xn=Pt("Seconds",!1);for(D("S",0,0,(function(){return~~(this.millisecond()/100)})),D(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),D(0,["SSS",3],0,"millisecond"),D(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),D(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),D(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),D(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),D(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),D(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),ut("S",J,W),ut("SS",J,H),ut("SSS",J,K),Sn="SSSS";Sn.length<=9;Sn+="S")ut(Sn,et);function En(t,e){e[At]=ht(1e3*("0."+t))}for(Sn="S";Sn.length<=9;Sn+="S")pt(Sn,En);In=Pt("Milliseconds",!1),D("z",0,0,"zoneAbbr"),D("zz",0,0,"zoneName");var Tn=v.prototype;function Pn(t){return t}Tn.add=nn,Tn.calendar=function(t,e){1===arguments.length&&(arguments[0]?sn(arguments[0])?(t=arguments[0],e=void 0):function(t){var e,n=s(t)&&!u(t),r=!1,i=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(e=0;en.valueOf():n.valueOf()9999?C(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):E(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",C(n,"Z")):C(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},Tn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t,e,n,r="moment",i="";return this.isLocal()||(r=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),t="["+r+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY","-MM-DD[T]HH:mm:ss.SSS",n=i+'[")]',this.format(t+e+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(Tn[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Tn.toJSON=function(){return this.isValid()?this.toISOString():null},Tn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Tn.unix=function(){return Math.floor(this.valueOf()/1e3)},Tn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Tn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Tn.eraName=function(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;tthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Tn.isLocal=function(){return!!this.isValid()&&!this._isUTC},Tn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Tn.isUtc=Ve,Tn.isUTC=Ve,Tn.zoneAbbr=function(){return this._isUTC?"UTC":""},Tn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Tn.dates=A("dates accessor is deprecated. Use date instead.",Mn),Tn.months=A("months accessor is deprecated. Use month instead",jt),Tn.years=A("years accessor is deprecated. Use year instead",Tt),Tn.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()})),Tn.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!c(this._isDSTShifted))return this._isDSTShifted;var t,e={};return _(e,this),(e=$e(e))._a?(t=e._isUTC?p(e._a):Oe(e._a),this._isDSTShifted=this.isValid()&&function(t,e,n){var r,i=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),s=0;for(r=0;r0):this._isDSTShifted=!1,this._isDSTShifted}));var Bn=P.prototype;function Ln(t,e,n,r){var i=ye(),o=p().set(r,e);return i[n](o,t)}function $n(t,e,n){if(d(t)&&(e=t,t=void 0),t=t||"",null!=e)return Ln(t,e,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=Ln(t,r,n,"month");return i}function Rn(t,e,n,r){"boolean"==typeof t?(d(e)&&(n=e,e=void 0),e=e||""):(n=e=t,t=!1,d(e)&&(n=e,e=void 0),e=e||"");var i,o=ye(),s=t?o._week.dow:0,a=[];if(null!=n)return Ln(e,(n+s)%7,r,"day");for(i=0;i<7;i++)a[i]=Ln(e,(i+s)%7,r,"day");return a}Bn.calendar=function(t,e,n){var r=this._calendar[t]||this._calendar.sameElse;return E(r)?r.call(e,n):r},Bn.longDateFormat=function(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(L).map((function(t){return"MMMM"===t||"MM"===t||"DD"===t||"dddd"===t?t.slice(1):t})).join(""),this._longDateFormat[t])},Bn.invalidDate=function(){return this._invalidDate},Bn.ordinal=function(t){return this._ordinal.replace("%d",t)},Bn.preparse=Pn,Bn.postformat=Pn,Bn.relativeTime=function(t,e,n,r){var i=this._relativeTime[n];return E(i)?i(t,e,n,r):i.replace(/%d/i,t)},Bn.pastFuture=function(t,e){var n=this._relativeTime[t>0?"future":"past"];return E(n)?n(e):n.replace(/%s/i,e)},Bn.set=function(t){var e,n;for(n in t)a(t,n)&&(E(e=t[n])?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},Bn.eras=function(t,e){var n,r,o,s=this._eras||ye("en")._eras;for(n=0,r=s.length;n=0)return u[r]},Bn.erasConvertYear=function(t,e){var n=t.since<=t.until?1:-1;return void 0===e?i(t.since).year():i(t.since).year()+(e-t.offset)*n},Bn.erasAbbrRegex=function(t){return a(this,"_erasAbbrRegex")||wn.call(this),t?this._erasAbbrRegex:this._erasRegex},Bn.erasNameRegex=function(t){return a(this,"_erasNameRegex")||wn.call(this),t?this._erasNameRegex:this._erasRegex},Bn.erasNarrowRegex=function(t){return a(this,"_erasNarrowRegex")||wn.call(this),t?this._erasNarrowRegex:this._erasRegex},Bn.months=function(t,e){return t?o(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||Dt).test(e)?"format":"standalone"][t.month()]:o(this._months)?this._months:this._months.standalone},Bn.monthsShort=function(t,e){return t?o(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[Dt.test(e)?"format":"standalone"][t.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},Bn.monthsParse=function(t,e,n){var r,i,o;if(this._monthsParseExact)return zt.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=p([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[r].test(t))return r;if(n&&"MMM"===e&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}},Bn.monthsRegex=function(t){return this._monthsParseExact?(a(this,"_monthsRegex")||Yt.call(this),t?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=Nt),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)},Bn.monthsShortRegex=function(t){return this._monthsParseExact?(a(this,"_monthsRegex")||Yt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=Ct),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)},Bn.week=function(t){return qt(t,this._week.dow,this._week.doy).week},Bn.firstDayOfYear=function(){return this._week.doy},Bn.firstDayOfWeek=function(){return this._week.dow},Bn.weekdays=function(t,e){var n=o(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?Gt(n,this._week.dow):t?n[t.day()]:n},Bn.weekdaysMin=function(t){return!0===t?Gt(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin},Bn.weekdaysShort=function(t){return!0===t?Gt(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort},Bn.weekdaysParse=function(t,e,n){var r,i,o;if(this._weekdaysParseExact)return ne.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=p([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[r].test(t))return r;if(n&&"ddd"===e&&this._shortWeekdaysParse[r].test(t))return r;if(n&&"dd"===e&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}},Bn.weekdaysRegex=function(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||re.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Qt),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)},Bn.weekdaysShortRegex=function(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||re.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=te),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Bn.weekdaysMinRegex=function(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||re.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ee),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Bn.isPM=function(t){return"p"===(t+"").toLowerCase().charAt(0)},Bn.meridiem=function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},me("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===ht(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),i.lang=A("moment.lang is deprecated. Use moment.locale instead.",me),i.langData=A("moment.langData is deprecated. Use moment.localeData instead.",ye);var On=Math.abs;function Dn(t,e,n,r){var i=Xe(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function Cn(t){return t<0?Math.floor(t):Math.ceil(t)}function Nn(t){return 4800*t/146097}function zn(t){return 146097*t/4800}function Un(t){return function(){return this.as(t)}}var jn=Un("ms"),Yn=Un("s"),Fn=Un("m"),Wn=Un("h"),Hn=Un("d"),Kn=Un("w"),qn=Un("M"),Vn=Un("Q"),Gn=Un("y"),Zn=jn;function Xn(t){return function(){return this.isValid()?this._data[t]:NaN}}var Jn=Xn("milliseconds"),Qn=Xn("seconds"),tr=Xn("minutes"),er=Xn("hours"),nr=Xn("days"),rr=Xn("months"),ir=Xn("years");var or=Math.round,sr={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ar(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}var ur=Math.abs;function cr(t){return(t>0)-(t<0)||+t}function dr(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,r,i,o,s,a,u=ur(this._milliseconds)/1e3,c=ur(this._days),d=ur(this._months),l=this.asSeconds();return l?(t=lt(u/60),e=lt(t/60),u%=60,t%=60,n=lt(d/12),d%=12,r=u?u.toFixed(3).replace(/\.?0+$/,""):"",i=l<0?"-":"",o=cr(this._months)!==cr(l)?"-":"",s=cr(this._days)!==cr(l)?"-":"",a=cr(this._milliseconds)!==cr(l)?"-":"",i+"P"+(n?o+n+"Y":"")+(d?o+d+"M":"")+(c?s+c+"D":"")+(e||t||u?"T":"")+(e?a+e+"H":"")+(t?a+t+"M":"")+(u?a+r+"S":"")):"P0D"}var lr=Ue.prototype;return lr.isValid=function(){return this._isValid},lr.abs=function(){var t=this._data;return this._milliseconds=On(this._milliseconds),this._days=On(this._days),this._months=On(this._months),t.milliseconds=On(t.milliseconds),t.seconds=On(t.seconds),t.minutes=On(t.minutes),t.hours=On(t.hours),t.months=On(t.months),t.years=On(t.years),this},lr.add=function(t,e){return Dn(this,t,e,1)},lr.subtract=function(t,e){return Dn(this,t,e,-1)},lr.as=function(t){if(!this.isValid())return NaN;var e,n,r=this._milliseconds;if("month"===(t=U(t))||"quarter"===t||"year"===t)switch(e=this._days+r/864e5,n=this._months+Nn(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(zn(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return 24*e+r/36e5;case"minute":return 1440*e+r/6e4;case"second":return 86400*e+r/1e3;case"millisecond":return Math.floor(864e5*e)+r;default:throw new Error("Unknown unit "+t)}},lr.asMilliseconds=jn,lr.asSeconds=Yn,lr.asMinutes=Fn,lr.asHours=Wn,lr.asDays=Hn,lr.asWeeks=Kn,lr.asMonths=qn,lr.asQuarters=Vn,lr.asYears=Gn,lr.valueOf=Zn,lr._bubble=function(){var t,e,n,r,i,o=this._milliseconds,s=this._days,a=this._months,u=this._data;return o>=0&&s>=0&&a>=0||o<=0&&s<=0&&a<=0||(o+=864e5*Cn(zn(a)+s),s=0,a=0),u.milliseconds=o%1e3,t=lt(o/1e3),u.seconds=t%60,e=lt(t/60),u.minutes=e%60,n=lt(e/60),u.hours=n%24,s+=lt(n/24),a+=i=lt(Nn(s)),s-=Cn(zn(i)),r=lt(a/12),a%=12,u.days=s,u.months=a,u.years=r,this},lr.clone=function(){return Xe(this)},lr.get=function(t){return t=U(t),this.isValid()?this[t+"s"]():NaN},lr.milliseconds=Jn,lr.seconds=Qn,lr.minutes=tr,lr.hours=er,lr.days=nr,lr.weeks=function(){return lt(this.days()/7)},lr.months=rr,lr.years=ir,lr.humanize=function(t,e){if(!this.isValid())return this.localeData().invalidDate();var n,r,i=!1,o=sr;return"object"==typeof t&&(e=t,t=!1),"boolean"==typeof t&&(i=t),"object"==typeof e&&(o=Object.assign({},sr,e),null!=e.s&&null==e.ss&&(o.ss=e.s-1)),r=function(t,e,n,r){var i=Xe(t).abs(),o=or(i.as("s")),s=or(i.as("m")),a=or(i.as("h")),u=or(i.as("d")),c=or(i.as("M")),d=or(i.as("w")),l=or(i.as("y")),h=o<=n.ss&&["s",o]||o0,h[4]=r,ar.apply(null,h)}(this,!i,o,n=this.localeData()),i&&(r=n.pastFuture(+this,r)),n.postformat(r)},lr.toISOString=dr,lr.toString=dr,lr.toJSON=dr,lr.locale=un,lr.localeData=dn,lr.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",dr),lr.lang=cn,D("X",0,0,"unix"),D("x",0,0,"valueOf"),ut("x",nt),ut("X",/[+-]?\d+(\.\d{1,3})?/),pt("X",(function(t,e,n){n._d=new Date(1e3*parseFloat(t))})),pt("x",(function(t,e,n){n._d=new Date(ht(t))})),i.version="2.30.1",e=Oe,i.fn=Tn,i.min=function(){return Ne("isBefore",[].slice.call(arguments,0))},i.max=function(){return Ne("isAfter",[].slice.call(arguments,0))},i.now=function(){return Date.now?Date.now():+new Date},i.utc=p,i.unix=function(t){return Oe(1e3*t)},i.months=function(t,e){return $n(t,e,"months")},i.isDate=l,i.locale=me,i.invalid=y,i.duration=Xe,i.isMoment=k,i.weekdays=function(t,e,n){return Rn(t,e,n,"weekdays")},i.parseZone=function(){return Oe.apply(null,arguments).parseZone()},i.localeData=ye,i.isDuration=je,i.monthsShort=function(t,e){return $n(t,e,"monthsShort")},i.weekdaysMin=function(t,e,n){return Rn(t,e,n,"weekdaysMin")},i.defineLocale=ge,i.updateLocale=function(t,e){if(null!=e){var n,r,i=ce;null!=de[t]&&null!=de[t].parentLocale?de[t].set(T(de[t]._config,e)):(null!=(r=pe(t))&&(i=r._config),e=T(i,e),null==r&&(e.abbr=t),(n=new P(e)).parentLocale=de[t],de[t]=n),me(t)}else null!=de[t]&&(null!=de[t].parentLocale?(de[t]=de[t].parentLocale,t===me()&&me(t)):null!=de[t]&&delete de[t]);return de[t]},i.locales=function(){return S(de)},i.weekdaysShort=function(t,e,n){return Rn(t,e,n,"weekdaysShort")},i.normalizeUnits=U,i.relativeTimeRounding=function(t){return void 0===t?or:"function"==typeof t&&(or=t,!0)},i.relativeTimeThreshold=function(t,e){return void 0!==sr[t]&&(void 0===e?sr[t]:(sr[t]=e,"s"===t&&(sr.ss=e-1),!0))},i.calendarFormat=function(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},i.prototype=Tn,i.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},i}()},83300:(t,e,n)=>{"use strict";var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("unable to locate global object")}();t.exports=e=r.fetch,r.fetch&&(e.default=r.fetch.bind(r)),e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response},42693:(t,e,n)=>{"use strict";const r=n(99353),i=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class o extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,({message:t}=t)):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const s=(t,e)=>new Promise(((n,s)=>{e={onFailedAttempt:()=>{},retries:10,...e};const a=r.operation(e);a.attempt((async r=>{try{n(await t(r))}catch(t){if(!(t instanceof Error))return void s(new TypeError(`Non-error was thrown: "${t}". You should only throw errors.`));if(t instanceof o)a.stop(),s(t.originalError);else if(t instanceof TypeError&&(u=t.message,!i.includes(u)))a.stop(),s(t);else{((t,e,n)=>{const r=n.retries-(e-1);t.attemptNumber=e,t.retriesLeft=r})(t,r,e);try{await e.onFailedAttempt(t)}catch(t){return void s(t)}a.retry(t)||s(a.mainError())}}var u}))}));t.exports=s,t.exports.default=s,t.exports.AbortError=o},58147:t=>{"use strict";class e extends Error{constructor(t){super(t),this.name="TimeoutError"}}const n=(t,n,r,i)=>{let o;const s=new Promise(((s,a)=>{if("number"!=typeof n||n<0)throw new TypeError("Expected `milliseconds` to be a positive number");n!==1/0?(i={customTimers:{setTimeout,clearTimeout},...i},o=i.customTimers.setTimeout.call(void 0,(()=>{if("function"==typeof r){try{s(r())}catch(t){a(t)}return}const i=r instanceof Error?r:new e("string"==typeof r?r:`Promise timed out after ${n} milliseconds`);"function"==typeof t.cancel&&t.cancel(),a(i)}),n),(async()=>{try{s(await t)}catch(t){a(t)}finally{i.customTimers.clearTimeout.call(void 0,o)}})()):s(t)}));return s.clear=()=>{clearTimeout(o),o=void 0},s};t.exports=n,t.exports.default=n,t.exports.TimeoutError=e},52818:(t,e,n)=>{"use strict";var r=n(39809);e.certificate=n(41934);var i=r.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())}));e.RSAPrivateKey=i;var o=r.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));e.RSAPublicKey=o;var s=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}));e.PublicKey=s;var a=r.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())})),u=r.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(a),this.key("subjectPrivateKey").octstr())}));e.PrivateKey=u;var c=r.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())}));e.EncryptedPrivateKey=c;var d=r.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())}));e.DSAPrivateKey=d,e.DSAparam=r.define("DSAparam",(function(){this.int()}));var l=r.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())}));e.ECPrivateKey=l;var h=r.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));e.signature=r.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},41934:(t,e,n)=>{"use strict";var r=n(39809),i=r.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=r.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),s=r.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),a=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())})),u=r.define("RelativeDistinguishedName",(function(){this.setof(o)})),c=r.define("RDNSequence",(function(){this.seqof(u)})),d=r.define("Name",(function(){this.choice({rdnSequence:this.use(c)})})),l=r.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))})),h=r.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),f=r.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(s),this.key("issuer").use(d),this.key("validity").use(l),this.key("subject").use(d),this.key("subjectPublicKeyInfo").use(a),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(h).optional())})),p=r.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(f),this.key("signatureAlgorithm").use(s),this.key("signatureValue").bitstr())}));t.exports=p},77631:(t,e,n)=>{var r=/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,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,s=n(13048),a=n(44696),u=n(89509).Buffer;t.exports=function(t,e){var n,c=t.toString(),d=c.match(r);if(d){var l="aes"+d[1],h=u.from(d[2],"hex"),f=u.from(d[3].replace(/[\r\n]/g,""),"base64"),p=s(e,h.slice(0,8),parseInt(d[1],10)).key,m=[],g=a.createDecipheriv(l,p,h);m.push(g.update(f)),m.push(g.final()),n=u.concat(m)}else{var y=c.match(o);n=u.from(y[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(i)[1],data:n}}},70980:(t,e,n)=>{var r=n(52818),i=n(22562),o=n(77631),s=n(44696),a=n(25632),u=n(89509).Buffer;function c(t){var e;"object"!=typeof t||u.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=u.from(t));var n,c,d=o(t,e),l=d.tag,h=d.data;switch(l){case"CERTIFICATE":c=r.certificate.decode(h,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=r.PublicKey.decode(h,"der")),n=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=r.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+n)}case"ENCRYPTED PRIVATE KEY":h=function(t,e){var n=t.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[t.algorithm.decrypt.cipher.algo.join(".")],c=t.algorithm.decrypt.cipher.iv,d=t.subjectPrivateKey,l=parseInt(o.split("-")[1],10)/8,h=a.pbkdf2Sync(e,n,r,l,"sha1"),f=s.createDecipheriv(o,h,c),p=[];return p.push(f.update(d)),p.push(f.final()),u.concat(p)}(h=r.EncryptedPrivateKey.decode(h,"der"),e);case"PRIVATE KEY":switch(n=(c=r.PrivateKey.decode(h,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:r.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=r.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+n)}case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(h,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(h,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(h,"der")};case"EC PRIVATE KEY":return{curve:(h=r.ECPrivateKey.decode(h,"der")).parameters.value,privateKey:h.privateKey};default:throw new Error("unknown key type "+l)}}t.exports=c,c.signature=r.signature},25632:(t,e,n)=>{e.pbkdf2=n(88638),e.pbkdf2Sync=n(91257)},88638:(t,e,n)=>{var r,i,o=n(89509).Buffer,s=n(77357),a=n(12368),u=n(91257),c=n(57777),d=n.g.crypto&&n.g.crypto.subtle,l={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"},h=[];function f(){return i||(i=n.g.process&&n.g.process.nextTick?n.g.process.nextTick:n.g.queueMicrotask?n.g.queueMicrotask:n.g.setImmediate?n.g.setImmediate:n.g.setTimeout)}function p(t,e,n,r,i){return d.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return d.deriveBits({name:"PBKDF2",salt:e,iterations:n,hash:{name:i}},t,r<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,e,i,m,g,y){"function"==typeof g&&(y=g,g=void 0);var b=l[(g=g||"sha1").toLowerCase()];if(b&&"function"==typeof n.g.Promise){if(s(i,m),t=c(t,a,"Password"),e=c(e,a,"Salt"),"function"!=typeof y)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){f()((function(){e(null,t)}))}),(function(t){f()((function(){e(t)}))}))}(function(t){if(n.g.process&&!n.g.process.browser)return Promise.resolve(!1);if(!d||!d.importKey||!d.deriveBits)return Promise.resolve(!1);if(void 0!==h[t])return h[t];var e=p(r=r||o.alloc(8),r,10,128,t).then((function(){return!0})).catch((function(){return!1}));return h[t]=e,e}(b).then((function(n){return n?p(t,e,i,m,b):u(t,e,i,m,g)})),y)}else f()((function(){var n;try{n=u(t,e,i,m,g)}catch(t){return y(t)}y(null,n)}))}},12368:(t,e,n)=>{var r,i=n(34155);r=n.g.process&&n.g.process.browser?"utf-8":n.g.process&&n.g.process.version?parseInt(i.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",t.exports=r},77357:t=>{var e=Math.pow(2,30)-1;t.exports=function(t,n){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof n)throw new TypeError("Key length not a number");if(n<0||n>e||n!=n)throw new TypeError("Bad key length")}},91257:(t,e,n)=>{var r=n(78028),i=n(79785),o=n(89072),s=n(89509).Buffer,a=n(77357),u=n(12368),c=n(57777),d=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function h(t,e,n){var a=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new i).update(t).digest()}:"md5"===t?r:function(e){return o(t).update(e).digest()}}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=a(e):e.length{var r=n(89509).Buffer;t.exports=function(t,e,n){if(r.isBuffer(t))return t;if("string"==typeof t)return r.from(t,e);if(ArrayBuffer.isView(t))return r.from(t.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")}},34155:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,u=[],c=!1,d=-1;function l(){c&&a&&(c=!1,a.length?u=a.concat(u):d=-1,u.length&&h())}function h(){if(!c){var t=s(l);c=!0;for(var e=u.length;e;){for(a=u,u=[];++d1)for(var n=1;n{e.publicEncrypt=n(16559),e.privateDecrypt=n(26138),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}},99199:(t,e,n)=>{var r=n(23482),i=n(89509).Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var n,s=i.alloc(0),a=0;s.length=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},26138:(t,e,n)=>{var r=n(70980),i=n(99199),o=n(57859),s=n(92144),a=n(23663),u=n(23482),c=n(84818),d=n(89509).Buffer;t.exports=function(t,e,n){var l;l=t.padding?t.padding:n?1:4;var h,f=r(t),p=f.modulus.byteLength();if(e.length>p||new s(e).cmp(f.modulus)>=0)throw new Error("decryption error");h=n?c(new s(e),f):a(e,f);var m=d.alloc(p-h.length);if(h=d.concat([m,h],p),4===l)return function(t,e){var n=t.modulus.byteLength(),r=u("sha1").update(d.alloc(0)).digest(),s=r.length;if(0!==e[0])throw new Error("decryption error");var a=e.slice(1,s+1),c=e.slice(s+1),l=o(a,i(c,s)),h=o(c,i(l,n-s-1));if(function(t,e){t=d.from(t),e=d.from(e);var n=0,r=t.length;t.length!==e.length&&(n++,r=Math.min(t.length,e.length));for(var i=-1;++i=e.length){o++;break}var s=e.slice(2,i-1);if(("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return e.slice(i)}(0,h,n);if(3===l)return h;throw new Error("unknown padding")}},16559:(t,e,n)=>{var r=n(70980),i=n(61798),o=n(23482),s=n(99199),a=n(57859),u=n(92144),c=n(84818),d=n(23663),l=n(89509).Buffer;t.exports=function(t,e,n){var h;h=t.padding?t.padding:n?1:4;var f,p=r(t);if(4===h)f=function(t,e){var n=t.modulus.byteLength(),r=e.length,c=o("sha1").update(l.alloc(0)).digest(),d=c.length,h=2*d;if(r>n-h-2)throw new Error("message too long");var f=l.alloc(n-r-h-2),p=n-d-1,m=i(d),g=a(l.concat([c,f,l.alloc(1,1),e],p),s(m,p)),y=a(m,s(g,d));return new u(l.concat([l.alloc(1),y,g],n))}(p,e);else if(1===h)f=function(t,e,n){var r,o=e.length,s=t.modulus.byteLength();if(o>s-11)throw new Error("message too long");return r=n?l.alloc(s-o-3,255):function(t){for(var e,n=l.allocUnsafe(t),r=0,o=i(2*t),s=0;r=0)throw new Error("data too long for modulus")}return n?d(f,p):c(f,p)}},84818:(t,e,n)=>{var r=n(92144),i=n(89509).Buffer;t.exports=function(t,e){return i.from(t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed().toArray())}},57859:t=>{t.exports=function(t,e){for(var n=t.length,r=-1;++r{"use strict";var r=n(34155),i=65536,o=n(89509).Buffer,s=n.g.crypto||n.g.msCrypto;s&&s.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var n=o.allocUnsafe(t);if(t>0)if(t>i)for(var a=0;a{"use strict";var r=n(34155);function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=n(89509),s=n(61798),a=o.Buffer,u=o.kMaxLength,c=n.g.crypto||n.g.msCrypto,d=Math.pow(2,32)-1;function l(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>d||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function h(t,e,n){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>d||t<0)throw new TypeError("size must be a uint32");if(t+e>n||t>u)throw new RangeError("buffer too small")}function f(t,e,n,i){if(r.browser){var o=t.buffer,a=new Uint8Array(o,e,n);return c.getRandomValues(a),i?void r.nextTick((function(){i(null,t)})):t}if(!i)return s(n).copy(t,e),t;s(n,(function(n,r){if(n)return i(n);r.copy(t,e),i(null,t)}))}c&&c.getRandomValues||!r.browser?(e.randomFill=function(t,e,r,i){if(!(a.isBuffer(t)||t instanceof n.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)i=e,e=0,r=t.length;else if("function"==typeof r)i=r,r=t.length-e;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return l(e,t.length),h(r,e,t.length),f(t,e,r,i)},e.randomFillSync=function(t,e,r){if(void 0===e&&(e=0),!(a.isBuffer(t)||t instanceof n.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return l(e,t.length),void 0===r&&(r=t.length-e),h(r,e,t.length),f(t,e,r)}):(e.randomFill=i,e.randomFillSync=i)},99353:(t,e,n)=>{t.exports=n(71846)},71846:(t,e,n)=>{var r=n(41960);e.operation=function(t){var n=e.timeouts(t);return new r(n,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],i=0;i{function e(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){n._operationTimeoutCb()}),n._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},e.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},e.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,n=0,r=0;r=n&&(e=i,n=s)}return e}},79785:(t,e,n)=>{"use strict";var r=n(48764).Buffer,i=n(35717),o=n(3349),s=new Array(16),a=[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],u=[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],c=[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],d=[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],l=[0,1518500249,1859775393,2400959708,2840853838],h=[1352829926,1548603684,1836072691,2053994217,0];function f(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function m(t,e,n,r,i,o,s,a){return p(t+(e^n^r)+o+s|0,a)+i|0}function g(t,e,n,r,i,o,s,a){return p(t+(e&n|~e&r)+o+s|0,a)+i|0}function y(t,e,n,r,i,o,s,a){return p(t+((e|~n)^r)+o+s|0,a)+i|0}function b(t,e,n,r,i,o,s,a){return p(t+(e&r|n&~r)+o+s|0,a)+i|0}function w(t,e,n,r,i,o,s,a){return p(t+(e^(n|~r))+o+s|0,a)+i|0}i(f,o),f.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,f=0|this._e,_=0|this._a,v=0|this._b,k=0|this._c,M=0|this._d,A=0|this._e,S=0;S<80;S+=1){var I,x;S<16?(I=m(n,r,i,o,f,t[a[S]],l[0],c[S]),x=w(_,v,k,M,A,t[u[S]],h[0],d[S])):S<32?(I=g(n,r,i,o,f,t[a[S]],l[1],c[S]),x=b(_,v,k,M,A,t[u[S]],h[1],d[S])):S<48?(I=y(n,r,i,o,f,t[a[S]],l[2],c[S]),x=y(_,v,k,M,A,t[u[S]],h[2],d[S])):S<64?(I=b(n,r,i,o,f,t[a[S]],l[3],c[S]),x=g(_,v,k,M,A,t[u[S]],h[3],d[S])):(I=w(n,r,i,o,f,t[a[S]],l[4],c[S]),x=m(_,v,k,M,A,t[u[S]],h[4],d[S])),n=f,f=o,o=p(i,10),i=r,r=I,_=A,A=M,M=p(k,10),k=v,v=x}var E=this._b+i+M|0;this._b=this._c+o+A|0,this._c=this._d+f+_|0,this._d=this._e+n+v|0,this._e=this._a+r+k|0,this._a=E},f.prototype._digest=function(){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 t=r.alloc?r.alloc(20):new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=f},66855:(t,e,n)=>{"use strict";var r=n(48764).Buffer;const i=n(26729),o=n(70395);class s extends i.EventEmitter{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(t,e="ws://localhost:8080",{autoconnect:n=!0,reconnect:r=!0,reconnect_interval:i=1e3,max_reconnects:s=5,...a}={},u,c){super(),this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=e,this.autoconnect=n,this.ready=!1,this.reconnect=r,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=s,this.rest_options=a,this.current_reconnects=0,this.generate_request_id=u||(()=>++this.rpc_id),this.dataPack=c||new o.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,e,n,r){return r||"object"!=typeof n||(r=n,n=null),new Promise(((i,o)=>{if(!this.ready)return o(new Error("socket not ready"));const s=this.generate_request_id(t,e),a={jsonrpc:"2.0",method:t,params:e||void 0,id:s};this.socket.send(this.dataPack.encode(a),r,(t=>{if(t)return o(t);this.queue[s]={promise:[i,o]},n&&(this.queue[s].timeout=setTimeout((()=>{delete this.queue[s],o(new Error("reply timeout"))}),n))}))}))}async login(t){const e=await this.call("rpc.login",t);if(!e)throw new Error("authentication failed");return e}async listMethods(){return await this.call("__listMethods")}notify(t,e){return new Promise(((n,r)=>{if(!this.ready)return r(new Error("socket not ready"));const i={jsonrpc:"2.0",method:t,params:e};this.socket.send(this.dataPack.encode(i),(t=>{if(t)return r(t);n()}))}))}async subscribe(t){"string"==typeof t&&(t=[t]);const e=await this.call("rpc.on",t);if("string"==typeof t&&"ok"!==e[t])throw new Error("Failed subscribing to an event '"+t+"' with: "+e[t]);return e}async unsubscribe(t){"string"==typeof t&&(t=[t]);const e=await this.call("rpc.off",t);if("string"==typeof t&&"ok"!==e[t])throw new Error("Failed unsubscribing from an event with: "+e);return e}close(t,e){this.socket.close(t||1e3,e)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}_connect(t,e){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0})),this.socket.addEventListener("message",(({data:t})=>{t instanceof ArrayBuffer&&(t=r.from(t).toString());try{t=this.dataPack.decode(t)}catch(t){return}if(t.notification&&this.listeners(t.notification).length){if(!Object.keys(t.params).length)return this.emit(t.notification);const e=[t.notification];if(t.params.constructor===Object)e.push(t.params);else for(let n=0;n{this.emit.apply(this,e)}))}if(!this.queue[t.id])return t.method?Promise.resolve().then((()=>{this.emit(t.method,t?.params)})):void 0;"error"in t=="result"in t&&this.queue[t.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[t.id].timeout&&clearTimeout(this.queue[t.id].timeout),t.error?this.queue[t.id].promise[1](t.error):this.queue[t.id].promise[0](t.result),delete this.queue[t.id]})),this.socket.addEventListener("error",(t=>this.emit("error",t))),this.socket.addEventListener("close",(({code:n,reason:r})=>{this.ready&&setTimeout((()=>this.emit("close",n,r)),0),this.ready=!1,this.socket=void 0,1e3!==n&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)&&(this.reconnect_timer_id=setTimeout((()=>this._connect(t,e)),this.reconnect_interval)))}))}}e.Z=s},89062:(t,e,n)=>{"use strict";const r=n(26729);class i extends r.EventEmitter{socket;constructor(t,e,n){super(),this.socket=new window.WebSocket(t,n),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=t=>this.emit("message",t.data),this.socket.onerror=t=>this.emit("error",t),this.socket.onclose=t=>{this.emit("close",t.code,t.reason)}}send(t,e,n){const r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}close(t,e){this.socket.close(t,e)}addEventListener(t,e,n){this.socket.addEventListener(t,e,n)}}e.Z=function(t,e){return new i(t,e)}},70395:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createError=e.DefaultDataPack=void 0;const n=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]);e.DefaultDataPack=class{encode(t){return JSON.stringify(t)}decode(t){return JSON.parse(t)}},e.createError=function(t,e){const r={code:t,message:n.get(t)||"Internal Server Error"};return e&&(r.data=e),r}},89509:(t,e,n)=>{var r=n(48764),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},2399:(t,e,n)=>{"use strict";var r,i=n(34155),o=n(48764),s=o.Buffer,a={};for(r in o)o.hasOwnProperty(r)&&"SlowBuffer"!==r&&"Buffer"!==r&&(a[r]=o[r]);var u=a.Buffer={};for(r in s)s.hasOwnProperty(r)&&"allocUnsafe"!==r&&"allocUnsafeSlow"!==r&&(u[r]=s[r]);if(a.Buffer.prototype=s.prototype,u.from&&u.from!==Uint8Array.from||(u.from=function(t,e,n){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return s(t,e,n)}),u.alloc||(u.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=s(t);return e&&0!==e.length?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r}),!a.kStringMaxLength)try{a.kStringMaxLength=i.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a},24189:(t,e,n)=>{var r=n(89509).Buffer;function i(t,e){this._block=r.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=r.from(t,e));for(var n=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},89072:(t,e,n)=>{var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=n(74448),r.sha1=n(18336),r.sha224=n(48432),r.sha256=n(67499),r.sha384=n(51686),r.sha512=n(87816)},74448:(t,e,n)=>{var r=n(35717),i=n(24189),o=n(89509).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t){return t<<30|t>>>2}function d(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,l=0;l<16;++l)n[l]=t.readInt32BE(4*l);for(;l<80;++l)n[l]=n[l-3]^n[l-8]^n[l-14]^n[l-16];for(var h=0;h<80;++h){var f=~~(h/20),p=0|((e=r)<<5|e>>>27)+d(f,i,o,a)+u+n[h]+s[f];u=a,a=o,o=c(i),i=r,r=p}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},18336:(t,e,n)=>{var r=n(35717),i=n(24189),o=n(89509).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function d(t){return t<<30|t>>>2}function l(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,h=0;h<16;++h)n[h]=t.readInt32BE(4*h);for(;h<80;++h)n[h]=(e=n[h-3]^n[h-8]^n[h-14]^n[h-16])<<1|e>>>31;for(var f=0;f<80;++f){var p=~~(f/20),m=c(r)+l(p,i,o,a)+u+n[f]+s[p]|0;u=a,a=o,o=d(i),i=r,r=m}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},48432:(t,e,n)=>{var r=n(35717),i=n(67499),o=n(24189),s=n(89509).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}r(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},67499:(t,e,n)=>{var r=n(35717),i=n(24189),o=n(89509).Buffer,s=[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],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t,e,n){return n^t&(e^n)}function d(t,e,n){return t&e|n&(t|e)}function l(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function h(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function f(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}r(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)n[y]=t.readInt32BE(4*y);for(;y<64;++y)n[y]=0|(((e=n[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+n[y-7]+f(n[y-15])+n[y-16];for(var b=0;b<64;++b){var w=g+h(u)+c(u,p,m)+s[b]+n[b]|0,_=l(r)+d(r,i,o)|0;g=m,m=p,p=u,u=a+w|0,a=o,o=i,i=r,r=w+_|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},51686:(t,e,n)=>{var r=n(35717),i=n(87816),o=n(24189),s=n(89509).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}r(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},87816:(t,e,n)=>{var r=n(35717),i=n(24189),o=n(89509).Buffer,s=[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],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function c(t,e,n){return n^t&(e^n)}function d(t,e,n){return t&e|n&(t|e)}function l(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function h(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0>>0?1:0}r(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,w=0|this._hh,_=0|this._al,v=0|this._bl,k=0|this._cl,M=0|this._dl,A=0|this._el,S=0|this._fl,I=0|this._gl,x=0|this._hl,E=0;E<32;E+=2)e[E]=t.readInt32BE(4*E),e[E+1]=t.readInt32BE(4*E+4);for(;E<160;E+=2){var T=e[E-30],P=e[E-30+1],B=f(T,P),L=p(P,T),$=m(T=e[E-4],P=e[E-4+1]),R=g(P,T),O=e[E-14],D=e[E-14+1],C=e[E-32],N=e[E-32+1],z=L+D|0,U=B+O+y(z,L)|0;U=(U=U+$+y(z=z+R|0,R)|0)+C+y(z=z+N|0,N)|0,e[E]=U,e[E+1]=z}for(var j=0;j<160;j+=2){U=e[j],z=e[j+1];var Y=d(n,r,i),F=d(_,v,k),W=l(n,_),H=l(_,n),K=h(a,A),q=h(A,a),V=s[j],G=s[j+1],Z=c(a,u,b),X=c(A,S,I),J=x+q|0,Q=w+K+y(J,x)|0;Q=(Q=(Q=Q+Z+y(J=J+X|0,X)|0)+V+y(J=J+G|0,G)|0)+U+y(J=J+z|0,z)|0;var tt=H+F|0,et=W+Y+y(tt,H)|0;w=b,x=I,b=u,I=S,u=a,S=A,a=o+Q+y(A=M+J|0,M)|0,o=i,M=k,i=r,k=v,r=n,v=_,n=Q+et+y(_=J+tt|0,J)|0}this._al=this._al+_|0,this._bl=this._bl+v|0,this._cl=this._cl+k|0,this._dl=this._dl+M|0,this._el=this._el+A|0,this._fl=this._fl+S|0,this._gl=this._gl+I|0,this._hl=this._hl+x|0,this._ah=this._ah+n+y(this._al,_)|0,this._bh=this._bh+r+y(this._bl,v)|0,this._ch=this._ch+i+y(this._cl,k)|0,this._dh=this._dh+o+y(this._dl,M)|0,this._eh=this._eh+a+y(this._el,A)|0,this._fh=this._fh+u+y(this._fl,S)|0,this._gh=this._gh+b+y(this._gl,I)|0,this._hh=this._hh+w+y(this._hl,x)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},42830:(t,e,n)=>{t.exports=i;var r=n(17187).EventEmitter;function i(){r.call(this)}n(35717)(i,r),i.Readable=n(56577),i.Writable=n(20323),i.Duplex=n(68656),i.Transform=n(94473),i.PassThrough=n(2366),i.finished=n(81086),i.pipeline=n(56472),i.Stream=i,i.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",a),n.on("close",u));var s=!1;function a(){s||(s=!0,t.end())}function u(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(d(),0===r.listenerCount(this,"error"))throw t}function d(){n.removeListener("data",i),t.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",u),n.removeListener("error",c),t.removeListener("error",c),n.removeListener("end",d),n.removeListener("close",d),t.removeListener("close",d)}return n.on("error",c),t.on("error",c),n.on("end",d),n.on("close",d),t.on("close",d),t.emit("pipe",n),t}},58106:t=>{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,4)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-9,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var c=("number"!=typeof u&&(u=0),u+1>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(r(e,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},68656:(t,e,n)=>{"use strict";var r=n(34155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=d;var o=n(56577),s=n(20323);n(35717)(d,o);for(var a=i(s.prototype),u=0;u{"use strict";t.exports=i;var r=n(94473);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(35717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},56577:(t,e,n)=>{"use strict";var r,i=n(34155);t.exports=S,S.ReadableState=A,n(17187).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=n(83194),u=n(48764).Buffer,c=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=n(40964);o=d&&d.debuglog?d.debuglog("stream"):function(){};var l,h,f,p=n(39686),m=n(71029),g=n(13383).getHighWaterMark,y=n(58106).q,b=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(35717)(S,a);var k=m.errorOrDestroy,M=["error","close","destroy","pause","resume"];function A(t,e,i){r=r||n(68656),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(54729).s),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function S(t){if(r=r||n(68656),!(this instanceof S))return new S(t);var e=this instanceof r;this._readableState=new A(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function I(t,e,n,r,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(i||(s=function(t,e){var n,r;return r=e,u.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],e)),n}(a,e)),s)k(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r)a.endEmitted?k(t,new v):x(t,a,e,!0);else if(a.ended)k(t,new w);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):L(t,a)):x(t,a,e,!1)}else r||(a.reading=!1,L(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function P(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(B,t))}function B(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function L(t,e){e.readingMore||(e.readingMore=!0,i.nextTick($,t,e))}function $(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function z(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function j(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?z(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&z(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&z(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(t){k(this,new _("_read()"))},S.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?m:u;function u(){o("onend"),t.end()}r.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",f),t.removeListener("finish",p),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",e),n.removeListener("end",u),n.removeListener("end",m),n.removeListener("data",l),d=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(n);t.on("drain",c);var d=!1;function l(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==j(r.pipes,t))&&!d&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function h(e){o("onerror",e),m(),t.removeListener("error",h),0===s(t,"error")&&k(t,e)}function f(){t.removeListener("finish",p),m()}function p(){o("onfinish"),t.removeListener("close",f),m()}function m(){o("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",h),t.once("close",f),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?P(this):r.reading||i.nextTick(O,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(R,this),n},S.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(R,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(D,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s{"use strict";t.exports=d;var r=n(58106).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(68656);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var r,i=n(34155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=S,S.WritableState=A;var s,a={deprecate:n(94927)},u=n(83194),c=n(48764).Buffer,d=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=n(71029),h=n(13383).getHighWaterMark,f=n(58106).q,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,w=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,v=f.ERR_UNKNOWN_ENCODING,k=l.errorOrDestroy;function M(){}function A(t,e,s){r=r||n(68656),t=t||{},"boolean"!=typeof s&&(s=e instanceof r),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(B,t,e),t._writableState.errorEmitted=!0,k(t,r)):(o(r),t._writableState.errorEmitted=!0,k(t,r),B(t,e))}(t,n,r,e,o);else{var s=T(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(t,n),r?i.nextTick(x,t,n,s,o):x(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function S(t){var e=this instanceof(r=r||n(68656));if(!e&&!s.call(S,this))return new S(t);this._writableState=new A(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function I(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function x(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),B(t,e)}function E(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,I(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,d=n.encoding,l=n.callback;if(I(t,e,!1,e.objectMode?1:c.length,c,d,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(n){e.pendingcb--,n&&k(t,n),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var n=T(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(35717)(S,u),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===S&&t&&t._writableState instanceof A}})):s=function(t){return t instanceof this},S.prototype.pipe=function(){k(this,new y)},S.prototype.write=function(t,e,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=t,c.isBuffer(r)||r instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=M),o.ending?function(t,e){var n=new _;k(t,n),i.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o;return null===n?o=new w:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(k(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,n){n(new m("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,B(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(t,e){e(t)}},20828:(t,e,n)=>{"use strict";var r,i=n(34155);function o(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=n(81086),a=Symbol("lastResolve"),u=Symbol("lastReject"),c=Symbol("error"),d=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(t,e){return{value:t,done:e}}function m(t){var e=t[a];if(null!==e){var n=t[f].read();null!==n&&(t[l]=null,t[a]=null,t[u]=null,e(p(n,!1)))}}function g(t){i.nextTick(m,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(r={get stream(){return this[f]},next:function(){var t=this,e=this[c];if(null!==e)return Promise.reject(e);if(this[d])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[c]?n(t[c]):e(p(void 0,!0))}))}));var n,r=this[l];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[d]?n(p(void 0,!0)):e[h](n,r)}),r)}}(r,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),y);t.exports=function(t){var e,n=Object.create(b,(o(e={},f,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,c,{value:null,writable:!0}),o(e,d,{value:t._readableState.endEmitted,writable:!0}),o(e,h,{value:function(t,e){var r=n[f].read();r?(n[l]=null,n[a]=null,n[u]=null,t(p(r,!1))):(n[a]=t,n[u]=e)},writable:!0}),e));return n[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[u];return null!==e&&(n[l]=null,n[a]=null,n[u]=null,e(t)),void(n[c]=t)}var r=n[a];null!==r&&(n[l]=null,n[a]=null,n[u]=null,r(p(void 0,!0))),n[d]=!0})),t.on("readable",g.bind(null,n)),n}},39686:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return u.alloc(0);for(var e,n,r,i=u.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,u.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=u.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:d,value:function(t,e){return c(this,i(i({},e),{},{depth:0,customInspect:!1}))}}])&&s(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},71029:(t,e,n)=>{"use strict";var r=n(34155);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(s,this,t)):r.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},81086:(t,e,n)=>{"use strict";var r=n(58106).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},56472:(t,e,n)=>{"use strict";var r,i=n(58106).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t){t()}function c(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),i=0;i0,(function(t){d||(d=t),t&&h.forEach(u),o||(h.forEach(u),l(d))}))}));return e.reduce(c)}},13383:(t,e,n)=>{"use strict";var r=n(58106).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},83194:(t,e,n)=>{t.exports=n(17187).EventEmitter},54729:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=d,this.end=l,e=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function d(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},6941:(t,e,n)=>{var r=n(48764).Buffer,i=r.isEncoding||function(t){switch(t&&t.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}},o=e.s=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!i(t))throw new Error("Unknown encoding: "+t)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=u;break;default:return void(this.write=s)}this.charBuffer=new r(6),this.charReceived=0,this.charLength=0};function s(t){return t.toString(this.encoding)}function a(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function u(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}o.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r,i=t.length;if(this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),i=(e+=t.toString(this.encoding,0,i)).length-1,(r=e.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,i)}return e},o.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},o.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},26018:t=>{"use strict";t.exports=function(t,e){if(!t)throw new Error("Invariant failed")}},94927:(t,e,n)=>{function r(t){try{if(!n.g.localStorage)return!1}catch(t){return!1}var e=n.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}},74608:(t,e,n)=>{"use strict";var r;n.d(e,{v4:()=>d});var i=new Uint8Array(16);function o(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var a=[],u=0;u<256;++u)a.push((u+256).toString(16).substr(1));const c=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(a[t[e+0]]+a[t[e+1]]+a[t[e+2]]+a[t[e+3]]+"-"+a[t[e+4]]+a[t[e+5]]+"-"+a[t[e+6]]+a[t[e+7]]+"-"+a[t[e+8]]+a[t[e+9]]+"-"+a[t[e+10]]+a[t[e+11]]+a[t[e+12]]+a[t[e+13]]+a[t[e+14]]+a[t[e+15]]).toLowerCase();if(!function(t){return"string"==typeof t&&s.test(t)}(n))throw TypeError("Stringified UUID is invalid");return n},d=function(t,e,n){var r=(t=t||{}).random||(t.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return c(r)}},80950:()=>{},46601:()=>{},89214:()=>{},96419:()=>{},56353:()=>{},8623:()=>{},7748:()=>{},85568:()=>{},69386:()=>{},31616:()=>{},56619:()=>{},77108:()=>{},69862:()=>{},40964:()=>{},66115:t=>{t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports},17156:t=>{function e(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function a(t){e(s,i,o,a,u,"next",t)}function u(t){e(s,i,o,a,u,"throw",t)}a(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},56690:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},89728:(t,e,n)=>{var r=n(64062);function i(t,e){for(var n=0;n{function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},61655:(t,e,n)=>{var r=n(6015);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&r(t,e)},t.exports.__esModule=!0,t.exports.default=t.exports},64836:t=>{t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},94993:(t,e,n)=>{var r=n(18698).default,i=n(66115);t.exports=function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return i(t)},t.exports.__esModule=!0,t.exports.default=t.exports},17061:(t,e,n)=>{var r=n(18698).default;function i(){"use strict";t.exports=i=function(){return n},t.exports.__esModule=!0,t.exports.default=t.exports;var e,n={},o=Object.prototype,s=o.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",d=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function h(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(e){h=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof _?e:_,o=Object.create(i.prototype),s=new $(r||[]);return a(o,"_invoke",{value:T(t,n,s)}),o}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=f;var m="suspendedStart",g="suspendedYield",y="executing",b="completed",w={};function _(){}function v(){}function k(){}var M={};h(M,c,(function(){return this}));var A=Object.getPrototypeOf,S=A&&A(A(R([])));S&&S!==o&&s.call(S,c)&&(M=S);var I=k.prototype=_.prototype=Object.create(M);function x(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,a,u){var c=p(t[i],t,o);if("throw"!==c.type){var d=c.arg,l=d.value;return l&&"object"==r(l)&&s.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){d.value=t,a(d)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(o,o):o()}})}function T(t,n,r){var i=m;return function(o,s){if(i===y)throw new Error("Generator is already running");if(i===b){if("throw"===o)throw s;return{value:e,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=P(a,r);if(u){if(u===w)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===m)throw i=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=y;var c=p(t,n,r);if("normal"===c.type){if(i=r.done?b:g,c.arg===w)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=b,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),w;var o=p(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,w;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,w):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,w)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function $(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function R(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(u&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),w}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),w}},n}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},6015:t=>{function e(n,r){return t.exports=e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n,r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},95036:(t,e,n)=>{var r=n(18698).default;t.exports=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},64062:(t,e,n)=>{var r=n(18698).default,i=n(95036);t.exports=function(t){var e=i(t,"string");return"symbol"==r(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},18698:t=>{function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},64687:(t,e,n)=>{var r=n(17061)();t.exports=r;try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},26578:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encodeDecode=void 0,e.encodeDecode=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)})},80802:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.u256be=e.u256=e.u192be=e.u192=e.u128be=e.u128=e.u64be=e.u64=e.bigIntBE=e.bigInt=void 0;const i=n(39386),o=n(40475),s=n(26578);e.bigInt=t=>e=>{const n=(0,i.blob)(t,e),{encode:a,decode:u}=(0,s.encodeDecode)(n),c=n;return c.decode=(t,e)=>{const n=u(t,e);return(0,o.toBigIntLE)(r.from(n))},c.encode=(e,n,r)=>{const i=(0,o.toBufferLE)(e,t);return a(i,n,r)},c},e.bigIntBE=t=>e=>{const n=(0,i.blob)(t,e),{encode:a,decode:u}=(0,s.encodeDecode)(n),c=n;return c.decode=(t,e)=>{const n=u(t,e);return(0,o.toBigIntBE)(r.from(n))},c.encode=(e,n,r)=>{const i=(0,o.toBufferBE)(e,t);return a(i,n,r)},c},e.u64=(0,e.bigInt)(8),e.u64be=(0,e.bigIntBE)(8),e.u128=(0,e.bigInt)(16),e.u128be=(0,e.bigIntBE)(16),e.u192=(0,e.bigInt)(24),e.u192be=(0,e.bigIntBE)(24),e.u256=(0,e.bigInt)(32),e.u256be=(0,e.bigIntBE)(32)},54195:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.decimal=e.WAD=void 0;const i=r(n(44431)),o=n(26578),s=n(80802);e.WAD=new i.default("1e+18"),e.decimal=t=>{const n=(0,s.u128)(t),{encode:r,decode:a}=(0,o.encodeDecode)(n),u=n;return u.decode=(t,n)=>{const r=a(t,n).toString();return new i.default(r).div(e.WAD)},u.encode=(t,n,i)=>{const o=BigInt(t.times(e.WAD).integerValue().toString());return r(o,n,i)},u}},27278:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(26578),e),i(n(80802),e),i(n(54195),e),i(n(48670),e),i(n(62885),e)},48670:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bool=void 0;const r=n(39386),i=n(26578);e.bool=t=>{const e=(0,r.u8)(t),{encode:n,decode:o}=(0,i.encodeDecode)(e),s=e;return s.decode=(t,e)=>!!o(t,e),s.encode=(t,e,r)=>{const i=Number(t);return n(i,e,r)},s}},62885:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.publicKey=void 0;const r=n(39386),i=n(68716),o=n(26578);e.publicKey=t=>{const e=(0,r.blob)(32,t),{encode:n,decode:s}=(0,o.encodeDecode)(e),a=e;return a.decode=(t,e)=>{const n=s(t,e);return new i.PublicKey(n)},a.encode=(t,e,r)=>{const i=t.toBuffer();return n(i,e,r)},a}},21433:(t,e)=>{"use strict";function n(t,e,n,r=0){const i=n.length-r;if(i{if(t.length>=e)return t;const n=new Uint8Array(e).fill(0);return n.set(t),n},i=(t,e)=>r(t.length<=e?t:t.slice(0,e),e);function o(t,e){return"fixedSize"in e?e.fixedSize:e.getSizeFromValue(t)}function s(t){return Object.freeze({...t,encode:e=>{const n=new Uint8Array(o(e,t));return t.write(e,n,0),n}})}function a(t){return Object.freeze({...t,decode:(e,n=0)=>t.read(e,n)[0]})}function u(t){return Object.freeze({...t,decode:(e,n=0)=>t.read(e,n)[0],encode:e=>{const n=new Uint8Array(o(e,t));return t.write(e,n,0),n}})}function c(t){return"fixedSize"in t&&"number"==typeof t.fixedSize}function d(t,e){if(!c(t))throw new Error(e??"Expected a fixed-size codec, got a variable-size one.")}function l(t){return!c(t)}function h(t,e){if(c(t)!==c(e))throw new Error("Encoder and decoder must either both be fixed-size or variable-size.");if(c(t)&&c(e)&&t.fixedSize!==e.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${t.fixedSize}] and [${e.fixedSize}].`);if(!c(t)&&!c(e)&&t.maxSize!==e.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${t.maxSize}] and [${e.maxSize}].`);return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}}function f(t,e){return s({fixedSize:e,write:(n,r,i)=>{const o=t.encode(n),s=o.length>e?o.slice(0,e):o;return r.set(s,i),i+e}})}function p(t,e){return a({fixedSize:e,read:(r,o)=>{n("fixCodec",e,r,o),(o>0||r.length>e)&&(r=r.slice(o,o+e)),c(t)&&(r=i(r,t.fixedSize));const[s]=t.read(r,0);return[s,o+e]}})}function m(t,e){return s({...l(t)?{...t,getSizeFromValue:n=>t.getSizeFromValue(e(n))}:t,write:(n,r,i)=>t.write(e(n),r,i)})}function g(t,e){return a({...t,read:(n,r)=>{const[i,o]=t.read(n,r);return[e(i,n,r),o]}})}function y(t){return d(t,"Cannot reverse a codec of variable size."),s({...t,write:(e,n,r)=>{const i=t.write(e,n,r),o=n.slice(r,r+t.fixedSize).reverse();return n.set(o,r),i}})}function b(t){return d(t,"Cannot reverse a codec of variable size."),a({...t,read:(e,n)=>{const r=n+t.fixedSize;if(0===n&&e.length===r)return t.read(e.reverse(),n);const i=e.slice();return i.set(e.slice(n,r).reverse(),n),t.read(i,n)}})}e.assertByteArrayHasEnoughBytesForCodec=n,e.assertByteArrayIsNotEmptyForCodec=function(t,e,n=0){if(e.length-n<=0)throw new Error(`Codec [${t}] cannot decode empty byte arrays.`)},e.assertIsFixedSize=d,e.assertIsVariableSize=function(t,e){if(!l(t))throw new Error(e??"Expected a variable-size codec, got a fixed-size one.")},e.combineCodec=h,e.createCodec=u,e.createDecoder=a,e.createEncoder=s,e.fixBytes=i,e.fixCodec=function(t,e){return h(f(t,e),p(t,e))},e.fixDecoder=p,e.fixEncoder=f,e.getEncodedSize=o,e.isFixedSize=c,e.isVariableSize=l,e.mapCodec=function(t,e,n){return u({...m(t,e),read:n?g(t,n).read:t.read})},e.mapDecoder=g,e.mapEncoder=m,e.mergeBytes=t=>{const e=t.filter((t=>t.length));if(0===e.length)return t.length?t[0]:new Uint8Array;if(1===e.length)return e[0];const n=e.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(n);let i=0;return e.forEach((t=>{r.set(t,i),i+=t.length})),r},e.padBytes=r,e.reverseCodec=function(t){return h(y(t),b(t))},e.reverseDecoder=b,e.reverseEncoder=y},53149:(t,e,n)=>{"use strict";var r=n(21433),i=n(2638);function o(t,e,n){if(e!==n)throw new Error(`Expected [${t}] to have ${e} items, got ${n}.`)}function s(t){return t.reduce(((t,e)=>null===t||null===e?null:t+e),0)}function a(t){return r.isFixedSize(t)?t.fixedSize:null}function u(t){return r.isFixedSize(t)?t.fixedSize:t.maxSize??null}function c(t,e={}){const n=e.size??i.getU32Encoder();"remainder"===n&&r.assertIsFixedSize(t,'Codecs of "remainder" size must have fixed-size items.');const s=l(n,a(t)),c=l(n,u(t))??void 0;return r.createEncoder({...null!==s?{fixedSize:s}:{getSizeFromValue:e=>("object"==typeof n?r.getEncodedSize(e.length,n):0)+[...e].reduce(((e,n)=>e+r.getEncodedSize(n,t)),0),maxSize:c},write:(e,r,i)=>("number"==typeof n&&o("array",n,e.length),"object"==typeof n&&(i=n.write(e.length,r,i)),e.forEach((e=>{i=t.write(e,r,i)})),i)})}function d(t,e={}){const n=e.size??i.getU32Decoder();"remainder"===n&&r.assertIsFixedSize(t,'Codecs of "remainder" size must have fixed-size items.');const o=a(t),s=l(n,o),c=l(n,u(t))??void 0;return r.createDecoder({...null!==s?{fixedSize:s}:{maxSize:c},read:(e,r)=>{const i=[];if("object"==typeof n&&0===e.slice(r).length)return[i,r];const[s,a]=function(t,e,n,r){if("number"==typeof t)return[t,r];if("object"==typeof t)return t.read(n,r);if("remainder"===t){if(null===e)throw new Error('Codecs of "remainder" size must have fixed-size items.');const t=Math.max(0,n.length-r);if(t%e!=0)throw new Error(`The remainder of the byte array (${t} bytes) cannot be split into chunks of ${e} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${t} modulo ${e} should be equal to zero.`);return[t/e,r]}throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(t)}`)}(n,o,e,r);r=a;for(let n=0;n{for(let e=0;e<8;e+=1)n?(o.push(Boolean(1&t)),t>>=1):(o.push(Boolean(128&t)),t<<=1)})),[o,i+t]}})}function p(t={}){const e=t.size??i.getU8Encoder();return r.assertIsFixedSize(e,"Codec [bool] requires a fixed size."),r.mapEncoder(e,(t=>t?1:0))}function m(t={}){const e=t.size??i.getU8Decoder();return r.assertIsFixedSize(e,"Codec [bool] requires a fixed size."),r.mapDecoder(e,(t=>1===Number(t)))}function g(t={}){const e=t.size??"variable",n=r.createEncoder({getSizeFromValue:t=>t.length,write:(t,e,n)=>(e.set(t,n),n+t.length)});return"variable"===e?n:"number"==typeof e?r.fixEncoder(n,e):r.createEncoder({getSizeFromValue:t=>r.getEncodedSize(t.length,e)+t.length,write:(t,r,i)=>(i=e.write(t.length,r,i),n.write(t,r,i))})}function y(t={}){const e=t.size??"variable",n=r.createDecoder({read:(t,e)=>{const n=t.slice(e);return[n,e+n.length]}});return"variable"===e?n:"number"==typeof e?r.fixDecoder(n,e):r.createDecoder({read:(t,i)=>{r.assertByteArrayIsNotEmptyForCodec("bytes",t,i);const[o,s]=e.read(t,i),a=Number(o);i=s;const u=t.slice(i,i+a);r.assertByteArrayHasEnoughBytesForCodec("bytes",a,u);const[c,d]=n.read(u,0);return[c,i+=d]}})}function b(t,e={}){const n=e.size??i.getU8Encoder(),o=_(t,n);return r.createEncoder({...null!==o?{fixedSize:o}:{getSizeFromValue:e=>{const i=k(t,e),o=t[i][1];return r.getEncodedSize(i,n)+r.getEncodedSize(e,o)},maxSize:v(t,n)},write:(e,r,i)=>{const o=k(t,e);return i=n.write(o,r,i),t[o][1].write(e,r,i)}})}function w(t,e={}){const n=e.size??i.getU8Decoder(),o=_(t,n);return r.createDecoder({...null!==o?{fixedSize:o}:{maxSize:v(t,n)},read:(e,i)=>{r.assertByteArrayIsNotEmptyForCodec("dataEnum",e,i);const[o,s]=n.read(e,i);i=s;const a=t[Number(o)]??null;if(!a)throw new Error(`Enum discriminator out of range. Expected a number between 0 and ${t.length-1}, got ${o}.`);const[u,c]=a[1].read(e,i);return i=c,[{__kind:a[0],...u??{}},i]}})}function _(t,e){if(0===t.length)return r.isFixedSize(e)?e.fixedSize:null;if(!r.isFixedSize(t[0][1]))return null;const n=t[0][1].fixedSize;return t.every((t=>r.isFixedSize(t[1])&&t[1].fixedSize===n))&&r.isFixedSize(e)?e.fixedSize+n:null}function v(t,e){const n=t.map((([,t])=>u(t))).reduce(((t,e)=>null===t||null===e?null:Math.max(t,e)),0);return s([u(e),n])??void 0}function k(t,e){const n=t.findIndex((([t])=>e.__kind===t));if(n<0)throw new Error(`Invalid data enum variant. Expected one of [${t.map((([t])=>t)).join(", ")}], got "${e.__kind}".`);return n}function M(t){const e=s(t.map(a)),n=s(t.map(u))??void 0;return r.createEncoder({...null===e?{getSizeFromValue:e=>t.map(((t,n)=>r.getEncodedSize(e[n],t))).reduce(((t,e)=>t+e),0),maxSize:n}:{fixedSize:e},write:(e,n,r)=>(o("tuple",t.length,e.length),t.forEach(((t,i)=>{r=t.write(e[i],n,r)})),r)})}function A(t){const e=s(t.map(a)),n=s(t.map(u))??void 0;return r.createDecoder({...null===e?{maxSize:n}:{fixedSize:e},read:(e,n)=>{const r=[];return t.forEach((t=>{const[i,o]=t.read(e,n);r.push(i),n=o})),[r,n]}})}function S(t,e,n={}){return r.mapEncoder(c(M([t,e]),n),(t=>[...t.entries()]))}function I(t,e,n={}){return r.mapDecoder(d(A([t,e]),n),(t=>new Map(t)))}function x(t,e={}){const n=e.prefix??i.getU8Encoder(),o=e.fixed??!1,a=r.isFixedSize(t)&&r.isFixedSize(n)&&0===t.fixedSize;if(o||a){r.assertIsFixedSize(t,"Fixed nullables can only be used with fixed-size codecs."),r.assertIsFixedSize(n,"Fixed nullables can only be used with fixed-size prefix.");const e=n.fixedSize+t.fixedSize;return r.createEncoder({fixedSize:e,write:(r,i,o)=>{const s=n.write(Number(null!==r),i,o);return null!==r&&t.write(r,i,s),o+e}})}return r.createEncoder({getSizeFromValue:e=>r.getEncodedSize(Number(null!==e),n)+(null!==e?r.getEncodedSize(e,t):0),maxSize:s([n,t].map(u))??void 0,write:(e,r,i)=>(i=n.write(Number(null!==e),r,i),null!==e&&(i=t.write(e,r,i)),i)})}function E(t,e={}){const n=e.prefix??i.getU8Decoder(),o=e.fixed??!1;let a=null;const c=r.isFixedSize(t)&&r.isFixedSize(n)&&0===t.fixedSize;return(o||c)&&(r.assertIsFixedSize(t,"Fixed nullables can only be used with fixed-size codecs."),r.assertIsFixedSize(n,"Fixed nullables can only be used with fixed-size prefix."),a=n.fixedSize+t.fixedSize),r.createDecoder({...null===a?{maxSize:s([n,t].map(u))??void 0}:{fixedSize:a},read:(e,r)=>{if(e.length-r<=0)return[null,r];const[i,o]=n.read(e,r);if(0===i)return[null,null!==a?r+a:o];const[s,u]=t.read(e,o);return[s,null!==a?r+a:u]}})}function T(t,e={}){const n=e.size??i.getU8Encoder(),{minRange:o,maxRange:s,stringValues:a,enumKeys:u,enumValues:c}=B(t);return r.mapEncoder(n,(t=>{const e="number"==typeof t&&(ts),n="string"==typeof t&&!a.includes(t);if(e||n)throw new Error(`Invalid scalar enum variant. Expected one of [${a.join(", ")}] or a number between ${o} and ${s}, got "${t}".`);if("number"==typeof t)return t;const r=c.indexOf(t);return r>=0?r:u.indexOf(t)}))}function P(t,e={}){const n=e.size??i.getU8Decoder(),{minRange:o,maxRange:s,isNumericEnum:a,enumValues:u}=B(t);return r.mapDecoder(n,(t=>{const e=Number(t);if(es)throw new Error(`Enum discriminator out of range. Expected a number between ${o} and ${s}, got ${e}.`);return a?e:u[e]}))}function B(t){const e=Object.keys(t),n=Object.values(t),r=n.some((t=>"number"==typeof t));return{enumKeys:e,enumValues:n,isNumericEnum:r,maxRange:r?n.length/2-1:n.length-1,minRange:0,stringValues:r?[...e]:[...new Set([...e,...n])]}}function L(t,e={}){return r.mapEncoder(c(t,e),(t=>[...t]))}function $(t,e={}){return r.mapDecoder(d(t,e),(t=>new Set(t)))}function R(t){const e=t.map((([,t])=>t)),n=s(e.map(a)),i=s(e.map(u))??void 0;return r.createEncoder({...null===n?{getSizeFromValue:e=>t.map((([t,n])=>r.getEncodedSize(e[t],n))).reduce(((t,e)=>t+e),0),maxSize:i}:{fixedSize:n},write:(e,n,r)=>(t.forEach((([t,i])=>{r=i.write(e[t],n,r)})),r)})}function O(t){const e=t.map((([,t])=>t)),n=s(e.map(a)),i=s(e.map(u))??void 0;return r.createDecoder({...null===n?{maxSize:i}:{fixedSize:n},read:(e,n)=>{const r={};return t.forEach((([t,i])=>{const[o,s]=i.read(e,n);n=s,r[t]=o})),[r,n]}})}function D(){return r.createEncoder({fixedSize:0,write:(t,e,n)=>n})}function C(){return r.createDecoder({fixedSize:0,read:(t,e)=>[void 0,e]})}e.assertValidNumberOfItemsForCodec=o,e.getArrayCodec=function(t,e={}){return r.combineCodec(c(t,e),d(t,e))},e.getArrayDecoder=d,e.getArrayEncoder=c,e.getBitArrayCodec=function(t,e={}){return r.combineCodec(h(t,e),f(t,e))},e.getBitArrayDecoder=f,e.getBitArrayEncoder=h,e.getBooleanCodec=function(t={}){return r.combineCodec(p(t),m(t))},e.getBooleanDecoder=m,e.getBooleanEncoder=p,e.getBytesCodec=function(t={}){return r.combineCodec(g(t),y(t))},e.getBytesDecoder=y,e.getBytesEncoder=g,e.getDataEnumCodec=function(t,e={}){return r.combineCodec(b(t,e),w(t,e))},e.getDataEnumDecoder=w,e.getDataEnumEncoder=b,e.getMapCodec=function(t,e,n={}){return r.combineCodec(S(t,e,n),I(t,e,n))},e.getMapDecoder=I,e.getMapEncoder=S,e.getNullableCodec=function(t,e={}){const n=e;return r.combineCodec(x(t,n),E(t,n))},e.getNullableDecoder=E,e.getNullableEncoder=x,e.getScalarEnumCodec=function(t,e={}){return r.combineCodec(T(t,e),P(t,e))},e.getScalarEnumDecoder=P,e.getScalarEnumEncoder=T,e.getSetCodec=function(t,e={}){return r.combineCodec(L(t,e),$(t,e))},e.getSetDecoder=$,e.getSetEncoder=L,e.getStructCodec=function(t){return r.combineCodec(R(t),O(t))},e.getStructDecoder=O,e.getStructEncoder=R,e.getTupleCodec=function(t){return r.combineCodec(M(t),A(t))},e.getTupleDecoder=A,e.getTupleEncoder=M,e.getUnitCodec=function(){return r.combineCodec(D(),C())},e.getUnitDecoder=C,e.getUnitEncoder=D},2638:(t,e,n)=>{"use strict";var r=n(21433);function i(t,e,n,r){if(rn)throw new Error(`Codec [${t}] expected number to be in the range [${e}, ${n}], got ${r}.`)}var o=(t=>(t[t.LITTLE=0]="LITTLE",t[t.BIG=1]="BIG",t))(o||{});function s(t){return 1!==t?.endian}function a(t){return r.createEncoder({fixedSize:t.size,write(e,n,r){t.range&&i(t.name,t.range[0],t.range[1],e);const o=new ArrayBuffer(t.size);return t.set(new DataView(o),e,s(t.config)),n.set(new Uint8Array(o),r),r+t.size}})}function u(t){return r.createDecoder({fixedSize:t.size,read(e,n=0){r.assertByteArrayIsNotEmptyForCodec(t.name,e,n),r.assertByteArrayHasEnoughBytesForCodec(t.name,t.size,e,n);const i=new DataView(function(t,e,n){const r=t.byteOffset+(e??0),i=n??t.byteLength;return t.buffer.slice(r,r+i)}(e,n,t.size));return[t.get(i,s(t.config)),n+t.size]}})}var c=(t={})=>a({config:t,name:"f32",set:(t,e,n)=>t.setFloat32(0,e,n),size:4}),d=(t={})=>u({config:t,get:(t,e)=>t.getFloat32(0,e),name:"f32",size:4}),l=(t={})=>a({config:t,name:"f64",set:(t,e,n)=>t.setFloat64(0,e,n),size:8}),h=(t={})=>u({config:t,get:(t,e)=>t.getFloat64(0,e),name:"f64",size:8}),f=(t={})=>a({config:t,name:"i128",range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(t,e,n)=>{const r=n?8:0,i=n?0:8;t.setBigInt64(r,BigInt(e)>>64n,n),t.setBigUint64(i,0xffffffffffffffffn&BigInt(e),n)},size:16}),p=(t={})=>u({config:t,get:(t,e)=>{const n=e?8:0,r=e?0:8;return(t.getBigInt64(n,e)<<64n)+t.getBigUint64(r,e)},name:"i128",size:16}),m=(t={})=>a({config:t,name:"i16",range:[-Number("0x7fff")-1,Number("0x7fff")],set:(t,e,n)=>t.setInt16(0,e,n),size:2}),g=(t={})=>u({config:t,get:(t,e)=>t.getInt16(0,e),name:"i16",size:2}),y=(t={})=>a({config:t,name:"i32",range:[-Number("0x7fffffff")-1,Number("0x7fffffff")],set:(t,e,n)=>t.setInt32(0,e,n),size:4}),b=(t={})=>u({config:t,get:(t,e)=>t.getInt32(0,e),name:"i32",size:4}),w=(t={})=>a({config:t,name:"i64",range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(t,e,n)=>t.setBigInt64(0,BigInt(e),n),size:8}),_=(t={})=>u({config:t,get:(t,e)=>t.getBigInt64(0,e),name:"i64",size:8}),v=()=>a({name:"i8",range:[-Number("0x7f")-1,Number("0x7f")],set:(t,e)=>t.setInt8(0,e),size:1}),k=()=>u({get:t=>t.getInt8(0),name:"i8",size:1}),M=()=>r.createEncoder({getSizeFromValue:t=>t<=127?1:t<=16383?2:3,maxSize:3,write:(t,e,n)=>{i("shortU16",0,65535,t);const r=[0];for(let e=0;;e+=1){const n=t>>7*e;if(0===n)break;const i=127&n;r[e]=i,e>0&&(r[e-1]|=128)}return e.set(r,n),n+r.length}}),A=()=>r.createDecoder({maxSize:3,read:(t,e)=>{let n=0,r=0;for(;++r;){const i=r-1,o=t[e+i];if(n|=(127&o)<<7*i,0==(128&o))break}return[n,e+r]}}),S=(t={})=>a({config:t,name:"u128",range:[0,BigInt("0xffffffffffffffffffffffffffffffff")],set:(t,e,n)=>{const r=n?8:0,i=n?0:8;t.setBigUint64(r,BigInt(e)>>64n,n),t.setBigUint64(i,0xffffffffffffffffn&BigInt(e),n)},size:16}),I=(t={})=>u({config:t,get:(t,e)=>{const n=e?8:0,r=e?0:8;return(t.getBigUint64(n,e)<<64n)+t.getBigUint64(r,e)},name:"u128",size:16}),x=(t={})=>a({config:t,name:"u16",range:[0,Number("0xffff")],set:(t,e,n)=>t.setUint16(0,e,n),size:2}),E=(t={})=>u({config:t,get:(t,e)=>t.getUint16(0,e),name:"u16",size:2}),T=(t={})=>a({config:t,name:"u32",range:[0,Number("0xffffffff")],set:(t,e,n)=>t.setUint32(0,e,n),size:4}),P=(t={})=>u({config:t,get:(t,e)=>t.getUint32(0,e),name:"u32",size:4}),B=(t={})=>a({config:t,name:"u64",range:[0,BigInt("0xffffffffffffffff")],set:(t,e,n)=>t.setBigUint64(0,BigInt(e),n),size:8}),L=(t={})=>u({config:t,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}),$=()=>a({name:"u8",range:[0,Number("0xff")],set:(t,e)=>t.setUint8(0,e),size:1}),R=()=>u({get:t=>t.getUint8(0),name:"u8",size:1});e.Endian=o,e.assertNumberIsBetweenForCodec=i,e.getF32Codec=(t={})=>r.combineCodec(c(t),d(t)),e.getF32Decoder=d,e.getF32Encoder=c,e.getF64Codec=(t={})=>r.combineCodec(l(t),h(t)),e.getF64Decoder=h,e.getF64Encoder=l,e.getI128Codec=(t={})=>r.combineCodec(f(t),p(t)),e.getI128Decoder=p,e.getI128Encoder=f,e.getI16Codec=(t={})=>r.combineCodec(m(t),g(t)),e.getI16Decoder=g,e.getI16Encoder=m,e.getI32Codec=(t={})=>r.combineCodec(y(t),b(t)),e.getI32Decoder=b,e.getI32Encoder=y,e.getI64Codec=(t={})=>r.combineCodec(w(t),_(t)),e.getI64Decoder=_,e.getI64Encoder=w,e.getI8Codec=()=>r.combineCodec(v(),k()),e.getI8Decoder=k,e.getI8Encoder=v,e.getShortU16Codec=()=>r.combineCodec(M(),A()),e.getShortU16Decoder=A,e.getShortU16Encoder=M,e.getU128Codec=(t={})=>r.combineCodec(S(t),I(t)),e.getU128Decoder=I,e.getU128Encoder=S,e.getU16Codec=(t={})=>r.combineCodec(x(t),E(t)),e.getU16Decoder=E,e.getU16Encoder=x,e.getU32Codec=(t={})=>r.combineCodec(T(t),P(t)),e.getU32Decoder=P,e.getU32Encoder=T,e.getU64Codec=(t={})=>r.combineCodec(B(t),L(t)),e.getU64Decoder=L,e.getU64Encoder=B,e.getU8Codec=()=>r.combineCodec($(),R()),e.getU8Decoder=R,e.getU8Encoder=$},72738:(t,e,n)=>{"use strict";var r=n(21433),i=n(2638);function o(t,e,n=e){if(!e.match(new RegExp(`^[${t}]*$`)))throw new Error(`Expected a string of base ${t.length}, got [${n}].`)}var s=t=>r.createEncoder({getSizeFromValue:e=>{const[n,r]=c(e,t[0]);if(""===r)return e.length;const i=d(r,t);return n.length+Math.ceil(i.toString(16).length/2)},write(e,n,r){if(o(t,e),""===e)return r;const[i,s]=c(e,t[0]);if(""===s)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let a=d(s,t);const u=[];for(;a>0n;)u.unshift(Number(a%256n)),a/=256n;const l=[...Array(i.length).fill(0),...u];return n.set(l,r),r+l.length}}),a=t=>r.createDecoder({read(e,n){const r=0===n?e:e.slice(n);if(0===r.length)return["",0];let i=r.findIndex((t=>0!==t));i=-1===i?r.length:i;const o=t[0].repeat(i);if(i===r.length)return[o,e.length];const s=function(t,e){const n=BigInt(e.length),r=[];for(;t>0n;)r.unshift(e[Number(t%n)]),t/=n;return r.join("")}(r.slice(i).reduce(((t,e)=>256n*t+BigInt(e)),0n),t);return[o+s,e.length]}}),u=t=>r.combineCodec(s(t),a(t));function c(t,e){const n=[...t].findIndex((t=>t!==e));return-1===n?[t,""]:[t.slice(0,n),t.slice(n)]}function d(t,e){const n=BigInt(e.length);return[...t].reduce(((t,r)=>t*n+BigInt(e.indexOf(r))),0n)}var l="0123456789",h=()=>r.createEncoder({getSizeFromValue:t=>Math.ceil(t.length/2),write(t,e,n){const r=t.toLowerCase();o("0123456789abcdef",r,t);const i=r.match(/.{1,2}/g),s=i?i.map((t=>parseInt(t,16))):[];return e.set(s,n),s.length+n}}),f=()=>r.createDecoder({read:(t,e)=>[t.slice(e).reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),""),t.length]}),p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",m=(t,e)=>r.createEncoder({getSizeFromValue:t=>Math.floor(t.length*e/8),write(n,r,i){if(o(t,n),""===n)return i;const s=y([...n].map((e=>t.indexOf(e))),e,8,!1);return r.set(s,i),s.length+i}}),g=(t,e)=>r.createDecoder({read(n,r=0){const i=0===r?n:n.slice(r);return 0===i.length?["",n.length]:[y([...i],8,e,!0).map((e=>t[e])).join(""),n.length]}});function y(t,e,n,r){const i=[];let o=0,s=0;const a=(1<=n;)s-=n,i.push(o>>s&a);return r&&s>0&&i.push(o<r.createEncoder({getSizeFromValue:t=>{try{return atob(t).length}catch(e){throw new Error(`Expected a string of base 64, got [${t}].`)}},write(t,e,n){try{const r=atob(t).split("").map((t=>t.charCodeAt(0)));return e.set(r,n),r.length+n}catch(e){throw new Error(`Expected a string of base 64, got [${t}].`)}}}),w=()=>r.createDecoder({read(t,e=0){const n=t.slice(e);return[btoa(String.fromCharCode(...n)),t.length]}}),_=t=>t.replace(/\u0000/g,""),v=globalThis.TextDecoder,k=globalThis.TextEncoder,M=()=>{let t;return r.createEncoder({getSizeFromValue:e=>(t||=new k).encode(e).length,write:(e,n,r)=>{const i=(t||=new k).encode(e);return n.set(i,r),r+i.length}})},A=()=>{let t;return r.createDecoder({read(e,n){const r=(t||=new v).decode(e.slice(n));return[_(r),e.length]}})};function S(t={}){const e=t.size??i.getU32Encoder(),n=t.encoding??M();return"variable"===e?n:"number"==typeof e?r.fixEncoder(n,e):r.createEncoder({getSizeFromValue:t=>{const i=r.getEncodedSize(t,n);return r.getEncodedSize(i,e)+i},write:(t,i,o)=>{const s=r.getEncodedSize(t,n);return o=e.write(s,i,o),n.write(t,i,o)}})}function I(t={}){const e=t.size??i.getU32Decoder(),n=t.encoding??A();return"variable"===e?n:"number"==typeof e?r.fixDecoder(n,e):r.createDecoder({read:(t,i=0)=>{r.assertByteArrayIsNotEmptyForCodec("string",t,i);const[o,s]=e.read(t,i),a=Number(o);i=s;const u=t.slice(i,i+a);r.assertByteArrayHasEnoughBytesForCodec("string",a,u);const[c,d]=n.read(u,0);return[c,i+=d]}})}e.assertValidBaseString=o,e.getBase10Codec=()=>u(l),e.getBase10Decoder=()=>a(l),e.getBase10Encoder=()=>s(l),e.getBase16Codec=()=>r.combineCodec(h(),f()),e.getBase16Decoder=f,e.getBase16Encoder=h,e.getBase58Codec=()=>u(p),e.getBase58Decoder=()=>a(p),e.getBase58Encoder=()=>s(p),e.getBase64Codec=()=>r.combineCodec(b(),w()),e.getBase64Decoder=w,e.getBase64Encoder=b,e.getBaseXCodec=u,e.getBaseXDecoder=a,e.getBaseXEncoder=s,e.getBaseXResliceCodec=(t,e)=>r.combineCodec(m(t,e),g(t,e)),e.getBaseXResliceDecoder=g,e.getBaseXResliceEncoder=m,e.getStringCodec=function(t={}){return r.combineCodec(S(t),I(t))},e.getStringDecoder=I,e.getStringEncoder=S,e.getUtf8Codec=()=>r.combineCodec(M(),A()),e.getUtf8Decoder=A,e.getUtf8Encoder=M,e.padNullCharacters=(t,e)=>t.padEnd(e,"\0"),e.removeNullCharacters=_},62997:(t,e,n)=>{"use strict";var r=n(21433),i=n(2638),o=t=>({__option:"Some",value:t}),s=()=>({__option:"None"}),a=t=>!!(t&&"object"==typeof t&&"__option"in t&&("Some"===t.__option&&"value"in t||"None"===t.__option)),u=t=>"Some"===t.__option,c=t=>null!==t?o(t):{__option:"None"};function d(t,e={}){const n=e.prefix??i.getU8Encoder(),o=e.fixed??!1,s=r.isFixedSize(t)&&r.isFixedSize(n)&&0===t.fixedSize;if(o||s){r.assertIsFixedSize(t,"Fixed options can only be used with fixed-size codecs."),r.assertIsFixedSize(n,"Fixed options can only be used with fixed-size prefix.");const e=n.fixedSize+t.fixedSize;return r.createEncoder({fixedSize:e,write:(r,i,o)=>{const s=a(r)?r:c(r),d=n.write(Number(u(s)),i,o);return u(s)&&t.write(s.value,i,d),o+e}})}return r.createEncoder({getSizeFromValue:e=>{const i=a(e)?e:c(e);return r.getEncodedSize(Number(u(i)),n)+(u(i)?r.getEncodedSize(i.value,t):0)},maxSize:h([n,t].map(f))??void 0,write:(e,r,i)=>{const o=a(e)?e:c(e);return i=n.write(Number(u(o)),r,i),u(o)&&(i=t.write(o.value,r,i)),i}})}function l(t,e={}){const n=e.prefix??i.getU8Decoder(),s=e.fixed??!1;let a=null;const u=r.isFixedSize(t)&&r.isFixedSize(n)&&0===t.fixedSize;return(s||u)&&(r.assertIsFixedSize(t,"Fixed options can only be used with fixed-size codecs."),r.assertIsFixedSize(n,"Fixed options can only be used with fixed-size prefix."),a=n.fixedSize+t.fixedSize),r.createDecoder({...null===a?{maxSize:h([n,t].map(f))??void 0}:{fixedSize:a},read:(e,r)=>{if(e.length-r<=0)return[{__option:"None"},r];const[i,s]=n.read(e,r);if(0===i)return[{__option:"None"},null!==a?r+a:s];const[u,c]=t.read(e,s);return[o(u),null!==a?r+a:c]}})}function h(t){return t.reduce(((t,e)=>null===t||null===e?null:t+e),0)}function f(t){return r.isFixedSize(t)?t.fixedSize:t.maxSize??null}e.getOptionCodec=function(t,e={}){return r.combineCodec(d(t,e),l(t,e))},e.getOptionDecoder=l,e.getOptionEncoder=d,e.isNone=t=>"None"===t.__option,e.isOption=a,e.isSome=u,e.none=s,e.some=o,e.unwrapOption=function(t,e){return u(t)?t.value:e?e():null},e.unwrapOptionRecursively=function t(e,n){if(!e||ArrayBuffer.isView(e))return e;const r=e=>n?t(e,n):t(e);return a(e)?u(e)?r(e.value):n?n():null:Array.isArray(e)?e.map(r):"object"==typeof e?Object.fromEntries(Object.entries(e).map((([t,e])=>[t,r(e)]))):e},e.wrapNullable=c},90126:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyNotFoundError=e.ImmutableMetadataError=e.IncorrectUpdateAuthorityError=e.IncorrectMintAuthorityError=e.MintHasNoMintAuthorityError=e.IncorrectAccountError=e.TokenMetadataError=void 0;class n extends Error{constructor(t){super(t)}}e.TokenMetadataError=n,e.IncorrectAccountError=class extends n{constructor(){super(...arguments),this.name="IncorrectAccountError"}},e.MintHasNoMintAuthorityError=class extends n{constructor(){super(...arguments),this.name="MintHasNoMintAuthorityError"}},e.IncorrectMintAuthorityError=class extends n{constructor(){super(...arguments),this.name="IncorrectMintAuthorityError"}},e.IncorrectUpdateAuthorityError=class extends n{constructor(){super(...arguments),this.name="IncorrectUpdateAuthorityError"}},e.ImmutableMetadataError=class extends n{constructor(){super(...arguments),this.name="ImmutableMetadataError"}},e.KeyNotFoundError=class extends n{constructor(){super(...arguments),this.name="KeyNotFoundError"}}},14546:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getFieldConfig=e.getFieldCodec=e.Field=void 0;const r=n(53149),i=n(72738);var o;!function(t){t[t.Name=0]="Name",t[t.Symbol=1]="Symbol",t[t.Uri=2]="Uri"}(o||(e.Field=o={})),e.getFieldCodec=()=>[["Name",(0,r.getUnitCodec)()],["Symbol",(0,r.getUnitCodec)()],["Uri",(0,r.getUnitCodec)()],["Key",(0,r.getStructCodec)([["value",(0,r.getTupleCodec)([(0,i.getStringCodec)()])]])]],e.getFieldConfig=function(t){return t===o.Name||"Name"===t||"name"===t?{__kind:"Name"}:t===o.Symbol||"Symbol"===t||"symbol"===t?{__kind:"Symbol"}:t===o.Uri||"Uri"===t||"uri"===t?{__kind:"Uri"}:{__kind:"Key",value:[t]}}},99564:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(90126),e),i(n(14546),e),i(n(40656),e),i(n(15285),e)},40656:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createEmitInstruction=e.createUpdateAuthorityInstruction=e.createRemoveKeyInstruction=e.createUpdateFieldInstruction=e.createInitializeInstruction=void 0;const i=n(53149),o=n(2638),s=n(72738),a=n(62997),u=n(1431),c=n(18245),d=n(14546);function l(t,e,n){const o=(0,i.getStructEncoder)(t).encode(n);return r.concat([e,o])}e.createInitializeInstruction=function(t){const{programId:e,metadata:n,updateAuthority:r,mint:i,mintAuthority:o,name:a,symbol:d,uri:h}=t;return new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!0,pubkey:n},{isSigner:!1,isWritable:!1,pubkey:r},{isSigner:!1,isWritable:!1,pubkey:i},{isSigner:!0,isWritable:!1,pubkey:o}],data:l([["name",(0,s.getStringEncoder)()],["symbol",(0,s.getStringEncoder)()],["uri",(0,s.getStringEncoder)()]],(0,u.splDiscriminate)("spl_token_metadata_interface:initialize_account"),{name:a,symbol:d,uri:h})})},e.createUpdateFieldInstruction=function(t){const{programId:e,metadata:n,updateAuthority:r,field:o,value:a}=t;return new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!0,pubkey:n},{isSigner:!0,isWritable:!1,pubkey:r}],data:l([["field",(0,i.getDataEnumCodec)((0,d.getFieldCodec)())],["value",(0,s.getStringEncoder)()]],(0,u.splDiscriminate)("spl_token_metadata_interface:updating_field"),{field:(0,d.getFieldConfig)(o),value:a})})},e.createRemoveKeyInstruction=function(t){const{programId:e,metadata:n,updateAuthority:r,key:o,idempotent:a}=t;return new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!0,pubkey:n},{isSigner:!0,isWritable:!1,pubkey:r}],data:l([["idempotent",(0,i.getBooleanEncoder)()],["key",(0,s.getStringEncoder)()]],(0,u.splDiscriminate)("spl_token_metadata_interface:remove_key_ix"),{idempotent:a,key:o})})},e.createUpdateAuthorityInstruction=function(t){const{programId:e,metadata:n,oldAuthority:o,newAuthority:s}=t,a=r.alloc(32);return s?a.set(s.toBuffer()):a.fill(0),new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!0,pubkey:n},{isSigner:!0,isWritable:!1,pubkey:o}],data:l([["newAuthority",(0,i.getBytesEncoder)({size:32})]],(0,u.splDiscriminate)("spl_token_metadata_interface:update_the_authority"),{newAuthority:a})})},e.createEmitInstruction=function(t){const{programId:e,metadata:n,start:r,end:i}=t;return new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!1,pubkey:n}],data:l([["start",(0,a.getOptionEncoder)((0,o.getU64Encoder)())],["end",(0,a.getOptionEncoder)((0,o.getU64Encoder)())]],(0,u.splDiscriminate)("spl_token_metadata_interface:emitter"),{start:null!=r?r:null,end:null!=i?i:null})})}},15285:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.unpack=e.pack=e.TOKEN_METADATA_DISCRIMINATOR=void 0;const i=n(18245),o=n(53149),s=n(72738);e.TOKEN_METADATA_DISCRIMINATOR=r.from([112,132,90,90,11,88,157,87]);const a=(0,o.getStructCodec)([["updateAuthority",(0,o.getBytesCodec)({size:32})],["mint",(0,o.getBytesCodec)({size:32})],["name",(0,s.getStringCodec)()],["symbol",(0,s.getStringCodec)()],["uri",(0,s.getStringCodec)()],["additionalMetadata",(0,o.getArrayCodec)((0,o.getTupleCodec)([(0,s.getStringCodec)(),(0,s.getStringCodec)()]))]]);e.pack=t=>{var e;const n=null!==(e=t.updateAuthority)&&void 0!==e?e:i.PublicKey.default;return a.encode(Object.assign(Object.assign({},t),{updateAuthority:n.toBuffer(),mint:t.mint.toBuffer()}))},e.unpack=function(t){const e=a.decode(t);return function(t){for(let e=0;e{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getSigners=void 0;const r=n(18245);e.getSigners=function(t,e){return t instanceof r.PublicKey?[t,e]:[t.publicKey,[t]]}},57503:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.mintTo=void 0;const i=n(18245),o=n(44530),s=n(74761),a=n(51421);e.mintTo=function(t,e,n,u,c,d,l=[],h,f=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(c,l),p=(new i.Transaction).add((0,s.createMintToInstruction)(n,u,r,d,l,f));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...o],h)}))}},31507:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.mintToChecked=void 0;const i=n(18245),o=n(44530),s=n(70698),a=n(51421);e.mintToChecked=function(t,e,n,u,c,d,l,h=[],f,p=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(c,h),m=(new i.Transaction).add((0,s.createMintToCheckedInstruction)(n,u,r,d,l,h,p));return yield(0,i.sendAndConfirmTransaction)(t,m,[e,...o],f)}))}},85601:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.recoverNested=void 0;const i=n(18245),o=n(44530),s=n(31183),a=n(66446);e.recoverNested=function(t,e,n,u,c,d,l=o.TOKEN_PROGRAM_ID,h=o.ASSOCIATED_TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(0,a.getAssociatedTokenAddressSync)(u,n.publicKey,!1,l,h),o=(0,a.getAssociatedTokenAddressSync)(c,n.publicKey,!1,l,h),f=(0,a.getAssociatedTokenAddressSync)(c,r,!0,l,h),p=(new i.Transaction).add((0,s.createRecoverNestedInstruction)(f,c,o,r,u,n.publicKey,l,h));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,n],d)}))}},13460:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.revoke=void 0;const i=n(18245),o=n(44530),s=n(62216),a=n(51421);e.revoke=function(t,e,n,u,c=[],d,l=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(u,c),h=(new i.Transaction).add((0,s.createRevokeInstruction)(n,r,c,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...o],d)}))}},46111:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.setAuthority=void 0;const i=n(18245),o=n(44530),s=n(95816),a=n(51421);e.setAuthority=function(t,e,n,u,c,d,l=[],h,f=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(u,l),p=(new i.Transaction).add((0,s.createSetAuthorityInstruction)(n,r,c,d,l,f));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...o],h)}))}},87245:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.syncNative=void 0;const i=n(18245),o=n(44530),s=n(75836);e.syncNative=function(t,e,n,a,u=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(new i.Transaction).add((0,s.createSyncNativeInstruction)(n,u));return yield(0,i.sendAndConfirmTransaction)(t,r,[e],a)}))}},70765:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.thawAccount=void 0;const i=n(18245),o=n(44530),s=n(19040),a=n(51421);e.thawAccount=function(t,e,n,u,c,d=[],l,h=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(c,d),f=(new i.Transaction).add((0,s.createThawAccountInstruction)(n,u,r,d,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...o],l)}))}},99843:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.transfer=void 0;const i=n(18245),o=n(44530),s=n(72874),a=n(51421);e.transfer=function(t,e,n,u,c,d,l=[],h,f=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(c,l),p=(new i.Transaction).add((0,s.createTransferInstruction)(n,u,r,d,l,f));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...o],h)}))}},44868:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.transferChecked=void 0;const i=n(18245),o=n(44530),s=n(35593),a=n(51421);e.transferChecked=function(t,e,n,u,c,d,l,h,f=[],p,m=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(d,f),g=(new i.Transaction).add((0,s.createTransferCheckedInstruction)(n,u,c,r,l,h,f,m));return yield(0,i.sendAndConfirmTransaction)(t,g,[e,...o],p)}))}},93701:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.uiAmountToAmount=void 0;const o=n(27278),s=n(18245),a=n(44530),u=n(21470);e.uiAmountToAmount=function(t,e,n,c,d=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=(new s.Transaction).add((0,u.createUiAmountToAmountInstruction)(n,c,d)),{returnData:a,err:l}=(yield t.simulateTransaction(i,[e],!1)).value;if(a){const t=r.from(a.data[0],a.data[1]);return(0,o.u64)().decode(t)}return l}))}},44530:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.programSupportsExtensions=e.NATIVE_MINT_2022=e.NATIVE_MINT=e.ASSOCIATED_TOKEN_PROGRAM_ID=e.TOKEN_2022_PROGRAM_ID=e.TOKEN_PROGRAM_ID=void 0;const r=n(18245);e.TOKEN_PROGRAM_ID=new r.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),e.TOKEN_2022_PROGRAM_ID=new r.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),e.ASSOCIATED_TOKEN_PROGRAM_ID=new r.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),e.NATIVE_MINT=new r.PublicKey("So11111111111111111111111111111111111111112"),e.NATIVE_MINT_2022=new r.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP"),e.programSupportsExtensions=function(t){return t!==e.TOKEN_PROGRAM_ID}},60913:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenTransferHookAccountDataNotFound=e.TokenTransferHookInvalidSeed=e.TokenTransferHookAccountNotFound=e.TokenUnsupportedInstructionError=e.TokenInvalidInstructionTypeError=e.TokenInvalidInstructionDataError=e.TokenInvalidInstructionKeysError=e.TokenInvalidInstructionProgramError=e.TokenOwnerOffCurveError=e.TokenInvalidOwnerError=e.TokenInvalidMintError=e.TokenInvalidAccountSizeError=e.TokenInvalidAccountOwnerError=e.TokenInvalidAccountDataError=e.TokenInvalidAccountError=e.TokenAccountNotFoundError=e.TokenError=void 0;class n extends Error{constructor(t){super(t)}}e.TokenError=n,e.TokenAccountNotFoundError=class extends n{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}},e.TokenInvalidAccountError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}},e.TokenInvalidAccountDataError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidAccountDataError"}},e.TokenInvalidAccountOwnerError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}},e.TokenInvalidAccountSizeError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}},e.TokenInvalidMintError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidMintError"}},e.TokenInvalidOwnerError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidOwnerError"}},e.TokenOwnerOffCurveError=class extends n{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}},e.TokenInvalidInstructionProgramError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidInstructionProgramError"}},e.TokenInvalidInstructionKeysError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidInstructionKeysError"}},e.TokenInvalidInstructionDataError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidInstructionDataError"}},e.TokenInvalidInstructionTypeError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidInstructionTypeError"}},e.TokenUnsupportedInstructionError=class extends n{constructor(){super(...arguments),this.name="TokenUnsupportedInstructionError"}},e.TokenTransferHookAccountNotFound=class extends n{constructor(){super(...arguments),this.name="TokenTransferHookAccountNotFound"}},e.TokenTransferHookInvalidSeed=class extends n{constructor(){super(...arguments),this.name="TokenTransferHookInvalidSeed"}},e.TokenTransferHookAccountDataNotFound=class extends n{constructor(){super(...arguments),this.name="TokenTransferHookAccountDataNotFound"}}},21026:(t,e)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.ACCOUNT_TYPE_SIZE=e.AccountType=void 0,function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(n||(e.AccountType=n={})),e.ACCOUNT_TYPE_SIZE=1},966:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.disableCpiGuard=e.enableCpiGuard=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(21095);e.enableCpiGuard=function(t,e,n,u,c=[],d,l=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(u,c),h=(new i.Transaction).add((0,a.createEnableCpiGuardInstruction)(n,r,s,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...s],d)}))},e.disableCpiGuard=function(t,e,n,u,c=[],d,l=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(u,c),h=(new i.Transaction).add((0,a.createDisableCpiGuardInstruction)(n,r,s,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...s],d)}))}},2941:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(966),e),i(n(21095),e),i(n(66738),e)},21095:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createDisableCpiGuardInstruction=e.createEnableCpiGuardInstruction=e.cpiGuardInstructionData=e.CpiGuardInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);var d;function l(t,n,i,d,l){if(!(0,s.programSupportsExtensions)(l))throw new a.TokenUnsupportedInstructionError;const h=(0,u.addSigners)([{pubkey:n,isSigner:!1,isWritable:!0}],i,d),f=r.alloc(e.cpiGuardInstructionData.span);return e.cpiGuardInstructionData.encode({instruction:c.TokenInstruction.CpiGuardExtension,cpiGuardInstruction:t},f),new o.TransactionInstruction({keys:h,programId:l,data:f})}!function(t){t[t.Enable=0]="Enable",t[t.Disable=1]="Disable"}(d||(e.CpiGuardInstruction=d={})),e.cpiGuardInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("cpiGuardInstruction")]),e.createEnableCpiGuardInstruction=function(t,e,n=[],r=s.TOKEN_2022_PROGRAM_ID){return l(d.Enable,t,e,n,r)},e.createDisableCpiGuardInstruction=function(t,e,n=[],r=s.TOKEN_2022_PROGRAM_ID){return l(d.Disable,t,e,n,r)}},66738:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCpiGuard=e.CPI_GUARD_SIZE=e.CpiGuardLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.CpiGuardLayout=(0,r.struct)([(0,i.bool)("lockCpi")]),e.CPI_GUARD_SIZE=e.CpiGuardLayout.span,e.getCpiGuard=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.CpiGuard,t.tlvData);return null!==n?e.CpiGuardLayout.decode(n):null}},87793:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.updateDefaultAccountState=e.initializeDefaultAccountState=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(68298);e.initializeDefaultAccountState=function(t,e,n,o,u,c=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(new i.Transaction).add((0,a.createInitializeDefaultAccountStateInstruction)(n,o,c));return yield(0,i.sendAndConfirmTransaction)(t,r,[e],u)}))},e.updateDefaultAccountState=function(t,e,n,u,c,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(c,d),f=(new i.Transaction).add((0,a.createUpdateDefaultAccountStateInstruction)(n,u,r,s,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...s],l)}))}},34347:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(87793),e),i(n(68298),e),i(n(20403),e)},68298:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createUpdateDefaultAccountStateInstruction=e.createInitializeDefaultAccountStateInstruction=e.defaultAccountStateInstructionData=e.DefaultAccountStateInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);var d;!function(t){t[t.Initialize=0]="Initialize",t[t.Update=1]="Update"}(d||(e.DefaultAccountStateInstruction=d={})),e.defaultAccountStateInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("defaultAccountStateInstruction"),(0,i.u8)("accountState")]),e.createInitializeDefaultAccountStateInstruction=function(t,n,i=s.TOKEN_2022_PROGRAM_ID){if(!(0,s.programSupportsExtensions)(i))throw new a.TokenUnsupportedInstructionError;const u=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.defaultAccountStateInstructionData.span);return e.defaultAccountStateInstructionData.encode({instruction:c.TokenInstruction.DefaultAccountStateExtension,defaultAccountStateInstruction:d.Initialize,accountState:n},l),new o.TransactionInstruction({keys:u,programId:i,data:l})},e.createUpdateDefaultAccountStateInstruction=function(t,n,i,l=[],h=s.TOKEN_2022_PROGRAM_ID){if(!(0,s.programSupportsExtensions)(h))throw new a.TokenUnsupportedInstructionError;const f=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],i,l),p=r.alloc(e.defaultAccountStateInstructionData.span);return e.defaultAccountStateInstructionData.encode({instruction:c.TokenInstruction.DefaultAccountStateExtension,defaultAccountStateInstruction:d.Update,accountState:n},p),new o.TransactionInstruction({keys:f,programId:h,data:p})}},20403:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultAccountState=e.DEFAULT_ACCOUNT_STATE_SIZE=e.DefaultAccountStateLayout=void 0;const r=n(39386),i=n(90758);e.DefaultAccountStateLayout=(0,r.struct)([(0,r.u8)("state")]),e.DEFAULT_ACCOUNT_STATE_SIZE=e.DefaultAccountStateLayout.span,e.getDefaultAccountState=function(t){const n=(0,i.getExtensionData)(i.ExtensionType.DefaultAccountState,t.tlvData);return null!==n?e.DefaultAccountStateLayout.decode(n):null}},90758:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNewAccountLenForExtensionLen=e.getAccountLenForMint=e.getExtensionTypes=e.getExtensionData=e.getAccountLen=e.getMintLen=e.getAccountTypeOfMintType=e.isAccountExtension=e.isMintExtension=e.getTypeLen=e.LENGTH_SIZE=e.TYPE_SIZE=e.ExtensionType=void 0;const r=n(48820),i=n(66446),o=n(22114),s=n(21026),a=n(2941),u=n(34347),c=n(44416),d=n(4567),l=n(64304),h=n(83239),f=n(59795),p=n(36882),m=n(86874),g=n(28795),y=n(95310),b=n(44530);var w;function _(t){return t+e.TYPE_SIZE+e.LENGTH_SIZE}function v(t){switch(t){case w.Uninitialized:return 0;case w.TransferFeeConfig:return g.TRANSFER_FEE_CONFIG_SIZE;case w.TransferFeeAmount:return g.TRANSFER_FEE_AMOUNT_SIZE;case w.MintCloseAuthority:return f.MINT_CLOSE_AUTHORITY_SIZE;case w.ConfidentialTransferMint:return 97;case w.ConfidentialTransferAccount:return 286;case w.CpiGuard:return a.CPI_GUARD_SIZE;case w.DefaultAccountState:return u.DEFAULT_ACCOUNT_STATE_SIZE;case w.ImmutableOwner:return c.IMMUTABLE_OWNER_SIZE;case w.MemoTransfer:return l.MEMO_TRANSFER_SIZE;case w.MetadataPointer:return h.METADATA_POINTER_SIZE;case w.NonTransferable:return p.NON_TRANSFERABLE_SIZE;case w.InterestBearingConfig:return d.INTEREST_BEARING_MINT_CONFIG_STATE_SIZE;case w.PermanentDelegate:return m.PERMANENT_DELEGATE_SIZE;case w.NonTransferableAccount:return p.NON_TRANSFERABLE_ACCOUNT_SIZE;case w.TransferHook:return y.TRANSFER_HOOK_SIZE;case w.TransferHookAccount:return y.TRANSFER_HOOK_ACCOUNT_SIZE;case w.TokenMetadata:throw Error(`Cannot get type length for variable extension type: ${t}`);default:throw Error(`Unknown extension type: ${t}`)}}function k(t){switch(t){case w.TransferFeeConfig:return w.TransferFeeAmount;case w.ConfidentialTransferMint:return w.ConfidentialTransferAccount;case w.NonTransferable:return w.NonTransferableAccount;case w.TransferHook:return w.TransferHookAccount;case w.TransferFeeAmount:case w.ConfidentialTransferAccount:case w.CpiGuard:case w.DefaultAccountState:case w.ImmutableOwner:case w.MemoTransfer:case w.MintCloseAuthority:case w.MetadataPointer:case w.TokenMetadata:case w.Uninitialized:case w.InterestBearingConfig:case w.PermanentDelegate:case w.NonTransferableAccount:case w.TransferHookAccount:return w.Uninitialized}}function M(t,n){if(0===t.length)return n;{const n=r.ACCOUNT_SIZE+s.ACCOUNT_TYPE_SIZE+t.filter(((e,n)=>n===t.indexOf(e))).map((t=>_(v(t)))).reduce(((t,e)=>t+e));return n===o.MULTISIG_SIZE?n+e.TYPE_SIZE:n}}function A(t){return M(t,r.ACCOUNT_SIZE)}function S(t,n){let r=0;for(;_(r)<=n.length;){const i=n.readUInt16LE(r),o=n.readUInt16LE(r+e.TYPE_SIZE),s=_(r);if(i==t)return n.slice(s,s+o);r=s+o}return null}function I(t){const n=[];let r=0;for(;r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getImmutableOwner=e.IMMUTABLE_OWNER_SIZE=e.ImmutableOwnerLayout=void 0;const r=n(39386),i=n(90758);e.ImmutableOwnerLayout=(0,r.struct)([]),e.IMMUTABLE_OWNER_SIZE=e.ImmutableOwnerLayout.span,e.getImmutableOwner=function(t){const n=(0,i.getExtensionData)(i.ExtensionType.ImmutableOwner,t.tlvData);return null!==n?e.ImmutableOwnerLayout.decode(n):null}},66832:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(21026),e),i(n(2941),e),i(n(34347),e),i(n(90758),e),i(n(44416),e),i(n(33661),e),i(n(64304),e),i(n(2886),e),i(n(61732),e),i(n(59795),e),i(n(36882),e),i(n(28795),e),i(n(86874),e),i(n(95310),e)},10186:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.updateRateInterestBearingMint=e.createInterestBearingMint=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(74227),u=n(90758),c=n(50472);e.createInterestBearingMint=function(t,e,n,o,d,l,h,f=i.Keypair.generate(),p,m=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(0,u.getMintLen)([u.ExtensionType.InterestBearingConfig]),s=yield t.getMinimumBalanceForRentExemption(r),g=(new i.Transaction).add(i.SystemProgram.createAccount({fromPubkey:e.publicKey,newAccountPubkey:f.publicKey,space:r,lamports:s,programId:m}),(0,c.createInitializeInterestBearingMintInstruction)(f.publicKey,d,l,m),(0,a.createInitializeMintInstruction)(f.publicKey,h,n,o,m));return yield(0,i.sendAndConfirmTransaction)(t,g,[e,f],p),f.publicKey}))},e.updateRateInterestBearingMint=function(t,e,n,a,u,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(a,d),f=(new i.Transaction).add((0,c.createUpdateRateInterestBearingMintInstruction)(n,r,u,s,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,a,...s],l)}))}},33661:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(10186),e),i(n(50472),e),i(n(4567),e)},50472:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createUpdateRateInterestBearingMintInstruction=e.createInitializeInterestBearingMintInstruction=e.interestBearingMintUpdateRateInstructionData=e.interestBearingMintInitializeInstructionData=e.InterestBearingMintInstruction=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(59546),c=n(47623);var d;!function(t){t[t.Initialize=0]="Initialize",t[t.UpdateRate=1]="UpdateRate"}(d||(e.InterestBearingMintInstruction=d={})),e.interestBearingMintInitializeInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("interestBearingMintInstruction"),(0,o.publicKey)("rateAuthority"),(0,i.s16)("rate")]),e.interestBearingMintUpdateRateInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("interestBearingMintInstruction"),(0,i.s16)("rate")]),e.createInitializeInterestBearingMintInstruction=function(t,n,i,o=a.TOKEN_2022_PROGRAM_ID){const u=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.interestBearingMintInitializeInstructionData.span);return e.interestBearingMintInitializeInstructionData.encode({instruction:c.TokenInstruction.InterestBearingMintExtension,interestBearingMintInstruction:d.Initialize,rateAuthority:n,rate:i},l),new s.TransactionInstruction({keys:u,programId:o,data:l})},e.createUpdateRateInterestBearingMintInstruction=function(t,n,i,o=[],l=a.TOKEN_2022_PROGRAM_ID){const h=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!o.length,isWritable:!1}],n,o),f=r.alloc(e.interestBearingMintUpdateRateInstructionData.span);return e.interestBearingMintUpdateRateInstructionData.encode({instruction:c.TokenInstruction.InterestBearingMintExtension,interestBearingMintInstruction:d.UpdateRate,rate:i},f),new s.TransactionInstruction({keys:h,programId:l,data:f})}},4567:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getInterestBearingMintConfigState=e.INTEREST_BEARING_MINT_CONFIG_STATE_SIZE=e.InterestBearingMintConfigStateLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.InterestBearingMintConfigStateLayout=(0,r.struct)([(0,i.publicKey)("rateAuthority"),(0,r.ns64)("initializationTimestamp"),(0,r.s16)("preUpdateAverageRate"),(0,r.ns64)("lastUpdateTimestamp"),(0,r.s16)("currentRate")]),e.INTEREST_BEARING_MINT_CONFIG_STATE_SIZE=e.InterestBearingMintConfigStateLayout.span,e.getInterestBearingMintConfigState=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.InterestBearingConfig,t.tlvData);return null!==n?e.InterestBearingMintConfigStateLayout.decode(n):null}},53868:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.disableRequiredMemoTransfers=e.enableRequiredMemoTransfers=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(40044);e.enableRequiredMemoTransfers=function(t,e,n,u,c=[],d,l=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(u,c),h=(new i.Transaction).add((0,a.createEnableRequiredMemoTransfersInstruction)(n,r,s,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...s],d)}))},e.disableRequiredMemoTransfers=function(t,e,n,u,c=[],d,l=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(u,c),h=(new i.Transaction).add((0,a.createDisableRequiredMemoTransfersInstruction)(n,r,s,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...s],d)}))}},64304:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(53868),e),i(n(40044),e),i(n(52700),e)},40044:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createDisableRequiredMemoTransfersInstruction=e.createEnableRequiredMemoTransfersInstruction=e.memoTransferInstructionData=e.MemoTransferInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);var d;function l(t,n,i,d,l){if(!(0,s.programSupportsExtensions)(l))throw new a.TokenUnsupportedInstructionError;const h=(0,u.addSigners)([{pubkey:n,isSigner:!1,isWritable:!0}],i,d),f=r.alloc(e.memoTransferInstructionData.span);return e.memoTransferInstructionData.encode({instruction:c.TokenInstruction.MemoTransferExtension,memoTransferInstruction:t},f),new o.TransactionInstruction({keys:h,programId:l,data:f})}!function(t){t[t.Enable=0]="Enable",t[t.Disable=1]="Disable"}(d||(e.MemoTransferInstruction=d={})),e.memoTransferInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("memoTransferInstruction")]),e.createEnableRequiredMemoTransfersInstruction=function(t,e,n=[],r=s.TOKEN_2022_PROGRAM_ID){return l(d.Enable,t,e,n,r)},e.createDisableRequiredMemoTransfersInstruction=function(t,e,n=[],r=s.TOKEN_2022_PROGRAM_ID){return l(d.Disable,t,e,n,r)}},52700:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getMemoTransfer=e.MEMO_TRANSFER_SIZE=e.MemoTransferLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.MemoTransferLayout=(0,r.struct)([(0,i.bool)("requireIncomingTransferMemos")]),e.MEMO_TRANSFER_SIZE=e.MemoTransferLayout.span,e.getMemoTransfer=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.MemoTransfer,t.tlvData);return null!==n?e.MemoTransferLayout.decode(n):null}},2886:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(3755),e),i(n(83239),e)},3755:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createUpdateMetadataPointerInstruction=e.updateMetadataPointerData=e.createInitializeMetadataPointerInstruction=e.initializeMetadataPointerData=e.MetadataPointerInstruction=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623),d=n(59546);var l;!function(t){t[t.Initialize=0]="Initialize",t[t.Update=1]="Update"}(l||(e.MetadataPointerInstruction=l={})),e.initializeMetadataPointerData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("metadataPointerInstruction"),(0,o.publicKey)("authority"),(0,o.publicKey)("metadataAddress")]),e.createInitializeMetadataPointerInstruction=function(t,n,i,o){if(!(0,a.programSupportsExtensions)(o))throw new u.TokenUnsupportedInstructionError;const d=[{pubkey:t,isSigner:!1,isWritable:!0}],h=r.alloc(e.initializeMetadataPointerData.span);return e.initializeMetadataPointerData.encode({instruction:c.TokenInstruction.MetadataPointerExtension,metadataPointerInstruction:l.Initialize,authority:null!=n?n:s.PublicKey.default,metadataAddress:null!=i?i:s.PublicKey.default},h),new s.TransactionInstruction({keys:d,programId:o,data:h})},e.updateMetadataPointerData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("metadataPointerInstruction"),(0,o.publicKey)("metadataAddress")]),e.createUpdateMetadataPointerInstruction=function(t,n,i,o=[],h=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(h))throw new u.TokenUnsupportedInstructionError;const f=(0,d.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],n,o),p=r.alloc(e.updateMetadataPointerData.span);return e.updateMetadataPointerData.encode({instruction:c.TokenInstruction.MetadataPointerExtension,metadataPointerInstruction:l.Update,metadataAddress:null!=i?i:s.PublicKey.default},p),new s.TransactionInstruction({keys:f,programId:h,data:p})}},83239:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getMetadataPointerState=e.METADATA_POINTER_SIZE=e.MetadataPointerLayout=void 0;const r=n(39386),i=n(27278),o=n(18245),s=n(90758);e.MetadataPointerLayout=(0,r.struct)([(0,i.publicKey)("authority"),(0,i.publicKey)("metadataAddress")]),e.METADATA_POINTER_SIZE=e.MetadataPointerLayout.span,e.getMetadataPointerState=function(t){const n=(0,s.getExtensionData)(s.ExtensionType.MetadataPointer,t.tlvData);if(null!==n){const{authority:t,metadataAddress:r}=e.MetadataPointerLayout.decode(n);return{authority:t.equals(o.PublicKey.default)?null:t,metadataAddress:r.equals(o.PublicKey.default)?null:r}}return null}},59795:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getMintCloseAuthority=e.MINT_CLOSE_AUTHORITY_SIZE=e.MintCloseAuthorityLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.MintCloseAuthorityLayout=(0,r.struct)([(0,i.publicKey)("closeAuthority")]),e.MINT_CLOSE_AUTHORITY_SIZE=e.MintCloseAuthorityLayout.span,e.getMintCloseAuthority=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.MintCloseAuthority,t.tlvData);return null!==n?e.MintCloseAuthorityLayout.decode(n):null}},36882:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNonTransferableAccount=e.getNonTransferable=e.NON_TRANSFERABLE_ACCOUNT_SIZE=e.NON_TRANSFERABLE_SIZE=e.NonTransferableLayout=void 0;const r=n(39386),i=n(90758);e.NonTransferableLayout=(0,r.struct)([]),e.NON_TRANSFERABLE_SIZE=e.NonTransferableLayout.span,e.NON_TRANSFERABLE_ACCOUNT_SIZE=e.NonTransferableLayout.span,e.getNonTransferable=function(t){const n=(0,i.getExtensionData)(i.ExtensionType.NonTransferable,t.tlvData);return null!==n?e.NonTransferableLayout.decode(n):null},e.getNonTransferableAccount=function(t){const n=(0,i.getExtensionData)(i.ExtensionType.NonTransferableAccount,t.tlvData);return null!==n?e.NonTransferableLayout.decode(n):null}},86874:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getPermanentDelegate=e.PERMANENT_DELEGATE_SIZE=e.PermanentDelegateLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.PermanentDelegateLayout=(0,r.struct)([(0,i.publicKey)("delegate")]),e.PERMANENT_DELEGATE_SIZE=e.PermanentDelegateLayout.span,e.getPermanentDelegate=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.PermanentDelegate,t.tlvData);return null!==n?e.PermanentDelegateLayout.decode(n):null}},4461:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.tokenMetadataUpdateAuthority=e.tokenMetadataRemoveKey=e.tokenMetadataUpdateFieldWithRentTransfer=e.tokenMetadataUpdateField=e.tokenMetadataInitializeWithRentTransfer=e.tokenMetadataInitialize=void 0;const i=n(18245),o=n(99564),s=n(44530),a=n(51421),u=n(90758),c=n(38257),d=n(60913),l=n(40982);e.tokenMetadataInitialize=function(t,e,n,u,c,d,l,h,f=[],p,m=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,a.getSigners)(c,f),g=(new i.Transaction).add((0,o.createInitializeInstruction)({programId:m,metadata:n,updateAuthority:u,mint:n,mintAuthority:r,name:d,symbol:l,uri:h}));return yield(0,i.sendAndConfirmTransaction)(t,g,[e,...s],p)}))},e.tokenMetadataInitializeWithRentTransfer=function(t,e,n,c,l,h,f,p,m=[],g,y=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[b,w]=(0,a.getSigners)(l,m),_=new i.Transaction,v=yield function(t,e,n,i=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=yield t.getAccountInfo(e);if(!r)throw new d.TokenAccountNotFoundError;const s=(0,o.pack)(n).length,a=(0,u.getNewAccountLenForExtensionLen)(r,e,u.ExtensionType.TokenMetadata,s,i);return a<=r.data.length?0:(yield t.getMinimumBalanceForRentExemption(a))-r.lamports}))}(t,n,{updateAuthority:c,mint:n,name:h,symbol:f,uri:p,additionalMetadata:[]},y);return v>0&&_.add(i.SystemProgram.transfer({fromPubkey:e.publicKey,toPubkey:n,lamports:v})),_.add((0,o.createInitializeInstruction)({programId:y,metadata:n,updateAuthority:c,mint:n,mintAuthority:b,name:h,symbol:f,uri:p})),yield(0,i.sendAndConfirmTransaction)(t,_,[e,...w],g)}))},e.tokenMetadataUpdateField=function(t,e,n,u,c,d,l=[],h,f=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,a.getSigners)(u,l),p=(new i.Transaction).add((0,o.createUpdateFieldInstruction)({programId:f,metadata:n,updateAuthority:r,field:c,value:d}));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...s],h)}))},e.tokenMetadataUpdateFieldWithRentTransfer=function(t,e,n,h,f,p,m=[],g,y=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[b,w]=(0,a.getSigners)(h,m),_=new i.Transaction,v=yield function(t,e,n,i,a=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=yield t.getAccountInfo(e);if(!r)throw new d.TokenAccountNotFoundError;const s=(0,l.unpackMint)(e,r,a),h=(0,u.getExtensionData)(u.ExtensionType.TokenMetadata,s.tlvData);if(null===h)throw new Error("TokenMetadata extension not initialized");const f=(0,c.updateTokenMetadata)((0,o.unpack)(h),n,i),p=(0,o.pack)(f).length,m=(0,u.getNewAccountLenForExtensionLen)(r,e,u.ExtensionType.TokenMetadata,p,a);return m<=r.data.length?0:(yield t.getMinimumBalanceForRentExemption(m))-r.lamports}))}(t,n,f,p,y);return v>0&&_.add(i.SystemProgram.transfer({fromPubkey:e.publicKey,toPubkey:n,lamports:v})),_.add((0,o.createUpdateFieldInstruction)({programId:y,metadata:n,updateAuthority:b,field:f,value:p})),yield(0,i.sendAndConfirmTransaction)(t,_,[e,...w],g)}))},e.tokenMetadataRemoveKey=function(t,e,n,u,c,d,l=[],h,f=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,a.getSigners)(u,l),p=(new i.Transaction).add((0,o.createRemoveKeyInstruction)({programId:f,metadata:n,updateAuthority:r,key:c,idempotent:d}));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...s],h)}))},e.tokenMetadataUpdateAuthority=function(t,e,n,u,c,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,a.getSigners)(u,d),f=(new i.Transaction).add((0,o.createUpdateAuthorityInstruction)({programId:h,metadata:n,oldAuthority:r,newAuthority:c}));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...s],l)}))}},61732:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(4461),e),i(n(38257),e)},38257:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getTokenMetadata=e.updateTokenMetadata=void 0;const i=n(99564),o=n(44530),s=n(90758),a=n(66446);e.updateTokenMetadata=function(t,e,n){const r=(t=>t===i.Field.Name||"Name"===t||"name"===t?"name":t===i.Field.Symbol||"Symbol"===t||"symbol"===t?"symbol":t===i.Field.Uri||"Uri"===t||"uri"===t?"uri":t)(e);if("mint"===r||"updateAuthority"===r)throw new Error(`Cannot update ${r} via this instruction`);if(["name","symbol","uri"].includes(r))return Object.assign(Object.assign({},t),{[r]:n});const o=[...t.additionalMetadata],s=t.additionalMetadata.findIndex((t=>t[0]===r));return-1===s?o.push([r,n]):o[s]=[r,n],Object.assign(Object.assign({},t),{additionalMetadata:o})},e.getTokenMetadata=function(t,e,n,u=o.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=yield(0,a.getMint)(t,e,n,u),o=(0,s.getExtensionData)(s.ExtensionType.TokenMetadata,r.tlvData);return null===o?null:(0,i.unpack)(o)}))}},25297:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.harvestWithheldTokensToMint=e.withdrawWithheldTokensFromAccounts=e.withdrawWithheldTokensFromMint=e.transferCheckedWithFee=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(29520);e.transferCheckedWithFee=function(t,e,n,u,c,d,l,h,f,p=[],m,g=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(d,p),y=(new i.Transaction).add((0,a.createTransferCheckedWithFeeInstruction)(n,u,c,r,l,h,f,p,g));return yield(0,i.sendAndConfirmTransaction)(t,y,[e,...s],m)}))},e.withdrawWithheldTokensFromMint=function(t,e,n,u,c,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(c,d),f=(new i.Transaction).add((0,a.createWithdrawWithheldTokensFromMintInstruction)(n,u,r,s,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...s],l)}))},e.withdrawWithheldTokensFromAccounts=function(t,e,n,u,c,d,l,h,f=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(c,d),p=(new i.Transaction).add((0,a.createWithdrawWithheldTokensFromAccountsInstruction)(n,u,r,s,l,f));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...s],h)}))},e.harvestWithheldTokensToMint=function(t,e,n,o,u,c=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(new i.Transaction).add((0,a.createHarvestWithheldTokensToMintInstruction)(n,o,c));return yield(0,i.sendAndConfirmTransaction)(t,r,[e],u)}))}},28795:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(25297),e),i(n(29520),e),i(n(96663),e)},29520:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHarvestWithheldTokensToMintInstructionUnchecked=e.decodeHarvestWithheldTokensToMintInstruction=e.createHarvestWithheldTokensToMintInstruction=e.harvestWithheldTokensToMintInstructionData=e.decodeWithdrawWithheldTokensFromAccountsInstructionUnchecked=e.decodeWithdrawWithheldTokensFromAccountsInstruction=e.createWithdrawWithheldTokensFromAccountsInstruction=e.withdrawWithheldTokensFromAccountsInstructionData=e.decodeWithdrawWithheldTokensFromMintInstructionUnchecked=e.decodeWithdrawWithheldTokensFromMintInstruction=e.createWithdrawWithheldTokensFromMintInstruction=e.withdrawWithheldTokensFromMintInstructionData=e.decodeTransferCheckedWithFeeInstructionUnchecked=e.decodeTransferCheckedWithFeeInstruction=e.createTransferCheckedWithFeeInstruction=e.transferCheckedWithFeeInstructionData=e.decodeInitializeTransferFeeConfigInstructionUnchecked=e.decodeInitializeTransferFeeConfigInstruction=e.createInitializeTransferFeeConfigInstruction=e.initializeTransferFeeConfigInstructionData=e.TransferFeeInstruction=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);var l;function h({programId:t,keys:[n],data:r}){const{instruction:i,transferFeeInstruction:o,transferFeeConfigAuthorityOption:s,transferFeeConfigAuthority:a,withdrawWithheldAuthorityOption:u,withdrawWithheldAuthority:c,transferFeeBasisPoints:d,maximumFee:l}=e.initializeTransferFeeConfigInstructionData.decode(r);return{programId:t,keys:{mint:n},data:{instruction:i,transferFeeInstruction:o,transferFeeConfigAuthority:s?a:null,withdrawWithheldAuthority:u?c:null,transferFeeBasisPoints:d,maximumFee:l}}}function f({programId:t,keys:[n,r,i,o,...s],data:a}){const{instruction:u,transferFeeInstruction:c,amount:d,decimals:l,fee:h}=e.transferCheckedWithFeeInstructionData.decode(a);return{programId:t,keys:{source:n,mint:r,destination:i,authority:o,signers:s},data:{instruction:u,transferFeeInstruction:c,amount:d,decimals:l,fee:h}}}function p({programId:t,keys:[n,r,i,...o],data:s}){const{instruction:a,transferFeeInstruction:u}=e.withdrawWithheldTokensFromMintInstructionData.decode(s);return{programId:t,keys:{mint:n,destination:r,authority:i,signers:o},data:{instruction:a,transferFeeInstruction:u}}}function m({programId:t,keys:n,data:r}){const{instruction:i,transferFeeInstruction:o,numTokenAccounts:s}=e.withdrawWithheldTokensFromAccountsInstructionData.decode(r),[a,u,c,d,l]=[n[0],n[1],n[2],n.slice(3,3+s),n.slice(-1*s)];return{programId:t,keys:{mint:a,destination:u,authority:c,signers:d,sources:l},data:{instruction:i,transferFeeInstruction:o,numTokenAccounts:s}}}function g({programId:t,keys:[n,...r],data:i}){const{instruction:o,transferFeeInstruction:s}=e.harvestWithheldTokensToMintInstructionData.decode(i);return{programId:t,keys:{mint:n,sources:r},data:{instruction:o,transferFeeInstruction:s}}}!function(t){t[t.InitializeTransferFeeConfig=0]="InitializeTransferFeeConfig",t[t.TransferCheckedWithFee=1]="TransferCheckedWithFee",t[t.WithdrawWithheldTokensFromMint=2]="WithdrawWithheldTokensFromMint",t[t.WithdrawWithheldTokensFromAccounts=3]="WithdrawWithheldTokensFromAccounts",t[t.HarvestWithheldTokensToMint=4]="HarvestWithheldTokensToMint",t[t.SetTransferFee=5]="SetTransferFee"}(l||(e.TransferFeeInstruction=l={})),e.initializeTransferFeeConfigInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction"),(0,i.u8)("transferFeeConfigAuthorityOption"),(0,o.publicKey)("transferFeeConfigAuthority"),(0,i.u8)("withdrawWithheldAuthorityOption"),(0,o.publicKey)("withdrawWithheldAuthority"),(0,i.u16)("transferFeeBasisPoints"),(0,o.u64)("maximumFee")]),e.createInitializeTransferFeeConfigInstruction=function(t,n,i,o,c,h=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(h))throw new u.TokenUnsupportedInstructionError;const f=[{pubkey:t,isSigner:!1,isWritable:!0}],p=r.alloc(e.initializeTransferFeeConfigInstructionData.span);return e.initializeTransferFeeConfigInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.InitializeTransferFeeConfig,transferFeeConfigAuthorityOption:n?1:0,transferFeeConfigAuthority:n||new s.PublicKey(0),withdrawWithheldAuthorityOption:i?1:0,withdrawWithheldAuthority:i||new s.PublicKey(0),transferFeeBasisPoints:o,maximumFee:c},p),new s.TransactionInstruction({keys:f,programId:h,data:p})},e.decodeInitializeTransferFeeConfigInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeTransferFeeConfigInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=h(t);if(i.instruction!==d.TokenInstruction.TransferFeeExtension||i.transferFeeInstruction!==l.InitializeTransferFeeConfig)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeInitializeTransferFeeConfigInstructionUnchecked=h,e.transferCheckedWithFeeInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction"),(0,o.u64)("amount"),(0,i.u8)("decimals"),(0,o.u64)("fee")]),e.createTransferCheckedWithFeeInstruction=function(t,n,i,o,h,f,p,m=[],g=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(g))throw new u.TokenUnsupportedInstructionError;const y=r.alloc(e.transferCheckedWithFeeInstructionData.span);e.transferCheckedWithFeeInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.TransferCheckedWithFee,amount:h,decimals:f,fee:p},y);const b=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!0}],o,m);return new s.TransactionInstruction({keys:b,programId:g,data:y})},e.decodeTransferCheckedWithFeeInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.transferCheckedWithFeeInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{source:r,mint:i,destination:o,authority:s,signers:a},data:c}=f(t);if(c.instruction!==d.TokenInstruction.TransferFeeExtension||c.transferFeeInstruction!==l.TransferCheckedWithFee)throw new u.TokenInvalidInstructionTypeError;if(!i)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{source:r,mint:i,destination:o,authority:s,signers:a||null},data:c}},e.decodeTransferCheckedWithFeeInstructionUnchecked=f,e.withdrawWithheldTokensFromMintInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction")]),e.createWithdrawWithheldTokensFromMintInstruction=function(t,n,i,o=[],h=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(h))throw new u.TokenUnsupportedInstructionError;const f=r.alloc(e.withdrawWithheldTokensFromMintInstructionData.span);e.withdrawWithheldTokensFromMintInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.WithdrawWithheldTokensFromMint},f);const p=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,o);return new s.TransactionInstruction({keys:p,programId:h,data:f})},e.decodeWithdrawWithheldTokensFromMintInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.withdrawWithheldTokensFromMintInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,destination:i,authority:o,signers:s},data:a}=p(t);if(a.instruction!==d.TokenInstruction.TransferFeeExtension||a.transferFeeInstruction!==l.WithdrawWithheldTokensFromMint)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,destination:i,authority:o,signers:s||null},data:a}},e.decodeWithdrawWithheldTokensFromMintInstructionUnchecked=p,e.withdrawWithheldTokensFromAccountsInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction"),(0,i.u8)("numTokenAccounts")]),e.createWithdrawWithheldTokensFromAccountsInstruction=function(t,n,i,o,h,f=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(f))throw new u.TokenUnsupportedInstructionError;const p=r.alloc(e.withdrawWithheldTokensFromAccountsInstructionData.span);e.withdrawWithheldTokensFromAccountsInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.WithdrawWithheldTokensFromAccounts,numTokenAccounts:h.length},p);const m=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,o);for(const t of h)m.push({pubkey:t,isSigner:!1,isWritable:!0});return new s.TransactionInstruction({keys:m,programId:f,data:p})},e.decodeWithdrawWithheldTokensFromAccountsInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.withdrawWithheldTokensFromAccountsInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,destination:i,authority:o,signers:s,sources:a},data:c}=m(t);if(c.instruction!==d.TokenInstruction.TransferFeeExtension||c.transferFeeInstruction!==l.WithdrawWithheldTokensFromAccounts)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,destination:i,authority:o,signers:s||null,sources:a||null},data:c}},e.decodeWithdrawWithheldTokensFromAccountsInstructionUnchecked=m,e.harvestWithheldTokensToMintInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction")]),e.createHarvestWithheldTokensToMintInstruction=function(t,n,i=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(i))throw new u.TokenUnsupportedInstructionError;const o=r.alloc(e.harvestWithheldTokensToMintInstructionData.span);e.harvestWithheldTokensToMintInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.HarvestWithheldTokensToMint},o);const c=[];c.push({pubkey:t,isSigner:!1,isWritable:!0});for(const t of n)c.push({pubkey:t,isSigner:!1,isWritable:!0});return new s.TransactionInstruction({keys:c,programId:i,data:o})},e.decodeHarvestWithheldTokensToMintInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.harvestWithheldTokensToMintInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,sources:i},data:o}=g(t);if(o.instruction!==d.TokenInstruction.TransferFeeExtension||o.transferFeeInstruction!==l.HarvestWithheldTokensToMint)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,sources:i},data:o}},e.decodeHarvestWithheldTokensToMintInstructionUnchecked=g},96663:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTransferFeeAmount=e.getTransferFeeConfig=e.TRANSFER_FEE_AMOUNT_SIZE=e.TransferFeeAmountLayout=e.calculateEpochFee=e.getEpochFee=e.TRANSFER_FEE_CONFIG_SIZE=e.TransferFeeConfigLayout=e.calculateFee=e.transferFeeLayout=e.ONE_IN_BASIS_POINTS=e.MAX_FEE_BASIS_POINTS=void 0;const r=n(39386),i=n(27278),o=n(90758);function s(t){return(0,r.struct)([(0,i.u64)("epoch"),(0,i.u64)("maximumFee"),(0,r.u16)("transferFeeBasisPoints")],t)}function a(t,n){const r=t.transferFeeBasisPoints;if(0===r||n===BigInt(0))return BigInt(0);{const i=(n*BigInt(r)+e.ONE_IN_BASIS_POINTS-BigInt(1))/e.ONE_IN_BASIS_POINTS,o=i>t.maximumFee?t.maximumFee:i;return BigInt(o)}}function u(t,e){return e>=t.newerTransferFee.epoch?t.newerTransferFee:t.olderTransferFee}e.MAX_FEE_BASIS_POINTS=1e4,e.ONE_IN_BASIS_POINTS=BigInt(e.MAX_FEE_BASIS_POINTS),e.transferFeeLayout=s,e.calculateFee=a,e.TransferFeeConfigLayout=(0,r.struct)([(0,i.publicKey)("transferFeeConfigAuthority"),(0,i.publicKey)("withdrawWithheldAuthority"),(0,i.u64)("withheldAmount"),s("olderTransferFee"),s("newerTransferFee")]),e.TRANSFER_FEE_CONFIG_SIZE=e.TransferFeeConfigLayout.span,e.getEpochFee=u,e.calculateEpochFee=function(t,e,n){return a(u(t,e),n)},e.TransferFeeAmountLayout=(0,r.struct)([(0,i.u64)("withheldAmount")]),e.TRANSFER_FEE_AMOUNT_SIZE=e.TransferFeeAmountLayout.span,e.getTransferFeeConfig=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.TransferFeeConfig,t.tlvData);return null!==n?e.TransferFeeConfigLayout.decode(n):null},e.getTransferFeeAmount=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.TransferFeeAmount,t.tlvData);return null!==n?e.TransferFeeAmountLayout.decode(n):null}},28680:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.transferCheckedWithFeeAndTransferHook=e.transferCheckedWithTransferHook=e.updateTransferHook=e.initializeTransferHook=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(92187);e.initializeTransferHook=function(t,e,n,o,u,c,d=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(new i.Transaction).add((0,a.createInitializeTransferHookInstruction)(n,o,u,d));return yield(0,i.sendAndConfirmTransaction)(t,r,[e],c)}))},e.updateTransferHook=function(t,e,n,u,c,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(c,d),f=(new i.Transaction).add((0,a.createUpdateTransferHookInstruction)(n,r,u,s,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...s],l)}))},e.transferCheckedWithTransferHook=function(t,e,n,u,c,d,l,h,f=[],p,m=s.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(d,f),g=(new i.Transaction).add(yield(0,a.createTransferCheckedWithTransferHookInstruction)(t,n,u,c,r,l,h,s,null==p?void 0:p.commitment,m));return yield(0,i.sendAndConfirmTransaction)(t,g,[e,...s],p)}))},e.transferCheckedWithFeeAndTransferHook=function(t,e,n,u,c,d,l,h,f,p=[],m,g=s.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(d,p),y=(new i.Transaction).add(yield(0,a.createTransferCheckedWithFeeAndTransferHookInstruction)(t,n,u,c,r,l,h,f,s,null==m?void 0:m.commitment,g));return yield(0,i.sendAndConfirmTransaction)(t,y,[e,...s],m)}))}},95310:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(28680),e),i(n(92187),e),i(n(76020),e),i(n(73322),e)},92187:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.createTransferCheckedWithFeeAndTransferHookInstruction=e.createTransferCheckedWithTransferHookInstruction=e.addExtraAccountsToInstruction=e.createUpdateTransferHookInstruction=e.updateTransferHookInstructionData=e.createInitializeTransferHookInstruction=e.initializeTransferHookInstructionData=e.TransferHookInstruction=void 0;const o=n(39386),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623),l=n(27278),h=n(35593),f=n(29520),p=n(66446),m=n(73322);var g;function y(t,e){const n=e.filter((e=>e.pubkey===t.pubkey)).reduce(((t,e)=>t?{isSigner:t.isSigner||e.isSigner,isWritable:t.isWritable||e.isWritable}:{isSigner:e.isSigner,isWritable:e.isWritable}),void 0);if(n){const{isSigner:e,isWritable:r}=n;e||e===t.isSigner||(t.isSigner=!1),r||r===t.isWritable||(t.isWritable=!1)}return t}function b(t,e,n,r,o=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){if(!(0,a.programSupportsExtensions)(o))throw new u.TokenUnsupportedInstructionError;const i=yield(0,p.getMint)(t,n,r,o),c=(0,m.getTransferHook)(i);if(null==c)return e;const d=(0,m.getExtraAccountMetaAddress)(n,c.programId),l=yield t.getAccountInfo(d,r);if(null==l)return e;const h=(0,m.getExtraAccountMetas)(l),f=e.keys;for(const n of h){const r=y(yield(0,m.resolveExtraAccountMeta)(t,n,f,e.data,c.programId),f);f.push(r)}return f.push({pubkey:c.programId,isSigner:!1,isWritable:!1}),f.push({pubkey:d,isSigner:!1,isWritable:!1}),new s.TransactionInstruction({keys:f,programId:o,data:e.data})}))}!function(t){t[t.Initialize=0]="Initialize",t[t.Update=1]="Update"}(g||(e.TransferHookInstruction=g={})),e.initializeTransferHookInstructionData=(0,o.struct)([(0,o.u8)("instruction"),(0,o.u8)("transferHookInstruction"),(0,l.publicKey)("authority"),(0,l.publicKey)("transferHookProgramId")]),e.createInitializeTransferHookInstruction=function(t,n,i,o){if(!(0,a.programSupportsExtensions)(o))throw new u.TokenUnsupportedInstructionError;const c=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.initializeTransferHookInstructionData.span);return e.initializeTransferHookInstructionData.encode({instruction:d.TokenInstruction.TransferHookExtension,transferHookInstruction:g.Initialize,authority:n,transferHookProgramId:i},l),new s.TransactionInstruction({keys:c,programId:o,data:l})},e.updateTransferHookInstructionData=(0,o.struct)([(0,o.u8)("instruction"),(0,o.u8)("transferHookInstruction"),(0,l.publicKey)("transferHookProgramId")]),e.createUpdateTransferHookInstruction=function(t,n,i,o=[],l=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(l))throw new u.TokenUnsupportedInstructionError;const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],n,o),f=r.alloc(e.updateTransferHookInstructionData.span);return e.updateTransferHookInstructionData.encode({instruction:d.TokenInstruction.TransferHookExtension,transferHookInstruction:g.Update,transferHookProgramId:i},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.addExtraAccountsToInstruction=b,e.createTransferCheckedWithTransferHookInstruction=function(t,e,n,r,o,s,u,c=[],d,l=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=(0,h.createTransferCheckedInstruction)(e,n,r,o,s,u,c,l);return yield b(t,i,n,d,l)}))},e.createTransferCheckedWithFeeAndTransferHookInstruction=function(t,e,n,r,o,s,u,c,d=[],l,h=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=(0,f.createTransferCheckedWithFeeInstruction)(e,n,r,o,s,u,c,d,h);return yield b(t,i,n,l,h)}))}},76020:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.unpackSeeds=void 0;const o=n(60913);function s(t,e,n,s){return i(this,void 0,void 0,(function*(){const[a,...u]=t,c=new Uint8Array(u);switch(a){case 0:return null;case 1:return function(t){if(t.length<1)throw new o.TokenTransferHookInvalidSeed;const[e,...n]=t;if(n.length{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAmountToUiAmountInstructionUnchecked=e.decodeAmountToUiAmountInstruction=e.createAmountToUiAmountInstruction=e.amountToUiAmountInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n],data:r}){return{programId:t,keys:{mint:n},data:e.amountToUiAmountInstructionData.decode(r)}}e.amountToUiAmountInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createAmountToUiAmountInstruction=function(t,n,i=a.TOKEN_PROGRAM_ID){const o=[{pubkey:t,isSigner:!1,isWritable:!1}],u=r.alloc(e.amountToUiAmountInstructionData.span);return e.amountToUiAmountInstructionData.encode({instruction:c.TokenInstruction.AmountToUiAmount,amount:BigInt(n)},u),new s.TransactionInstruction({keys:o,programId:i,data:u})},e.decodeAmountToUiAmountInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.amountToUiAmountInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=d(t);if(i.instruction!==c.TokenInstruction.AmountToUiAmount)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeAmountToUiAmountInstructionUnchecked=d},55431:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeApproveInstructionUnchecked=e.decodeApproveInstruction=e.createApproveInstruction=e.approveInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,delegate:r,owner:i,multiSigners:o},data:e.approveInstructionData.decode(s)}}e.approveInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createApproveInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],i,u),f=r.alloc(e.approveInstructionData.span);return e.approveInstructionData.encode({instruction:d.TokenInstruction.Approve,amount:BigInt(o)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeApproveInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.approveInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,delegate:i,owner:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.Approve)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,delegate:i,owner:o,multiSigners:s},data:c}},e.decodeApproveInstructionUnchecked=l},18228:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeApproveCheckedInstructionUnchecked=e.decodeApproveCheckedInstruction=e.createApproveCheckedInstruction=e.approveCheckedInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,o,...s],data:a}){return{programId:t,keys:{account:n,mint:r,delegate:i,owner:o,multiSigners:s},data:e.approveCheckedInstructionData.decode(a)}}e.approveCheckedInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount"),(0,i.u8)("decimals")]),e.createApproveCheckedInstruction=function(t,n,i,o,u,l,h=[],f=a.TOKEN_PROGRAM_ID){const p=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1}],o,h),m=r.alloc(e.approveCheckedInstructionData.span);return e.approveCheckedInstructionData.encode({instruction:d.TokenInstruction.ApproveChecked,amount:BigInt(u),decimals:l},m),new s.TransactionInstruction({keys:p,programId:f,data:m})},e.decodeApproveCheckedInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.approveCheckedInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,delegate:o,owner:s,multiSigners:c},data:h}=l(t);if(h.instruction!==d.TokenInstruction.ApproveChecked)throw new u.TokenInvalidInstructionTypeError;if(!(r&&i&&o&&s))throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,delegate:o,owner:s,multiSigners:c},data:h}},e.decodeApproveCheckedInstructionUnchecked=l},31183:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createRecoverNestedInstruction=e.createAssociatedTokenAccountIdempotentInstruction=e.createAssociatedTokenAccountInstruction=void 0;const i=n(18245),o=n(44530);function s(t,e,n,r,s,a=o.TOKEN_PROGRAM_ID,u=o.ASSOCIATED_TOKEN_PROGRAM_ID){const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:i.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}];return new i.TransactionInstruction({keys:c,programId:u,data:s})}e.createAssociatedTokenAccountInstruction=function(t,e,n,i,a=o.TOKEN_PROGRAM_ID,u=o.ASSOCIATED_TOKEN_PROGRAM_ID){return s(t,e,n,i,r.alloc(0),a,u)},e.createAssociatedTokenAccountIdempotentInstruction=function(t,e,n,i,a=o.TOKEN_PROGRAM_ID,u=o.ASSOCIATED_TOKEN_PROGRAM_ID){return s(t,e,n,i,r.from([1]),a,u)},e.createRecoverNestedInstruction=function(t,e,n,s,a,u,c=o.TOKEN_PROGRAM_ID,d=o.ASSOCIATED_TOKEN_PROGRAM_ID){const l=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:a,isSigner:!1,isWritable:!1},{pubkey:u,isSigner:!0,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!1}];return new i.TransactionInstruction({keys:l,programId:d,data:r.from([2])})}},8339:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeBurnInstructionUnchecked=e.decodeBurnInstruction=e.createBurnInstruction=e.burnInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,mint:r,owner:i,multiSigners:o},data:e.burnInstructionData.decode(s)}}e.burnInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createBurnInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,u),f=r.alloc(e.burnInstructionData.span);return e.burnInstructionData.encode({instruction:d.TokenInstruction.Burn,amount:BigInt(o)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeBurnInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.burnInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,owner:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.Burn)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,owner:o,multiSigners:s},data:c}},e.decodeBurnInstructionUnchecked=l},1853:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeBurnCheckedInstructionUnchecked=e.decodeBurnCheckedInstruction=e.createBurnCheckedInstruction=e.burnCheckedInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,mint:r,owner:i,multiSigners:o},data:e.burnCheckedInstructionData.decode(s)}}e.burnCheckedInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount"),(0,i.u8)("decimals")]),e.createBurnCheckedInstruction=function(t,n,i,o,u,l=[],h=a.TOKEN_PROGRAM_ID){const f=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,l),p=r.alloc(e.burnCheckedInstructionData.span);return e.burnCheckedInstructionData.encode({instruction:d.TokenInstruction.BurnChecked,amount:BigInt(o),decimals:u},p),new s.TransactionInstruction({keys:f,programId:h,data:p})},e.decodeBurnCheckedInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.burnCheckedInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,owner:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.BurnChecked)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,owner:o,multiSigners:s},data:c}},e.decodeBurnCheckedInstructionUnchecked=l},36038:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeCloseAccountInstructionUnchecked=e.decodeCloseAccountInstruction=e.createCloseAccountInstruction=e.closeAccountInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);function d({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,destination:r,authority:i,multiSigners:o},data:e.closeAccountInstructionData.decode(s)}}e.closeAccountInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createCloseAccountInstruction=function(t,n,i,a=[],d=s.TOKEN_PROGRAM_ID){const l=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,a),h=r.alloc(e.closeAccountInstructionData.span);return e.closeAccountInstructionData.encode({instruction:c.TokenInstruction.CloseAccount},h),new o.TransactionInstruction({keys:l,programId:d,data:h})},e.decodeCloseAccountInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.closeAccountInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,destination:i,authority:o,multiSigners:u},data:l}=d(t);if(l.instruction!==c.TokenInstruction.CloseAccount)throw new a.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,destination:i,authority:o,multiSigners:u},data:l}},e.decodeCloseAccountInstructionUnchecked=d},42421:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createCreateNativeMintInstruction=e.createNativeMintInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);e.createNativeMintInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createCreateNativeMintInstruction=function(t,n=s.NATIVE_MINT_2022,i=s.TOKEN_2022_PROGRAM_ID){if(!(0,s.programSupportsExtensions)(i))throw new a.TokenUnsupportedInstructionError;const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:o.SystemProgram.programId,isSigner:!1,isWritable:!1}],d=r.alloc(e.createNativeMintInstructionData.span);return e.createNativeMintInstructionData.encode({instruction:u.TokenInstruction.CreateNativeMint},d),new o.TransactionInstruction({keys:c,programId:i,data:d})}},7561:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isUiamountToAmountInstruction=e.isAmountToUiAmountInstruction=e.isInitializeMint2Instruction=e.isInitializeAccount3Instruction=e.isSyncNativeInstruction=e.isInitializeAccount2Instruction=e.isBurnCheckedInstruction=e.isMintToCheckedInstruction=e.isApproveCheckedInstruction=e.isTransferCheckedInstruction=e.isThawAccountInstruction=e.isFreezeAccountInstruction=e.isCloseAccountInstruction=e.isBurnInstruction=e.isMintToInstruction=e.isSetAuthorityInstruction=e.isRevokeInstruction=e.isApproveInstruction=e.isTransferInstruction=e.isInitializeMultisigInstruction=e.isInitializeAccountInstruction=e.isInitializeMintInstruction=e.decodeInstruction=void 0;const r=n(39386),i=n(44530),o=n(60913),s=n(10540),a=n(55431),u=n(18228),c=n(8339),d=n(1853),l=n(36038),h=n(56513),f=n(58328),p=n(63642),m=n(25910),g=n(74227),y=n(19066),b=n(65061),w=n(74761),_=n(70698),v=n(62216),k=n(95816),M=n(75836),A=n(19040),S=n(72874),I=n(35593),x=n(47623),E=n(21470);e.decodeInstruction=function(t,e=i.TOKEN_PROGRAM_ID){if(!t.data.length)throw new o.TokenInvalidInstructionDataError;const n=(0,r.u8)().decode(t.data);if(n===x.TokenInstruction.InitializeMint)return(0,g.decodeInitializeMintInstruction)(t,e);if(n===x.TokenInstruction.InitializeAccount)return(0,f.decodeInitializeAccountInstruction)(t,e);if(n===x.TokenInstruction.InitializeMultisig)return(0,b.decodeInitializeMultisigInstruction)(t,e);if(n===x.TokenInstruction.Transfer)return(0,S.decodeTransferInstruction)(t,e);if(n===x.TokenInstruction.Approve)return(0,a.decodeApproveInstruction)(t,e);if(n===x.TokenInstruction.Revoke)return(0,v.decodeRevokeInstruction)(t,e);if(n===x.TokenInstruction.SetAuthority)return(0,k.decodeSetAuthorityInstruction)(t,e);if(n===x.TokenInstruction.MintTo)return(0,w.decodeMintToInstruction)(t,e);if(n===x.TokenInstruction.Burn)return(0,c.decodeBurnInstruction)(t,e);if(n===x.TokenInstruction.CloseAccount)return(0,l.decodeCloseAccountInstruction)(t,e);if(n===x.TokenInstruction.FreezeAccount)return(0,h.decodeFreezeAccountInstruction)(t,e);if(n===x.TokenInstruction.ThawAccount)return(0,A.decodeThawAccountInstruction)(t,e);if(n===x.TokenInstruction.TransferChecked)return(0,I.decodeTransferCheckedInstruction)(t,e);if(n===x.TokenInstruction.ApproveChecked)return(0,u.decodeApproveCheckedInstruction)(t,e);if(n===x.TokenInstruction.MintToChecked)return(0,_.decodeMintToCheckedInstruction)(t,e);if(n===x.TokenInstruction.BurnChecked)return(0,d.decodeBurnCheckedInstruction)(t,e);if(n===x.TokenInstruction.InitializeAccount2)return(0,p.decodeInitializeAccount2Instruction)(t,e);if(n===x.TokenInstruction.SyncNative)return(0,M.decodeSyncNativeInstruction)(t,e);if(n===x.TokenInstruction.InitializeAccount3)return(0,m.decodeInitializeAccount3Instruction)(t,e);if(n===x.TokenInstruction.InitializeMint2)return(0,y.decodeInitializeMint2Instruction)(t,e);if(n===x.TokenInstruction.AmountToUiAmount)return(0,s.decodeAmountToUiAmountInstruction)(t,e);if(n===x.TokenInstruction.UiAmountToAmount)return(0,E.decodeUiAmountToAmountInstruction)(t,e);if(n===x.TokenInstruction.InitializeMultisig2)throw new o.TokenInvalidInstructionTypeError;throw new o.TokenInvalidInstructionTypeError},e.isInitializeMintInstruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeMint},e.isInitializeAccountInstruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeAccount},e.isInitializeMultisigInstruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeMultisig},e.isTransferInstruction=function(t){return t.data.instruction===x.TokenInstruction.Transfer},e.isApproveInstruction=function(t){return t.data.instruction===x.TokenInstruction.Approve},e.isRevokeInstruction=function(t){return t.data.instruction===x.TokenInstruction.Revoke},e.isSetAuthorityInstruction=function(t){return t.data.instruction===x.TokenInstruction.SetAuthority},e.isMintToInstruction=function(t){return t.data.instruction===x.TokenInstruction.MintTo},e.isBurnInstruction=function(t){return t.data.instruction===x.TokenInstruction.Burn},e.isCloseAccountInstruction=function(t){return t.data.instruction===x.TokenInstruction.CloseAccount},e.isFreezeAccountInstruction=function(t){return t.data.instruction===x.TokenInstruction.FreezeAccount},e.isThawAccountInstruction=function(t){return t.data.instruction===x.TokenInstruction.ThawAccount},e.isTransferCheckedInstruction=function(t){return t.data.instruction===x.TokenInstruction.TransferChecked},e.isApproveCheckedInstruction=function(t){return t.data.instruction===x.TokenInstruction.ApproveChecked},e.isMintToCheckedInstruction=function(t){return t.data.instruction===x.TokenInstruction.MintToChecked},e.isBurnCheckedInstruction=function(t){return t.data.instruction===x.TokenInstruction.BurnChecked},e.isInitializeAccount2Instruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeAccount2},e.isSyncNativeInstruction=function(t){return t.data.instruction===x.TokenInstruction.SyncNative},e.isInitializeAccount3Instruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeAccount3},e.isInitializeMint2Instruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeMint2},e.isAmountToUiAmountInstruction=function(t){return t.data.instruction===x.TokenInstruction.AmountToUiAmount},e.isUiamountToAmountInstruction=function(t){return t.data.instruction===x.TokenInstruction.UiAmountToAmount}},56513:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeFreezeAccountInstructionUnchecked=e.decodeFreezeAccountInstruction=e.createFreezeAccountInstruction=e.freezeAccountInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);function d({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,mint:r,authority:i,multiSigners:o},data:e.freezeAccountInstructionData.decode(s)}}e.freezeAccountInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createFreezeAccountInstruction=function(t,n,i,a=[],d=s.TOKEN_PROGRAM_ID){const l=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],i,a),h=r.alloc(e.freezeAccountInstructionData.span);return e.freezeAccountInstructionData.encode({instruction:c.TokenInstruction.FreezeAccount},h),new o.TransactionInstruction({keys:l,programId:d,data:h})},e.decodeFreezeAccountInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.freezeAccountInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,authority:o,multiSigners:u},data:l}=d(t);if(l.instruction!==c.TokenInstruction.FreezeAccount)throw new a.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,authority:o,multiSigners:u},data:l}},e.decodeFreezeAccountInstructionUnchecked=d},32689:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.createEmitInstruction=e.createUpdateAuthorityInstruction=e.createRemoveKeyInstruction=e.createUpdateFieldInstruction=e.createInitializeInstruction=void 0;var o=n(99564);Object.defineProperty(e,"createInitializeInstruction",{enumerable:!0,get:function(){return o.createInitializeInstruction}}),Object.defineProperty(e,"createUpdateFieldInstruction",{enumerable:!0,get:function(){return o.createUpdateFieldInstruction}}),Object.defineProperty(e,"createRemoveKeyInstruction",{enumerable:!0,get:function(){return o.createRemoveKeyInstruction}}),Object.defineProperty(e,"createUpdateAuthorityInstruction",{enumerable:!0,get:function(){return o.createUpdateAuthorityInstruction}}),Object.defineProperty(e,"createEmitInstruction",{enumerable:!0,get:function(){return o.createEmitInstruction}}),i(n(31183),e),i(n(7561),e),i(n(47623),e),i(n(74227),e),i(n(58328),e),i(n(65061),e),i(n(72874),e),i(n(55431),e),i(n(62216),e),i(n(95816),e),i(n(74761),e),i(n(8339),e),i(n(36038),e),i(n(56513),e),i(n(19040),e),i(n(35593),e),i(n(18228),e),i(n(70698),e),i(n(1853),e),i(n(63642),e),i(n(75836),e),i(n(25910),e),i(n(38817),e),i(n(19066),e),i(n(51327),e),i(n(10540),e),i(n(21470),e),i(n(36520),e),i(n(93537),e),i(n(42421),e),i(n(66780),e),i(n(68205),e)},58328:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeAccountInstructionUnchecked=e.decodeInitializeAccountInstruction=e.createInitializeAccountInstruction=e.initializeAccountInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);function c({programId:t,keys:[n,r,i,o],data:s}){return{programId:t,keys:{account:n,mint:r,owner:i,rent:o},data:e.initializeAccountInstructionData.decode(s)}}e.initializeAccountInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createInitializeAccountInstruction=function(t,n,i,a=s.TOKEN_PROGRAM_ID){const c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],d=r.alloc(e.initializeAccountInstructionData.span);return e.initializeAccountInstructionData.encode({instruction:u.TokenInstruction.InitializeAccount},d),new o.TransactionInstruction({keys:c,programId:a,data:d})},e.decodeInitializeAccountInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeAccountInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,owner:o,rent:d},data:l}=c(t);if(l.instruction!==u.TokenInstruction.InitializeAccount)throw new a.TokenInvalidInstructionTypeError;if(!(r&&i&&o&&d))throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,owner:o,rent:d},data:l}},e.decodeInitializeAccountInstructionUnchecked=c},63642:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeAccount2InstructionUnchecked=e.decodeInitializeAccount2Instruction=e.createInitializeAccount2Instruction=e.initializeAccount2InstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n,r,i],data:o}){return{programId:t,keys:{account:n,mint:r,rent:i},data:e.initializeAccount2InstructionData.decode(o)}}e.initializeAccount2InstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.publicKey)("owner")]),e.createInitializeAccount2Instruction=function(t,n,i,o=a.TOKEN_PROGRAM_ID){const u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],d=r.alloc(e.initializeAccount2InstructionData.span);return e.initializeAccount2InstructionData.encode({instruction:c.TokenInstruction.InitializeAccount2,owner:i},d),new s.TransactionInstruction({keys:u,programId:o,data:d})},e.decodeInitializeAccount2Instruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeAccount2InstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,rent:o},data:s}=d(t);if(s.instruction!==c.TokenInstruction.InitializeAccount2)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,rent:o},data:s}},e.decodeInitializeAccount2InstructionUnchecked=d},25910:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeAccount3InstructionUnchecked=e.decodeInitializeAccount3Instruction=e.createInitializeAccount3Instruction=e.initializeAccount3InstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n,r],data:i}){return{programId:t,keys:{account:n,mint:r},data:e.initializeAccount3InstructionData.decode(i)}}e.initializeAccount3InstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.publicKey)("owner")]),e.createInitializeAccount3Instruction=function(t,n,i,o=a.TOKEN_PROGRAM_ID){const u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],d=r.alloc(e.initializeAccount3InstructionData.span);return e.initializeAccount3InstructionData.encode({instruction:c.TokenInstruction.InitializeAccount3,owner:i},d),new s.TransactionInstruction({keys:u,programId:o,data:d})},e.decodeInitializeAccount3Instruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeAccount3InstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i},data:o}=d(t);if(o.instruction!==c.TokenInstruction.InitializeAccount3)throw new u.TokenInvalidInstructionTypeError;if(!r||!i)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i},data:o}},e.decodeInitializeAccount3InstructionUnchecked=d},51327:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeImmutableOwnerInstructionUnchecked=e.decodeInitializeImmutableOwnerInstruction=e.createInitializeImmutableOwnerInstruction=e.initializeImmutableOwnerInstructionData=void 0;const i=n(39386),o=n(18245),s=n(60913),a=n(47623);function u({programId:t,keys:[n],data:r}){const{instruction:i}=e.initializeImmutableOwnerInstructionData.decode(r);return{programId:t,keys:{account:n},data:{instruction:i}}}e.initializeImmutableOwnerInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createInitializeImmutableOwnerInstruction=function(t,n){const i=[{pubkey:t,isSigner:!1,isWritable:!0}],s=r.alloc(e.initializeImmutableOwnerInstructionData.span);return e.initializeImmutableOwnerInstructionData.encode({instruction:a.TokenInstruction.InitializeImmutableOwner},s),new o.TransactionInstruction({keys:i,programId:n,data:s})},e.decodeInitializeImmutableOwnerInstruction=function(t,n){if(!t.programId.equals(n))throw new s.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeImmutableOwnerInstructionData.span)throw new s.TokenInvalidInstructionDataError;const{keys:{account:r},data:i}=u(t);if(i.instruction!==a.TokenInstruction.InitializeImmutableOwner)throw new s.TokenInvalidInstructionTypeError;if(!r)throw new s.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r},data:i}},e.decodeInitializeImmutableOwnerInstructionUnchecked=u},74227:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeMintInstructionUnchecked=e.decodeInitializeMintInstruction=e.createInitializeMintInstruction=e.initializeMintInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n,r],data:i}){const{instruction:o,decimals:s,mintAuthority:a,freezeAuthorityOption:u,freezeAuthority:c}=e.initializeMintInstructionData.decode(i);return{programId:t,keys:{mint:n,rent:r},data:{instruction:o,decimals:s,mintAuthority:a,freezeAuthority:u?c:null}}}e.initializeMintInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("decimals"),(0,o.publicKey)("mintAuthority"),(0,i.u8)("freezeAuthorityOption"),(0,o.publicKey)("freezeAuthority")]),e.createInitializeMintInstruction=function(t,n,i,o,u=a.TOKEN_PROGRAM_ID){const d=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],l=r.alloc(e.initializeMintInstructionData.span);return e.initializeMintInstructionData.encode({instruction:c.TokenInstruction.InitializeMint,decimals:n,mintAuthority:i,freezeAuthorityOption:o?1:0,freezeAuthority:o||new s.PublicKey(0)},l),new s.TransactionInstruction({keys:d,programId:u,data:l})},e.decodeInitializeMintInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeMintInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,rent:i},data:o}=d(t);if(o.instruction!==c.TokenInstruction.InitializeMint)throw new u.TokenInvalidInstructionTypeError;if(!r||!i)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,rent:i},data:o}},e.decodeInitializeMintInstructionUnchecked=d},19066:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeMint2InstructionUnchecked=e.decodeInitializeMint2Instruction=e.createInitializeMint2Instruction=e.initializeMint2InstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n],data:r}){const{instruction:i,decimals:o,mintAuthority:s,freezeAuthorityOption:a,freezeAuthority:u}=e.initializeMint2InstructionData.decode(r);return{programId:t,keys:{mint:n},data:{instruction:i,decimals:o,mintAuthority:s,freezeAuthority:a?u:null}}}e.initializeMint2InstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("decimals"),(0,o.publicKey)("mintAuthority"),(0,i.u8)("freezeAuthorityOption"),(0,o.publicKey)("freezeAuthority")]),e.createInitializeMint2Instruction=function(t,n,i,o,u=a.TOKEN_PROGRAM_ID){const d=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.initializeMint2InstructionData.span);return e.initializeMint2InstructionData.encode({instruction:c.TokenInstruction.InitializeMint2,decimals:n,mintAuthority:i,freezeAuthorityOption:o?1:0,freezeAuthority:o||new s.PublicKey(0)},l),new s.TransactionInstruction({keys:d,programId:u,data:l})},e.decodeInitializeMint2Instruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeMint2InstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=d(t);if(i.instruction!==c.TokenInstruction.InitializeMint2)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeInitializeMint2InstructionUnchecked=d},36520:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeMintCloseAuthorityInstructionUnchecked=e.decodeInitializeMintCloseAuthorityInstruction=e.createInitializeMintCloseAuthorityInstruction=e.initializeMintCloseAuthorityInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n],data:r}){const{instruction:i,closeAuthorityOption:o,closeAuthority:s}=e.initializeMintCloseAuthorityInstructionData.decode(r);return{programId:t,keys:{mint:n},data:{instruction:i,closeAuthority:o?s:null}}}e.initializeMintCloseAuthorityInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("closeAuthorityOption"),(0,o.publicKey)("closeAuthority")]),e.createInitializeMintCloseAuthorityInstruction=function(t,n,i){if(!(0,a.programSupportsExtensions)(i))throw new u.TokenUnsupportedInstructionError;const o=[{pubkey:t,isSigner:!1,isWritable:!0}],d=r.alloc(e.initializeMintCloseAuthorityInstructionData.span);return e.initializeMintCloseAuthorityInstructionData.encode({instruction:c.TokenInstruction.InitializeMintCloseAuthority,closeAuthorityOption:n?1:0,closeAuthority:n||new s.PublicKey(0)},d),new s.TransactionInstruction({keys:o,programId:i,data:d})},e.decodeInitializeMintCloseAuthorityInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeMintCloseAuthorityInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=d(t);if(i.instruction!==c.TokenInstruction.InitializeMintCloseAuthority)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeInitializeMintCloseAuthorityInstructionUnchecked=d},65061:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeMultisigInstructionUnchecked=e.decodeInitializeMultisigInstruction=e.createInitializeMultisigInstruction=e.initializeMultisigInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);function c({programId:t,keys:[n,r,...i],data:o}){return{programId:t,keys:{account:n,rent:r,signers:i},data:e.initializeMultisigInstructionData.decode(o)}}e.initializeMultisigInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("m")]),e.createInitializeMultisigInstruction=function(t,n,i,a=s.TOKEN_PROGRAM_ID){const c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:o.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];for(const t of n)c.push({pubkey:t instanceof o.PublicKey?t:t.publicKey,isSigner:!1,isWritable:!1});const d=r.alloc(e.initializeMultisigInstructionData.span);return e.initializeMultisigInstructionData.encode({instruction:u.TokenInstruction.InitializeMultisig,m:i},d),new o.TransactionInstruction({keys:c,programId:a,data:d})},e.decodeInitializeMultisigInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeMultisigInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,rent:i,signers:o},data:d}=c(t);if(d.instruction!==u.TokenInstruction.InitializeMultisig)throw new a.TokenInvalidInstructionTypeError;if(!r||!i||!o.length)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,rent:i,signers:o},data:d}},e.decodeInitializeMultisigInstructionUnchecked=c},38817:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},66780:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createInitializeNonTransferableMintInstruction=e.initializeNonTransferableMintInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);e.initializeNonTransferableMintInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createInitializeNonTransferableMintInstruction=function(t,n){if(!(0,s.programSupportsExtensions)(n))throw new a.TokenUnsupportedInstructionError;const i=[{pubkey:t,isSigner:!1,isWritable:!0}],c=r.alloc(e.initializeNonTransferableMintInstructionData.span);return e.initializeNonTransferableMintInstructionData.encode({instruction:u.TokenInstruction.InitializeNonTransferableMint},c),new o.TransactionInstruction({keys:i,programId:n,data:c})}},68205:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializePermanentDelegateInstructionUnchecked=e.decodeInitializePermanentDelegateInstruction=e.createInitializePermanentDelegateInstruction=e.initializePermanentDelegateInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(18245),u=n(44530),c=n(60913),d=n(47623);function l({programId:t,keys:[n],data:r}){const{instruction:i,delegate:o}=e.initializePermanentDelegateInstructionData.decode(r);return{programId:t,keys:{mint:n},data:{instruction:i,delegate:o}}}e.initializePermanentDelegateInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.publicKey)("delegate")]),e.createInitializePermanentDelegateInstruction=function(t,n,i){if(!(0,u.programSupportsExtensions)(i))throw new c.TokenUnsupportedInstructionError;const o=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.initializePermanentDelegateInstructionData.span);return e.initializePermanentDelegateInstructionData.encode({instruction:d.TokenInstruction.InitializePermanentDelegate,delegate:n||new s.PublicKey(0)},l),new a.TransactionInstruction({keys:o,programId:i,data:l})},e.decodeInitializePermanentDelegateInstruction=function(t,n){if(!t.programId.equals(n))throw new c.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializePermanentDelegateInstructionData.span)throw new c.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=l(t);if(i.instruction!==d.TokenInstruction.InitializePermanentDelegate)throw new c.TokenInvalidInstructionTypeError;if(!r)throw new c.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeInitializePermanentDelegateInstructionUnchecked=l},59546:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.addSigners=void 0;const r=n(18245);e.addSigners=function(t,e,n){if(n.length){t.push({pubkey:e,isSigner:!1,isWritable:!1});for(const e of n)t.push({pubkey:e instanceof r.PublicKey?e:e.publicKey,isSigner:!0,isWritable:!1})}else t.push({pubkey:e,isSigner:!0,isWritable:!1});return t}},74761:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeMintToInstructionUnchecked=e.decodeMintToInstruction=e.createMintToInstruction=e.mintToInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{mint:n,destination:r,authority:i,multiSigners:o},data:e.mintToInstructionData.decode(s)}}e.mintToInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createMintToInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,u),f=r.alloc(e.mintToInstructionData.span);return e.mintToInstructionData.encode({instruction:d.TokenInstruction.MintTo,amount:BigInt(o)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeMintToInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.mintToInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,destination:i,authority:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.MintTo)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,destination:i,authority:o,multiSigners:s},data:c}},e.decodeMintToInstructionUnchecked=l},70698:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeMintToCheckedInstructionUnchecked=e.decodeMintToCheckedInstruction=e.createMintToCheckedInstruction=e.mintToCheckedInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{mint:n,destination:r,authority:i,multiSigners:o},data:e.mintToCheckedInstructionData.decode(s)}}e.mintToCheckedInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount"),(0,i.u8)("decimals")]),e.createMintToCheckedInstruction=function(t,n,i,o,u,l=[],h=a.TOKEN_PROGRAM_ID){const f=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,l),p=r.alloc(e.mintToCheckedInstructionData.span);return e.mintToCheckedInstructionData.encode({instruction:d.TokenInstruction.MintToChecked,amount:BigInt(o),decimals:u},p),new s.TransactionInstruction({keys:f,programId:h,data:p})},e.decodeMintToCheckedInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.mintToCheckedInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,destination:i,authority:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.MintToChecked)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,destination:i,authority:o,multiSigners:s},data:c}},e.decodeMintToCheckedInstructionUnchecked=l},93537:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createReallocateInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);e.createReallocateInstruction=function(t,e,n,d,l=[],h=s.TOKEN_2022_PROGRAM_ID){if(!(0,s.programSupportsExtensions)(h))throw new a.TokenUnsupportedInstructionError;const f=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:o.SystemProgram.programId,isSigner:!1,isWritable:!1}],p=(0,u.addSigners)(f,d,l),m=(0,i.struct)([(0,i.u8)("instruction"),(0,i.seq)((0,i.u16)(),n.length,"extensionTypes")]),g=r.alloc(m.span);return m.encode({instruction:c.TokenInstruction.Reallocate,extensionTypes:n},g),new o.TransactionInstruction({keys:p,programId:h,data:g})}},62216:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeRevokeInstructionUnchecked=e.decodeRevokeInstruction=e.createRevokeInstruction=e.revokeInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);function d({programId:t,keys:[n,r,...i],data:o}){return{programId:t,keys:{account:n,owner:r,multiSigners:i},data:e.revokeInstructionData.decode(o)}}e.revokeInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createRevokeInstruction=function(t,n,i=[],a=s.TOKEN_PROGRAM_ID){const d=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],n,i),l=r.alloc(e.revokeInstructionData.span);return e.revokeInstructionData.encode({instruction:c.TokenInstruction.Revoke},l),new o.TransactionInstruction({keys:d,programId:a,data:l})},e.decodeRevokeInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.revokeInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,owner:i,multiSigners:o},data:u}=d(t);if(u.instruction!==c.TokenInstruction.Revoke)throw new a.TokenInvalidInstructionTypeError;if(!r||!i)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,owner:i,multiSigners:o},data:u}},e.decodeRevokeInstructionUnchecked=d},95816:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSetAuthorityInstructionUnchecked=e.decodeSetAuthorityInstruction=e.createSetAuthorityInstruction=e.setAuthorityInstructionData=e.AuthorityType=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);var l;function h({programId:t,keys:[n,r,...i],data:o}){const{instruction:s,authorityType:a,newAuthorityOption:u,newAuthority:c}=e.setAuthorityInstructionData.decode(o);return{programId:t,keys:{account:n,currentAuthority:r,multiSigners:i},data:{instruction:s,authorityType:a,newAuthority:u?c:null}}}!function(t){t[t.MintTokens=0]="MintTokens",t[t.FreezeAccount=1]="FreezeAccount",t[t.AccountOwner=2]="AccountOwner",t[t.CloseAccount=3]="CloseAccount",t[t.TransferFeeConfig=4]="TransferFeeConfig",t[t.WithheldWithdraw=5]="WithheldWithdraw",t[t.CloseMint=6]="CloseMint",t[t.InterestRate=7]="InterestRate",t[t.PermanentDelegate=8]="PermanentDelegate",t[t.ConfidentialTransferMint=9]="ConfidentialTransferMint",t[t.TransferHookProgramId=10]="TransferHookProgramId",t[t.ConfidentialTransferFeeConfig=11]="ConfidentialTransferFeeConfig",t[t.MetadataPointer=12]="MetadataPointer"}(l||(e.AuthorityType=l={})),e.setAuthorityInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("authorityType"),(0,i.u8)("newAuthorityOption"),(0,o.publicKey)("newAuthority")]),e.createSetAuthorityInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],n,u),f=r.alloc(e.setAuthorityInstructionData.span);return e.setAuthorityInstructionData.encode({instruction:d.TokenInstruction.SetAuthority,authorityType:i,newAuthorityOption:o?1:0,newAuthority:o||new s.PublicKey(0)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeSetAuthorityInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.setAuthorityInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,currentAuthority:i,multiSigners:o},data:s}=h(t);if(s.instruction!==d.TokenInstruction.SetAuthority)throw new u.TokenInvalidInstructionTypeError;if(!r||!i)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,currentAuthority:i,multiSigners:o},data:s}},e.decodeSetAuthorityInstructionUnchecked=h},75836:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSyncNativeInstructionUnchecked=e.decodeSyncNativeInstruction=e.createSyncNativeInstruction=e.syncNativeInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);function c({programId:t,keys:[n],data:r}){return{programId:t,keys:{account:n},data:e.syncNativeInstructionData.decode(r)}}e.syncNativeInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createSyncNativeInstruction=function(t,n=s.TOKEN_PROGRAM_ID){const i=[{pubkey:t,isSigner:!1,isWritable:!0}],a=r.alloc(e.syncNativeInstructionData.span);return e.syncNativeInstructionData.encode({instruction:u.TokenInstruction.SyncNative},a),new o.TransactionInstruction({keys:i,programId:n,data:a})},e.decodeSyncNativeInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.syncNativeInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r},data:i}=c(t);if(i.instruction!==u.TokenInstruction.SyncNative)throw new a.TokenInvalidInstructionTypeError;if(!r)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r},data:i}},e.decodeSyncNativeInstructionUnchecked=c},19040:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeThawAccountInstructionUnchecked=e.decodeThawAccountInstruction=e.createThawAccountInstruction=e.thawAccountInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);function d({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,mint:r,authority:i,multiSigners:o},data:e.thawAccountInstructionData.decode(s)}}e.thawAccountInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createThawAccountInstruction=function(t,n,i,a=[],d=s.TOKEN_PROGRAM_ID){const l=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],i,a),h=r.alloc(e.thawAccountInstructionData.span);return e.thawAccountInstructionData.encode({instruction:c.TokenInstruction.ThawAccount},h),new o.TransactionInstruction({keys:l,programId:d,data:h})},e.decodeThawAccountInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.thawAccountInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,authority:o,multiSigners:u},data:l}=d(t);if(l.instruction!==c.TokenInstruction.ThawAccount)throw new a.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,authority:o,multiSigners:u},data:l}},e.decodeThawAccountInstructionUnchecked=d},72874:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeTransferInstructionUnchecked=e.decodeTransferInstruction=e.createTransferInstruction=e.transferInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{source:n,destination:r,owner:i,multiSigners:o},data:e.transferInstructionData.decode(s)}}e.transferInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createTransferInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,u),f=r.alloc(e.transferInstructionData.span);return e.transferInstructionData.encode({instruction:d.TokenInstruction.Transfer,amount:BigInt(o)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeTransferInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.transferInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{source:r,destination:i,owner:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.Transfer)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{source:r,destination:i,owner:o,multiSigners:s},data:c}},e.decodeTransferInstructionUnchecked=l},35593:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeTransferCheckedInstructionUnchecked=e.decodeTransferCheckedInstruction=e.createTransferCheckedInstruction=e.transferCheckedInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,o,...s],data:a}){return{programId:t,keys:{source:n,mint:r,destination:i,owner:o,multiSigners:s},data:e.transferCheckedInstructionData.decode(a)}}e.transferCheckedInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount"),(0,i.u8)("decimals")]),e.createTransferCheckedInstruction=function(t,n,i,o,u,l,h=[],f=a.TOKEN_PROGRAM_ID){const p=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!0}],o,h),m=r.alloc(e.transferCheckedInstructionData.span);return e.transferCheckedInstructionData.encode({instruction:d.TokenInstruction.TransferChecked,amount:BigInt(u),decimals:l},m),new s.TransactionInstruction({keys:p,programId:f,data:m})},e.decodeTransferCheckedInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.transferCheckedInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{source:r,mint:i,destination:o,owner:s,multiSigners:c},data:h}=l(t);if(h.instruction!==d.TokenInstruction.TransferChecked)throw new u.TokenInvalidInstructionTypeError;if(!(r&&i&&o&&s))throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{source:r,mint:i,destination:o,owner:s,multiSigners:c},data:h}},e.decodeTransferCheckedInstructionUnchecked=l},47623:(t,e)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenInstruction=void 0,function(t){t[t.InitializeMint=0]="InitializeMint",t[t.InitializeAccount=1]="InitializeAccount",t[t.InitializeMultisig=2]="InitializeMultisig",t[t.Transfer=3]="Transfer",t[t.Approve=4]="Approve",t[t.Revoke=5]="Revoke",t[t.SetAuthority=6]="SetAuthority",t[t.MintTo=7]="MintTo",t[t.Burn=8]="Burn",t[t.CloseAccount=9]="CloseAccount",t[t.FreezeAccount=10]="FreezeAccount",t[t.ThawAccount=11]="ThawAccount",t[t.TransferChecked=12]="TransferChecked",t[t.ApproveChecked=13]="ApproveChecked",t[t.MintToChecked=14]="MintToChecked",t[t.BurnChecked=15]="BurnChecked",t[t.InitializeAccount2=16]="InitializeAccount2",t[t.SyncNative=17]="SyncNative",t[t.InitializeAccount3=18]="InitializeAccount3",t[t.InitializeMultisig2=19]="InitializeMultisig2",t[t.InitializeMint2=20]="InitializeMint2",t[t.GetAccountDataSize=21]="GetAccountDataSize",t[t.InitializeImmutableOwner=22]="InitializeImmutableOwner",t[t.AmountToUiAmount=23]="AmountToUiAmount",t[t.UiAmountToAmount=24]="UiAmountToAmount",t[t.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",t[t.TransferFeeExtension=26]="TransferFeeExtension",t[t.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",t[t.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",t[t.Reallocate=29]="Reallocate",t[t.MemoTransferExtension=30]="MemoTransferExtension",t[t.CreateNativeMint=31]="CreateNativeMint",t[t.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",t[t.InterestBearingMintExtension=33]="InterestBearingMintExtension",t[t.CpiGuardExtension=34]="CpiGuardExtension",t[t.InitializePermanentDelegate=35]="InitializePermanentDelegate",t[t.TransferHookExtension=36]="TransferHookExtension",t[t.MetadataPointerExtension=39]="MetadataPointerExtension"}(n||(e.TokenInstruction=n={}))},21470:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeUiAmountToAmountInstructionUnchecked=e.decodeUiAmountToAmountInstruction=e.createUiAmountToAmountInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);function c({programId:t,keys:[e],data:n}){return{programId:t,keys:{mint:e},data:(0,i.struct)([(0,i.u8)("instruction"),(0,i.blob)(n.length-1,"amount")]).decode(n)}}e.createUiAmountToAmountInstruction=function(t,e,n=s.TOKEN_PROGRAM_ID){const a=[{pubkey:t,isSigner:!1,isWritable:!1}],c=r.from(e,"utf8"),d=(0,i.struct)([(0,i.u8)("instruction"),(0,i.blob)(c.length,"amount")]),l=r.alloc(d.span);return d.encode({instruction:u.TokenInstruction.UiAmountToAmount,amount:c},l),new o.TransactionInstruction({keys:a,programId:n,data:l})},e.decodeUiAmountToAmountInstruction=function(t,e=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(e))throw new a.TokenInvalidInstructionProgramError;const n=(0,i.struct)([(0,i.u8)("instruction"),(0,i.blob)(t.data.length-1,"amount")]);if(t.data.length!==n.span)throw new a.TokenInvalidInstructionDataError;const{keys:{mint:r},data:o}=c(t);if(o.instruction!==u.TokenInstruction.UiAmountToAmount)throw new a.TokenInvalidInstructionTypeError;if(!r)throw new a.TokenInvalidInstructionKeysError;return{programId:e,keys:{mint:r},data:o}},e.decodeUiAmountToAmountInstructionUnchecked=c},48820:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.unpackAccount=e.getMinimumBalanceForRentExemptAccountWithExtensions=e.getMinimumBalanceForRentExemptAccount=e.getMultipleAccounts=e.getAccount=e.ACCOUNT_SIZE=e.AccountLayout=e.AccountState=void 0;const o=n(39386),s=n(27278),a=n(44530),u=n(60913),c=n(21026),d=n(90758),l=n(22114);var h;function f(t,e,n){return i(this,void 0,void 0,(function*(){const r=(0,d.getAccountLen)(e);return yield t.getMinimumBalanceForRentExemption(r,n)}))}function p(t,n,i=a.TOKEN_PROGRAM_ID){if(!n)throw new u.TokenAccountNotFoundError;if(!n.owner.equals(i))throw new u.TokenInvalidAccountOwnerError;if(n.data.lengthe.ACCOUNT_SIZE){if(n.data.length===l.MULTISIG_SIZE)throw new u.TokenInvalidAccountSizeError;if(n.data[e.ACCOUNT_SIZE]!=c.AccountType.Account)throw new u.TokenInvalidAccountError;s=n.data.slice(e.ACCOUNT_SIZE+c.ACCOUNT_TYPE_SIZE)}return{address:t,mint:o.mint,owner:o.owner,amount:o.amount,delegate:o.delegateOption?o.delegate:null,delegatedAmount:o.delegatedAmount,isInitialized:o.state!==h.Uninitialized,isFrozen:o.state===h.Frozen,isNative:!!o.isNativeOption,rentExemptReserve:o.isNativeOption?o.isNative:null,closeAuthority:o.closeAuthorityOption?o.closeAuthority:null,tlvData:s}}!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(h||(e.AccountState=h={})),e.AccountLayout=(0,o.struct)([(0,s.publicKey)("mint"),(0,s.publicKey)("owner"),(0,s.u64)("amount"),(0,o.u32)("delegateOption"),(0,s.publicKey)("delegate"),(0,o.u8)("state"),(0,o.u32)("isNativeOption"),(0,s.u64)("isNative"),(0,s.u64)("delegatedAmount"),(0,o.u32)("closeAuthorityOption"),(0,s.publicKey)("closeAuthority")]),e.ACCOUNT_SIZE=e.AccountLayout.span,e.getAccount=function(t,e,n,r=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=yield t.getAccountInfo(e,n);return p(e,i,r)}))},e.getMultipleAccounts=function(t,e,n,r=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=yield t.getMultipleAccountsInfo(e,n);return e.map(((t,e)=>p(t,i[e],r)))}))},e.getMinimumBalanceForRentExemptAccount=function(t,e){return i(this,void 0,void 0,(function*(){return yield f(t,[],e)}))},e.getMinimumBalanceForRentExemptAccountWithExtensions=f,e.unpackAccount=p},40982:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(48820),e),i(n(66446),e),i(n(22114),e)},66446:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getAssociatedTokenAddressSync=e.getAssociatedTokenAddress=e.getMinimumBalanceForRentExemptMintWithExtensions=e.getMinimumBalanceForRentExemptMint=e.unpackMint=e.getMint=e.MINT_SIZE=e.MintLayout=void 0;const o=n(39386),s=n(27278),a=n(18245),u=n(44530),c=n(60913),d=n(21026),l=n(90758),h=n(48820),f=n(22114);function p(t,n,i=u.TOKEN_PROGRAM_ID){if(!n)throw new c.TokenAccountNotFoundError;if(!n.owner.equals(i))throw new c.TokenInvalidAccountOwnerError;if(n.data.lengthe.MINT_SIZE){if(n.data.length<=h.ACCOUNT_SIZE)throw new c.TokenInvalidAccountSizeError;if(n.data.length===f.MULTISIG_SIZE)throw new c.TokenInvalidAccountSizeError;if(n.data[h.ACCOUNT_SIZE]!=d.AccountType.Mint)throw new c.TokenInvalidMintError;s=n.data.slice(h.ACCOUNT_SIZE+d.ACCOUNT_TYPE_SIZE)}return{address:t,mintAuthority:o.mintAuthorityOption?o.mintAuthority:null,supply:o.supply,decimals:o.decimals,isInitialized:o.isInitialized,freezeAuthority:o.freezeAuthorityOption?o.freezeAuthority:null,tlvData:s}}function m(t,e,n){return i(this,void 0,void 0,(function*(){const r=(0,l.getMintLen)(e);return yield t.getMinimumBalanceForRentExemption(r,n)}))}e.MintLayout=(0,o.struct)([(0,o.u32)("mintAuthorityOption"),(0,s.publicKey)("mintAuthority"),(0,s.u64)("supply"),(0,o.u8)("decimals"),(0,s.bool)("isInitialized"),(0,o.u32)("freezeAuthorityOption"),(0,s.publicKey)("freezeAuthority")]),e.MINT_SIZE=e.MintLayout.span,e.getMint=function(t,e,n,r=u.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=yield t.getAccountInfo(e,n);return p(e,i,r)}))},e.unpackMint=p,e.getMinimumBalanceForRentExemptMint=function(t,e){return i(this,void 0,void 0,(function*(){return yield m(t,[],e)}))},e.getMinimumBalanceForRentExemptMintWithExtensions=m,e.getAssociatedTokenAddress=function(t,e,n=!1,r=u.TOKEN_PROGRAM_ID,o=u.ASSOCIATED_TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){if(!n&&!a.PublicKey.isOnCurve(e.toBuffer()))throw new c.TokenOwnerOffCurveError;const[i]=yield a.PublicKey.findProgramAddress([e.toBuffer(),r.toBuffer(),t.toBuffer()],o);return i}))},e.getAssociatedTokenAddressSync=function(t,e,n=!1,r=u.TOKEN_PROGRAM_ID,i=u.ASSOCIATED_TOKEN_PROGRAM_ID){if(!n&&!a.PublicKey.isOnCurve(e.toBuffer()))throw new c.TokenOwnerOffCurveError;const[o]=a.PublicKey.findProgramAddressSync([e.toBuffer(),r.toBuffer(),t.toBuffer()],i);return o}},22114:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getMinimumBalanceForRentExemptMultisig=e.unpackMultisig=e.getMultisig=e.MULTISIG_SIZE=e.MultisigLayout=void 0;const i=n(39386),o=n(27278),s=n(44530),a=n(60913);function u(t,n,r=s.TOKEN_PROGRAM_ID){if(!n)throw new a.TokenAccountNotFoundError;if(!n.owner.equals(r))throw new a.TokenInvalidAccountOwnerError;if(n.data.length!=e.MULTISIG_SIZE)throw new a.TokenInvalidAccountSizeError;const i=e.MultisigLayout.decode(n.data);return Object.assign({address:t},i)}e.MultisigLayout=(0,i.struct)([(0,i.u8)("m"),(0,i.u8)("n"),(0,o.bool)("isInitialized"),(0,o.publicKey)("signer1"),(0,o.publicKey)("signer2"),(0,o.publicKey)("signer3"),(0,o.publicKey)("signer4"),(0,o.publicKey)("signer5"),(0,o.publicKey)("signer6"),(0,o.publicKey)("signer7"),(0,o.publicKey)("signer8"),(0,o.publicKey)("signer9"),(0,o.publicKey)("signer10"),(0,o.publicKey)("signer11")]),e.MULTISIG_SIZE=e.MultisigLayout.span,e.getMultisig=function(t,e,n,i=s.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=yield t.getAccountInfo(e,n);return u(e,r,i)}))},e.unpackMultisig=u,e.getMinimumBalanceForRentExemptMultisig=function(t,n){return r(this,void 0,void 0,(function*(){return yield t.getMinimumBalanceForRentExemption(e.MULTISIG_SIZE,n)}))}},94297:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TlvInvalidAccountDataError=e.TlvError=void 0;class n extends Error{constructor(t){super(t)}}e.TlvError=n,e.TlvInvalidAccountDataError=class extends n{constructor(){super(...arguments),this.name="TlvInvalidAccountDataError"}}},1431:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(64545),e),i(n(67985),e),i(n(94297),e)},64545:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.splDiscriminate=void 0;const r=n(55835);e.splDiscriminate=(t,e=8)=>(0,r.createHash)("sha256").update(t).digest().subarray(0,e)},67985:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TlvState=void 0;const r=n(94297);e.TlvState=class{constructor(t,e=2,n=2,r=0){this.tlvData=t.subarray(r),this.discriminatorSize=e,this.lengthSize=n}get data(){return this.tlvData}readEntryLength(t,e,n){switch(t){case 1:return n(this.tlvData.readUInt8(e));case 2:return n(this.tlvData.readUInt16LE(e));case 4:return n(this.tlvData.readUInt32LE(e));case 8:return n(this.tlvData.readBigUInt64LE(e))}}firstBytes(t){const e=this.bytesRepeating(t,1);return e.length>0?e[0]:null}bytesRepeating(t,e=0){const n=[];let i=0;for(;ithis.tlvData.length)throw new r.TlvInvalidAccountDataError;const o=this.tlvData.subarray(i,i+this.discriminatorSize);i+=this.discriminatorSize;const s=this.readEntryLength(this.lengthSize,i,Number);if(i+=this.lengthSize,i+s>this.tlvData.length)throw new r.TlvInvalidAccountDataError;if(o.equals(t)&&n.push(this.tlvData.subarray(i,i+s)),e>0&&n.length>=e)break;i+=s}return n}discriminators(){const t=[];let e=0;for(;ethis.tlvData.length)throw new r.TlvInvalidAccountDataError;const n=this.tlvData.subarray(e,e+this.discriminatorSize);t.push(n),e+=this.discriminatorSize;const i=this.readEntryLength(this.lengthSize,e,Number);if(e+=this.lengthSize,e+i>this.tlvData.length)throw new r.TlvInvalidAccountDataError;e+=i}return t}}},64572:(t,e,n)=>{"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e,n){return i=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e),(e="symbol"==r(i)?i:String(i))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t;var i}n.d(e,{Z:()=>i})},93527:(t,e,n)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function i(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Uint8Array expected");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function o(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)}function s(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function a(t,e){i(t);const n=e.outputLen;if(t.lengths,J8:()=>a,Rx:()=>r,aI:()=>i,vp:()=>o})},4359:(t,e,n)=>{"use strict";n.d(e,{VR:()=>a,bc:()=>o,l3:()=>s});var r=n(93527),i=n(23486);const o=(t,e,n)=>t&e^~t&n,s=(t,e,n)=>t&e^t&n^e&n;class a extends i.kb{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.GL)(this.buffer)}update(t){(0,r.Gg)(this);const{view:e,buffer:n,blockLen:o}=this,s=(t=(0,i.O0)(t)).length;for(let r=0;ro-a&&(this.process(n,0),a=0);for(let t=a;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,o-8,BigInt(8*this.length),s),this.process(n,0);const u=(0,i.GL)(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,l=this.get();if(d>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t{"use strict";n.d(e,{J:()=>c});var r=n(4359),i=n(23486);const o=new Uint32Array([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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class u extends r.VR{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)a[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=a[t-15],n=a[t-2],r=(0,i.np)(e,7)^(0,i.np)(e,18)^e>>>3,o=(0,i.np)(n,17)^(0,i.np)(n,19)^n>>>10;a[t]=o+a[t-7]+r+a[t-16]|0}let{A:n,B:s,C:u,D:c,E:d,F:l,G:h,H:f}=this;for(let t=0;t<64;t++){const e=f+((0,i.np)(d,6)^(0,i.np)(d,11)^(0,i.np)(d,25))+(0,r.bc)(d,l,h)+o[t]+a[t]|0,p=((0,i.np)(n,2)^(0,i.np)(n,13)^(0,i.np)(n,22))+(0,r.l3)(n,s,u)|0;f=h,h=l,l=d,d=c+e|0,c=u,u=s,s=n,n=e+p|0}n=n+this.A|0,s=s+this.B|0,u=u+this.C|0,c=c+this.D|0,d=d+this.E|0,l=l+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(n,s,u,c,d,l,h,f)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const c=(0,i.hE)((()=>new u))},23486:(t,e,n)=>{"use strict";n.d(e,{kb:()=>p,l1:()=>d,eV:()=>f,GL:()=>s,iA:()=>u,O6:()=>g,np:()=>a,O0:()=>h,Jq:()=>o,iY:()=>l,hE:()=>m});const r="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;var i=n(93527);const o=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),s=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),a=(t,e)=>t<<32-e|t>>>e,u=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],c=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function d(t){for(let e=0;et().update(h(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function g(t=32){if(r&&"function"==typeof r.getRandomValues)return r.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}},53471:(t,e,n)=>{"use strict";n.d(e,{AG:()=>_,G0:()=>x,IM:()=>M,IX:()=>g,O7:()=>y,Rx:()=>v,Ue:()=>l,Yj:()=>m,Z_:()=>A,_4:()=>E,bc:()=>S,dt:()=>I,eE:()=>b,hu:()=>d,i0:()=>w,jt:()=>k,oQ:()=>T});class r extends TypeError{constructor(t,e){let n;const{message:r,...i}=t,{path:o}=t;super(0===o.length?r:"At path: "+o.join(".")+" -- "+r),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[t,...e()]}}}function i(t){return"object"==typeof t&&null!=t}function o(t){return"string"==typeof t?JSON.stringify(t):""+t}function s(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:s}=e,{type:a}=n,{refinement:u,message:c="Expected a value of type `"+a+"`"+(u?" with refinement `"+u+"`":"")+", but received: `"+o(r)+"`"}=t;return{value:r,type:a,refinement:u,key:i[i.length-1],path:i,branch:s,...t,message:c}}function*a(t,e,n,r){var o;i(o=t)&&"function"==typeof o[Symbol.iterator]||(t=[t]);for(const i of t){const t=s(i,e,n,r);t&&(yield t)}}function*u(t,e,n={}){const{path:r=[],branch:o=[t],coerce:s=!1,mask:a=!1}=n,c={path:r,branch:o};if(s&&(t=e.coercer(t,c),a&&"type"!==e.type&&i(e.schema)&&i(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let d=!0;for(const n of e.validator(t,c))d=!1,yield[n,void 0];for(let[n,l,h]of e.entries(t,c)){const e=u(l,h,{path:void 0===n?r:[...r,n],branch:void 0===n?o:[...o,l],coerce:s,mask:a});for(const r of e)r[0]?(d=!1,yield[r[0],void 0]):s&&(l=r[1],void 0===n?t=l:t instanceof Map?t.set(n,l):t instanceof Set?t.add(l):i(t)&&(t[n]=l))}if(d)for(const n of e.refiner(t,c))d=!1,yield[n,void 0];d&&(yield[void 0,t])}class c{constructor(t){const{type:e,schema:n,validator:r,refiner:i,coercer:o=(t=>t),entries:s=function*(){}}=t;this.type=e,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(t,e)=>a(r(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>a(i(t,e),e,this,t):()=>[]}assert(t){return d(t,this)}create(t){return l(t,this)}is(t){return h(t,this)}mask(t){return function(t,e){const n=f(t,e,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(t,this)}validate(t,e={}){return f(t,this,e)}}function d(t,e){const n=f(t,e);if(n[0])throw n[0]}function l(t,e){const n=f(t,e,{coerce:!0});if(n[0])throw n[0];return n[1]}function h(t,e){return!f(t,e)[0]}function f(t,e,n={}){const i=u(t,e,n),o=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(i);return o[0]?[new r(o[0],(function*(){for(const t of i)t[0]&&(yield t[0])})),void 0]:[void 0,o[1]]}function p(t,e){return new c({type:t,schema:null,validator:e})}function m(){return p("any",(()=>!0))}function g(t){return new c({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+o(t)})}function y(){return p("boolean",(t=>"boolean"==typeof t))}function b(t){return p("instance",(e=>e instanceof t||"Expected a `"+t.name+"` instance, but received: "+o(e)))}function w(t){const e=o(t),n=typeof t;return new c({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||"Expected the literal `"+e+"`, but received: "+o(n)})}function _(t){return new c({...t,validator:(e,n)=>null===e||t.validator(e,n),refiner:(e,n)=>null===e||t.refiner(e,n)})}function v(){return p("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+o(t)))}function k(t){return new c({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function M(t,e){return new c({type:"record",schema:null,*entries(n){if(i(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:t=>i(t)||"Expected an object, but received: "+o(t)})}function A(){return p("string",(t=>"string"==typeof t||"Expected a string, but received: "+o(t)))}function S(t){const e=p("never",(()=>!1));return new c({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(t.length,n.length);for(let i=0;iArray.isArray(t)||"Expected an array, but received: "+o(t)})}function I(t){const e=Object.keys(t);return new c({type:"type",schema:t,*entries(n){if(i(n))for(const r of e)yield[r,n[r],t[r]]},validator:t=>i(t)||"Expected an object, but received: "+o(t)})}function x(t){const e=t.map((t=>t.type)).join(" | ");return new c({type:"union",schema:null,validator(n,r){const i=[];for(const e of t){const[...t]=u(n,e,r),[o]=t;if(!o[0])return[];for(const[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+o(n),...i]}})}function E(){return p("unknown",(()=>!0))}function T(t,e,n){return new c({...t,coercer:(r,i)=>h(r,e)?t.coercer(n(r,i),i):t.coercer(r,i)})}},21127:(t,e,n)=>{"use strict";function r(t,e,n){return e<=t&&t<=n}function i(t){if(void 0===t)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}function o(t){this.tokens=[].slice.call(t)}n.r(e),n.d(e,{TextDecoder:()=>c,TextEncoder:()=>d}),o.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.push(e.shift());else this.tokens.push(t)}};var s=-1;function a(t,e){if(t)throw TypeError("Decoder error");return e||65533}var u="utf-8";function c(t,e){if(!(this instanceof c))return new c(t,e);if((t=void 0!==t?String(t).toLowerCase():u)!==u)throw new Error("Encoding not supported. Only utf-8 is supported");e=i(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(e.fatal),this._ignoreBOM=Boolean(e.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function d(t,e){if(!(this instanceof d))return new d(t,e);if((t=void 0!==t?String(t).toLowerCase():u)!==u)throw new Error("Encoding not supported. Only utf-8 is supported");e=i(e),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function l(t){var e=t.fatal,n=0,i=0,o=0,u=128,c=191;this.handler=function(t,d){if(-1===d&&0!==o)return o=0,a(e);if(-1===d)return s;if(0===o){if(r(d,0,127))return d;if(r(d,194,223))o=1,n=d-192;else if(r(d,224,239))224===d&&(u=160),237===d&&(c=159),o=2,n=d-224;else{if(!r(d,240,244))return a(e);240===d&&(u=144),244===d&&(c=143),o=3,n=d-240}return n<<=6*o,null}if(!r(d,u,c))return n=o=i=0,u=128,c=191,t.prepend(d),a(e);if(u=128,c=191,n+=d-128<<6*(o-(i+=1)),i!==o)return null;var l=n;return n=o=i=0,l}}function h(t){t.fatal,this.handler=function(t,e){if(-1===e)return s;if(r(e,0,127))return e;var n,i;r(e,128,2047)?(n=1,i=192):r(e,2048,65535)?(n=2,i=224):r(e,65536,1114111)&&(n=3,i=240);for(var o=[(e>>6*n)+i];n>0;){var a=e>>6*(n-1);o.push(128|63&a),n-=1}return o}}c.prototype={decode:function(t,e){var n;n="object"==typeof t&&t instanceof ArrayBuffer?new Uint8Array(t):"object"==typeof t&&"buffer"in t&&t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e=i(e),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var r,a=new o(n),u=[];!a.endOfStream()&&(r=this._decoder.handler(a,a.read()))!==s;)null!==r&&(Array.isArray(r)?u.push.apply(u,r):u.push(r));if(!this._streaming){do{if((r=this._decoder.handler(a,a.read()))===s)break;null!==r&&(Array.isArray(r)?u.push.apply(u,r):u.push(r))}while(!a.endOfStream());this._decoder=null}return u.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===u[0]?(this._BOMseen=!0,u.shift()):this._BOMseen=!0)),function(t){for(var e="",n=0;n>10),56320+(1023&r)))}return e}(u)}},d.prototype={encode:function(t,e){t=t?String(t):"",e=i(e),this._streaming||(this._encoder=new h(this._options)),this._streaming=Boolean(e.stream);for(var n,r=[],a=new o(function(t){for(var e=String(t),n=e.length,r=0,i=[];r57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(r===n-1)i.push(65533);else{var s=t.charCodeAt(r+1);if(56320<=s&&s<=57343){var a=1023&o,u=1023&s;i.push(65536+(a<<10)+u),r+=1}else i.push(65533)}r+=1}return i}(t));!a.endOfStream()&&(n=this._encoder.handler(a,a.read()))!==s;)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;(n=this._encoder.handler(a,a.read()))!==s;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}}},92220:t=>{"use strict";t.exports=JSON.parse('{"version":"0.2.0","name":"whirlpool","instructions":[{"name":"initializeConfig","docs":["Initializes a WhirlpoolsConfig account that hosts info & authorities","required to govern a set of Whirlpools.","","### Parameters","- `fee_authority` - Authority authorized to initialize fee-tiers and set customs fees.","- `collect_protocol_fees_authority` - Authority authorized to collect protocol fees.","- `reward_emissions_super_authority` - Authority authorized to set reward authorities in pools."],"accounts":[{"name":"config","isMut":true,"isSigner":true},{"name":"funder","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[{"name":"feeAuthority","type":"publicKey"},{"name":"collectProtocolFeesAuthority","type":"publicKey"},{"name":"rewardEmissionsSuperAuthority","type":"publicKey"},{"name":"defaultProtocolFeeRate","type":"u16"}]},{"name":"initializePool","docs":["Initializes a Whirlpool account.","Fee rate is set to the default values on the config and supplied fee_tier.","","### Parameters","- `bumps` - The bump value when deriving the PDA of the Whirlpool address.","- `tick_spacing` - The desired tick spacing for this pool.","- `initial_sqrt_price` - The desired initial sqrt-price for this pool","","#### Special Errors","`InvalidTokenMintOrder` - The order of mints have to be ordered by","`SqrtPriceOutOfBounds` - provided initial_sqrt_price is not between 2^-64 to 2^64",""],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":true},{"name":"tokenVaultB","isMut":true,"isSigner":true},{"name":"feeTier","isMut":false,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"bumps","type":{"defined":"WhirlpoolBumps"}},{"name":"tickSpacing","type":"u16"},{"name":"initialSqrtPrice","type":"u128"}]},{"name":"initializeTickArray","docs":["Initializes a tick_array account to represent a tick-range in a Whirlpool.","","### Parameters","- `start_tick_index` - The starting tick index for this tick-array.","Has to be a multiple of TickArray size & the tick spacing of this pool.","","#### Special Errors","- `InvalidStartTick` - if the provided start tick is out of bounds or is not a multiple of","TICK_ARRAY_SIZE * tick spacing."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"tickArray","isMut":true,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[{"name":"startTickIndex","type":"i32"}]},{"name":"initializeFeeTier","docs":["Initializes a fee_tier account usable by Whirlpools in a WhirlpoolConfig space.","","### Authority","- \\"fee_authority\\" - Set authority in the WhirlpoolConfig","","### Parameters","- `tick_spacing` - The tick-spacing that this fee-tier suggests the default_fee_rate for.","- `default_fee_rate` - The default fee rate that a pool will use if the pool uses this","fee tier during initialization.","","#### Special Errors","- `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds MAX_FEE_RATE."],"accounts":[{"name":"config","isMut":false,"isSigner":false},{"name":"feeTier","isMut":true,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"feeAuthority","isMut":false,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[{"name":"tickSpacing","type":"u16"},{"name":"defaultFeeRate","type":"u16"}]},{"name":"initializeReward","docs":["Initialize reward for a Whirlpool. A pool can only support up to a set number of rewards.","","### Authority","- \\"reward_authority\\" - assigned authority by the reward_super_authority for the specified","reward-index in this Whirlpool","","### Parameters","- `reward_index` - The reward index that we\'d like to initialize. (0 <= index <= NUM_REWARDS)","","#### Special Errors","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"funder","isMut":true,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardMint","isMut":false,"isSigner":false},{"name":"rewardVault","isMut":true,"isSigner":true},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"setRewardEmissions","docs":["Set the reward emissions for a reward in a Whirlpool.","","### Authority","- \\"reward_authority\\" - assigned authority by the reward_super_authority for the specified","reward-index in this Whirlpool","","### Parameters","- `reward_index` - The reward index (0 <= index <= NUM_REWARDS) that we\'d like to modify.","- `emissions_per_second_x64` - The amount of rewards emitted in this pool.","","#### Special Errors","- `RewardVaultAmountInsufficient` - The amount of rewards in the reward vault cannot emit","more than a day of desired emissions.","- `InvalidTimestamp` - Provided timestamp is not in order with the previous timestamp.","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"rewardVault","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"},{"name":"emissionsPerSecondX64","type":"u128"}]},{"name":"openPosition","docs":["Open a position in a Whirlpool. A unique token will be minted to represent the position","in the users wallet. The position will start off with 0 liquidity.","","### Parameters","- `tick_lower_index` - The tick specifying the lower end of the position range.","- `tick_upper_index` - The tick specifying the upper end of the position range.","","#### Special Errors","- `InvalidTickIndex` - If a provided tick is out of bounds, out of order or not a multiple of","the tick-spacing in this pool."],"accounts":[{"name":"funder","isMut":true,"isSigner":true},{"name":"owner","isMut":false,"isSigner":false},{"name":"position","isMut":true,"isSigner":false},{"name":"positionMint","isMut":true,"isSigner":true},{"name":"positionTokenAccount","isMut":true,"isSigner":false},{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false},{"name":"associatedTokenProgram","isMut":false,"isSigner":false}],"args":[{"name":"bumps","type":{"defined":"OpenPositionBumps"}},{"name":"tickLowerIndex","type":"i32"},{"name":"tickUpperIndex","type":"i32"}]},{"name":"openPositionWithMetadata","docs":["Open a position in a Whirlpool. A unique token will be minted to represent the position","in the users wallet. Additional Metaplex metadata is appended to identify the token.","The position will start off with 0 liquidity.","","### Parameters","- `tick_lower_index` - The tick specifying the lower end of the position range.","- `tick_upper_index` - The tick specifying the upper end of the position range.","","#### Special Errors","- `InvalidTickIndex` - If a provided tick is out of bounds, out of order or not a multiple of","the tick-spacing in this pool."],"accounts":[{"name":"funder","isMut":true,"isSigner":true},{"name":"owner","isMut":false,"isSigner":false},{"name":"position","isMut":true,"isSigner":false},{"name":"positionMint","isMut":true,"isSigner":true},{"name":"positionMetadataAccount","isMut":true,"isSigner":false,"docs":["https://github.com/metaplex-foundation/metaplex-program-library/blob/master/token-metadata/program/src/utils.rs#L873"]},{"name":"positionTokenAccount","isMut":true,"isSigner":false},{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false},{"name":"associatedTokenProgram","isMut":false,"isSigner":false},{"name":"metadataProgram","isMut":false,"isSigner":false},{"name":"metadataUpdateAuth","isMut":false,"isSigner":false}],"args":[{"name":"bumps","type":{"defined":"OpenPositionWithMetadataBumps"}},{"name":"tickLowerIndex","type":"i32"},{"name":"tickUpperIndex","type":"i32"}]},{"name":"increaseLiquidity","docs":["Add liquidity to a position in the Whirlpool. This call also updates the position\'s accrued fees and rewards.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position.","","### Parameters","- `liquidity_amount` - The total amount of Liquidity the user is willing to deposit.","- `token_max_a` - The maximum amount of tokenA the user is willing to deposit.","- `token_max_b` - The maximum amount of tokenB the user is willing to deposit.","","#### Special Errors","- `LiquidityZero` - Provided liquidity amount is zero.","- `LiquidityTooHigh` - Provided liquidity exceeds u128::max.","- `TokenMaxExceeded` - The required token to perform this operation exceeds the user defined amount."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":true,"isSigner":false},{"name":"tickArrayUpper","isMut":true,"isSigner":false}],"args":[{"name":"liquidityAmount","type":"u128"},{"name":"tokenMaxA","type":"u64"},{"name":"tokenMaxB","type":"u64"}]},{"name":"decreaseLiquidity","docs":["Withdraw liquidity from a position in the Whirlpool. This call also updates the position\'s accrued fees and rewards.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position.","","### Parameters","- `liquidity_amount` - The total amount of Liquidity the user desires to withdraw.","- `token_min_a` - The minimum amount of tokenA the user is willing to withdraw.","- `token_min_b` - The minimum amount of tokenB the user is willing to withdraw.","","#### Special Errors","- `LiquidityZero` - Provided liquidity amount is zero.","- `LiquidityTooHigh` - Provided liquidity exceeds u128::max.","- `TokenMinSubceeded` - The required token to perform this operation subceeds the user defined amount."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":true,"isSigner":false},{"name":"tickArrayUpper","isMut":true,"isSigner":false}],"args":[{"name":"liquidityAmount","type":"u128"},{"name":"tokenMinA","type":"u64"},{"name":"tokenMinB","type":"u64"}]},{"name":"updateFeesAndRewards","docs":["Update the accrued fees and rewards for a position.","","#### Special Errors","- `TickNotFound` - Provided tick array account does not contain the tick for this position.","- `LiquidityZero` - Position has zero liquidity and therefore already has the most updated fees and reward values."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"position","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":false,"isSigner":false},{"name":"tickArrayUpper","isMut":false,"isSigner":false}],"args":[]},{"name":"collectFees","docs":["Collect fees accrued for this position.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"collectReward","docs":["Collect rewards accrued for this position.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"rewardOwnerAccount","isMut":true,"isSigner":false},{"name":"rewardVault","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"collectProtocolFees","docs":["Collect the protocol fees accrued in this Whirlpool","","### Authority","- `collect_protocol_fees_authority` - assigned authority in the WhirlpoolConfig that can collect protocol fees"],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"collectProtocolFeesAuthority","isMut":false,"isSigner":true},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tokenDestinationA","isMut":true,"isSigner":false},{"name":"tokenDestinationB","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"swap","docs":["Perform a swap in this Whirlpool","","### Authority","- \\"token_authority\\" - The authority to withdraw tokens from the input token account.","","### Parameters","- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).","- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).","- `sqrt_price_limit` - The maximum/minimum price the swap will swap to.","- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.","- `a_to_b` - The direction of the swap. True if swapping from A to B. False if swapping from B to A.","","#### Special Errors","- `ZeroTradableAmount` - User provided parameter `amount` is 0.","- `InvalidSqrtPriceLimitDirection` - User provided parameter `sqrt_price_limit` does not match the direction of the trade.","- `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool\'s max/min bounds for sqrt-price.","- `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.","- `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.","- `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.","- `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.","- `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0."],"accounts":[{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"tokenAuthority","isMut":false,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArray0","isMut":true,"isSigner":false},{"name":"tickArray1","isMut":true,"isSigner":false},{"name":"tickArray2","isMut":true,"isSigner":false},{"name":"oracle","isMut":false,"isSigner":false}],"args":[{"name":"amount","type":"u64"},{"name":"otherAmountThreshold","type":"u64"},{"name":"sqrtPriceLimit","type":"u128"},{"name":"amountSpecifiedIsInput","type":"bool"},{"name":"aToB","type":"bool"}]},{"name":"closePosition","docs":["Close a position in a Whirlpool. Burns the position token in the owner\'s wallet.","","### Authority","- \\"position_authority\\" - The authority that owns the position token.","","#### Special Errors","- `ClosePositionNotEmpty` - The provided position account is not empty."],"accounts":[{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"receiver","isMut":true,"isSigner":false},{"name":"position","isMut":true,"isSigner":false},{"name":"positionMint","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"setDefaultFeeRate","docs":["Set the default_fee_rate for a FeeTier","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority in the WhirlpoolConfig","","### Parameters","- `default_fee_rate` - The default fee rate that a pool will use if the pool uses this","fee tier during initialization.","","#### Special Errors","- `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds MAX_FEE_RATE."],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"feeTier","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true}],"args":[{"name":"defaultFeeRate","type":"u16"}]},{"name":"setDefaultProtocolFeeRate","docs":["Sets the default protocol fee rate for a WhirlpoolConfig","Protocol fee rate is represented as a basis point.","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can modify pool fees in the WhirlpoolConfig","","### Parameters","- `default_protocol_fee_rate` - Rate that is referenced during the initialization of a Whirlpool using this config.","","#### Special Errors","- `ProtocolFeeRateMaxExceeded` - If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE."],"accounts":[{"name":"whirlpoolsConfig","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true}],"args":[{"name":"defaultProtocolFeeRate","type":"u16"}]},{"name":"setFeeRate","docs":["Sets the fee rate for a Whirlpool.","Fee rate is represented as hundredths of a basis point.","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can modify pool fees in the WhirlpoolConfig","","### Parameters","- `fee_rate` - The rate that the pool will use to calculate fees going onwards.","","#### Special Errors","- `FeeRateMaxExceeded` - If the provided fee_rate exceeds MAX_FEE_RATE."],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true}],"args":[{"name":"feeRate","type":"u16"}]},{"name":"setProtocolFeeRate","docs":["Sets the protocol fee rate for a Whirlpool.","Protocol fee rate is represented as a basis point.","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can modify pool fees in the WhirlpoolConfig","","### Parameters","- `protocol_fee_rate` - The rate that the pool will use to calculate protocol fees going onwards.","","#### Special Errors","- `ProtocolFeeRateMaxExceeded` - If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE."],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true}],"args":[{"name":"protocolFeeRate","type":"u16"}]},{"name":"setFeeAuthority","docs":["Sets the fee authority for a WhirlpoolConfig.","The fee authority can set the fee & protocol fee rate for individual pools or","set the default fee rate for newly minted pools.","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can modify pool fees in the WhirlpoolConfig"],"accounts":[{"name":"whirlpoolsConfig","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true},{"name":"newFeeAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"setCollectProtocolFeesAuthority","docs":["Sets the fee authority to collect protocol fees for a WhirlpoolConfig.","Only the current collect protocol fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can collect protocol fees in the WhirlpoolConfig"],"accounts":[{"name":"whirlpoolsConfig","isMut":true,"isSigner":false},{"name":"collectProtocolFeesAuthority","isMut":false,"isSigner":true},{"name":"newCollectProtocolFeesAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"setRewardAuthority","docs":["Set the whirlpool reward authority at the provided `reward_index`.","Only the current reward authority for this reward index has permission to invoke this instruction.","","### Authority","- \\"reward_authority\\" - Set authority that can control reward emission for this particular reward.","","#### Special Errors","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"newRewardAuthority","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"setRewardAuthorityBySuperAuthority","docs":["Set the whirlpool reward authority at the provided `reward_index`.","Only the current reward super authority has permission to invoke this instruction.","","### Authority","- \\"reward_authority\\" - Set authority that can control reward emission for this particular reward.","","#### Special Errors","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardEmissionsSuperAuthority","isMut":false,"isSigner":true},{"name":"newRewardAuthority","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"setRewardEmissionsSuperAuthority","docs":["Set the whirlpool reward super authority for a WhirlpoolConfig","Only the current reward super authority has permission to invoke this instruction.","This instruction will not change the authority on any `WhirlpoolRewardInfo` whirlpool rewards.","","### Authority","- \\"reward_emissions_super_authority\\" - Set authority that can control reward authorities for all pools in this config space."],"accounts":[{"name":"whirlpoolsConfig","isMut":true,"isSigner":false},{"name":"rewardEmissionsSuperAuthority","isMut":false,"isSigner":true},{"name":"newRewardEmissionsSuperAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"twoHopSwap","docs":["Perform a two-hop swap in this Whirlpool","","### Authority","- \\"token_authority\\" - The authority to withdraw tokens from the input token account.","","### Parameters","- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).","- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).","- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.","- `a_to_b_one` - The direction of the swap of hop one. True if swapping from A to B. False if swapping from B to A.","- `a_to_b_two` - The direction of the swap of hop two. True if swapping from A to B. False if swapping from B to A.","- `sqrt_price_limit_one` - The maximum/minimum price the swap will swap to in the first hop.","- `sqrt_price_limit_two` - The maximum/minimum price the swap will swap to in the second hop.","","#### Special Errors","- `ZeroTradableAmount` - User provided parameter `amount` is 0.","- `InvalidSqrtPriceLimitDirection` - User provided parameter `sqrt_price_limit` does not match the direction of the trade.","- `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool\'s max/min bounds for sqrt-price.","- `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.","- `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.","- `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.","- `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.","- `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0.","- `InvalidIntermediaryMint` - Error if the intermediary mint between hop one and two do not equal.","- `DuplicateTwoHopPool` - Error if whirlpool one & two are the same pool."],"accounts":[{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"tokenAuthority","isMut":false,"isSigner":true},{"name":"whirlpoolOne","isMut":true,"isSigner":false},{"name":"whirlpoolTwo","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountOneA","isMut":true,"isSigner":false},{"name":"tokenVaultOneA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountOneB","isMut":true,"isSigner":false},{"name":"tokenVaultOneB","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountTwoA","isMut":true,"isSigner":false},{"name":"tokenVaultTwoA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountTwoB","isMut":true,"isSigner":false},{"name":"tokenVaultTwoB","isMut":true,"isSigner":false},{"name":"tickArrayOne0","isMut":true,"isSigner":false},{"name":"tickArrayOne1","isMut":true,"isSigner":false},{"name":"tickArrayOne2","isMut":true,"isSigner":false},{"name":"tickArrayTwo0","isMut":true,"isSigner":false},{"name":"tickArrayTwo1","isMut":true,"isSigner":false},{"name":"tickArrayTwo2","isMut":true,"isSigner":false},{"name":"oracleOne","isMut":false,"isSigner":false},{"name":"oracleTwo","isMut":false,"isSigner":false}],"args":[{"name":"amount","type":"u64"},{"name":"otherAmountThreshold","type":"u64"},{"name":"amountSpecifiedIsInput","type":"bool"},{"name":"aToBOne","type":"bool"},{"name":"aToBTwo","type":"bool"},{"name":"sqrtPriceLimitOne","type":"u128"},{"name":"sqrtPriceLimitTwo","type":"u128"}]},{"name":"initializePositionBundle","docs":["Initializes a PositionBundle account that bundles several positions.","A unique token will be minted to represent the position bundle in the users wallet."],"accounts":[{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleMint","isMut":true,"isSigner":true},{"name":"positionBundleTokenAccount","isMut":true,"isSigner":false},{"name":"positionBundleOwner","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false},{"name":"associatedTokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"initializePositionBundleWithMetadata","docs":["Initializes a PositionBundle account that bundles several positions.","A unique token will be minted to represent the position bundle in the users wallet.","Additional Metaplex metadata is appended to identify the token."],"accounts":[{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleMint","isMut":true,"isSigner":true},{"name":"positionBundleMetadata","isMut":true,"isSigner":false,"docs":["https://github.com/metaplex-foundation/metaplex-program-library/blob/773a574c4b34e5b9f248a81306ec24db064e255f/token-metadata/program/src/utils/metadata.rs#L100"]},{"name":"positionBundleTokenAccount","isMut":true,"isSigner":false},{"name":"positionBundleOwner","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"metadataUpdateAuth","isMut":false,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false},{"name":"associatedTokenProgram","isMut":false,"isSigner":false},{"name":"metadataProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"deletePositionBundle","docs":["Delete a PositionBundle account. Burns the position bundle token in the owner\'s wallet.","","### Authority","- `position_bundle_owner` - The owner that owns the position bundle token.","","### Special Errors","- `PositionBundleNotDeletable` - The provided position bundle has open positions."],"accounts":[{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleMint","isMut":true,"isSigner":false},{"name":"positionBundleTokenAccount","isMut":true,"isSigner":false},{"name":"positionBundleOwner","isMut":false,"isSigner":true},{"name":"receiver","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"openBundledPosition","docs":["Open a bundled position in a Whirlpool. No new tokens are issued","because the owner of the position bundle becomes the owner of the position.","The position will start off with 0 liquidity.","","### Authority","- `position_bundle_authority` - authority that owns the token corresponding to this desired position bundle.","","### Parameters","- `bundle_index` - The bundle index that we\'d like to open.","- `tick_lower_index` - The tick specifying the lower end of the position range.","- `tick_upper_index` - The tick specifying the upper end of the position range.","","#### Special Errors","- `InvalidBundleIndex` - If the provided bundle index is out of bounds.","- `InvalidTickIndex` - If a provided tick is out of bounds, out of order or not a multiple of","the tick-spacing in this pool."],"accounts":[{"name":"bundledPosition","isMut":true,"isSigner":false},{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleTokenAccount","isMut":false,"isSigner":false},{"name":"positionBundleAuthority","isMut":false,"isSigner":true},{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"bundleIndex","type":"u16"},{"name":"tickLowerIndex","type":"i32"},{"name":"tickUpperIndex","type":"i32"}]},{"name":"closeBundledPosition","docs":["Close a bundled position in a Whirlpool.","","### Authority","- `position_bundle_authority` - authority that owns the token corresponding to this desired position bundle.","","### Parameters","- `bundle_index` - The bundle index that we\'d like to close.","","#### Special Errors","- `InvalidBundleIndex` - If the provided bundle index is out of bounds.","- `ClosePositionNotEmpty` - The provided position account is not empty."],"accounts":[{"name":"bundledPosition","isMut":true,"isSigner":false},{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleTokenAccount","isMut":false,"isSigner":false},{"name":"positionBundleAuthority","isMut":false,"isSigner":true},{"name":"receiver","isMut":true,"isSigner":false}],"args":[{"name":"bundleIndex","type":"u16"}]},{"name":"collectFeesV2","docs":["Collect fees accrued for this position.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false}],"args":[{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"collectProtocolFeesV2","docs":["Collect the protocol fees accrued in this Whirlpool","","### Authority","- `collect_protocol_fees_authority` - assigned authority in the WhirlpoolConfig that can collect protocol fees"],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"collectProtocolFeesAuthority","isMut":false,"isSigner":true},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tokenDestinationA","isMut":true,"isSigner":false},{"name":"tokenDestinationB","isMut":true,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false}],"args":[{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"collectRewardV2","docs":["Collect rewards accrued for this position.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"rewardOwnerAccount","isMut":true,"isSigner":false},{"name":"rewardMint","isMut":false,"isSigner":false},{"name":"rewardVault","isMut":true,"isSigner":false},{"name":"rewardTokenProgram","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"decreaseLiquidityV2","docs":["Withdraw liquidity from a position in the Whirlpool. This call also updates the position\'s accrued fees and rewards.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position.","","### Parameters","- `liquidity_amount` - The total amount of Liquidity the user desires to withdraw.","- `token_min_a` - The minimum amount of tokenA the user is willing to withdraw.","- `token_min_b` - The minimum amount of tokenB the user is willing to withdraw.","","#### Special Errors","- `LiquidityZero` - Provided liquidity amount is zero.","- `LiquidityTooHigh` - Provided liquidity exceeds u128::max.","- `TokenMinSubceeded` - The required token to perform this operation subceeds the user defined amount."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":true,"isSigner":false},{"name":"tickArrayUpper","isMut":true,"isSigner":false}],"args":[{"name":"liquidityAmount","type":"u128"},{"name":"tokenMinA","type":"u64"},{"name":"tokenMinB","type":"u64"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"increaseLiquidityV2","docs":["Add liquidity to a position in the Whirlpool. This call also updates the position\'s accrued fees and rewards.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position.","","### Parameters","- `liquidity_amount` - The total amount of Liquidity the user is willing to deposit.","- `token_max_a` - The maximum amount of tokenA the user is willing to deposit.","- `token_max_b` - The maximum amount of tokenB the user is willing to deposit.","","#### Special Errors","- `LiquidityZero` - Provided liquidity amount is zero.","- `LiquidityTooHigh` - Provided liquidity exceeds u128::max.","- `TokenMaxExceeded` - The required token to perform this operation exceeds the user defined amount."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":true,"isSigner":false},{"name":"tickArrayUpper","isMut":true,"isSigner":false}],"args":[{"name":"liquidityAmount","type":"u128"},{"name":"tokenMaxA","type":"u64"},{"name":"tokenMaxB","type":"u64"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"initializePoolV2","docs":["Initializes a Whirlpool account.","Fee rate is set to the default values on the config and supplied fee_tier.","","### Parameters","- `bumps` - The bump value when deriving the PDA of the Whirlpool address.","- `tick_spacing` - The desired tick spacing for this pool.","- `initial_sqrt_price` - The desired initial sqrt-price for this pool","","#### Special Errors","`InvalidTokenMintOrder` - The order of mints have to be ordered by","`SqrtPriceOutOfBounds` - provided initial_sqrt_price is not between 2^-64 to 2^64",""],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenBadgeA","isMut":false,"isSigner":false},{"name":"tokenBadgeB","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":true},{"name":"tokenVaultB","isMut":true,"isSigner":true},{"name":"feeTier","isMut":false,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"tickSpacing","type":"u16"},{"name":"initialSqrtPrice","type":"u128"}]},{"name":"initializeRewardV2","docs":["Initialize reward for a Whirlpool. A pool can only support up to a set number of rewards.","","### Authority","- \\"reward_authority\\" - assigned authority by the reward_super_authority for the specified","reward-index in this Whirlpool","","### Parameters","- `reward_index` - The reward index that we\'d like to initialize. (0 <= index <= NUM_REWARDS)","","#### Special Errors","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"funder","isMut":true,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardMint","isMut":false,"isSigner":false},{"name":"rewardTokenBadge","isMut":false,"isSigner":false},{"name":"rewardVault","isMut":true,"isSigner":true},{"name":"rewardTokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"setRewardEmissionsV2","docs":["Set the reward emissions for a reward in a Whirlpool.","","### Authority","- \\"reward_authority\\" - assigned authority by the reward_super_authority for the specified","reward-index in this Whirlpool","","### Parameters","- `reward_index` - The reward index (0 <= index <= NUM_REWARDS) that we\'d like to modify.","- `emissions_per_second_x64` - The amount of rewards emitted in this pool.","","#### Special Errors","- `RewardVaultAmountInsufficient` - The amount of rewards in the reward vault cannot emit","more than a day of desired emissions.","- `InvalidTimestamp` - Provided timestamp is not in order with the previous timestamp.","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"rewardVault","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"},{"name":"emissionsPerSecondX64","type":"u128"}]},{"name":"swapV2","docs":["Perform a swap in this Whirlpool","","### Authority","- \\"token_authority\\" - The authority to withdraw tokens from the input token account.","","### Parameters","- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).","- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).","- `sqrt_price_limit` - The maximum/minimum price the swap will swap to.","- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.","- `a_to_b` - The direction of the swap. True if swapping from A to B. False if swapping from B to A.","","#### Special Errors","- `ZeroTradableAmount` - User provided parameter `amount` is 0.","- `InvalidSqrtPriceLimitDirection` - User provided parameter `sqrt_price_limit` does not match the direction of the trade.","- `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool\'s max/min bounds for sqrt-price.","- `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.","- `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.","- `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.","- `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.","- `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0."],"accounts":[{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false},{"name":"tokenAuthority","isMut":false,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArray0","isMut":true,"isSigner":false},{"name":"tickArray1","isMut":true,"isSigner":false},{"name":"tickArray2","isMut":true,"isSigner":false},{"name":"oracle","isMut":true,"isSigner":false}],"args":[{"name":"amount","type":"u64"},{"name":"otherAmountThreshold","type":"u64"},{"name":"sqrtPriceLimit","type":"u128"},{"name":"amountSpecifiedIsInput","type":"bool"},{"name":"aToB","type":"bool"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"twoHopSwapV2","docs":["Perform a two-hop swap in this Whirlpool","","### Authority","- \\"token_authority\\" - The authority to withdraw tokens from the input token account.","","### Parameters","- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).","- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).","- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.","- `a_to_b_one` - The direction of the swap of hop one. True if swapping from A to B. False if swapping from B to A.","- `a_to_b_two` - The direction of the swap of hop two. True if swapping from A to B. False if swapping from B to A.","- `sqrt_price_limit_one` - The maximum/minimum price the swap will swap to in the first hop.","- `sqrt_price_limit_two` - The maximum/minimum price the swap will swap to in the second hop.","","#### Special Errors","- `ZeroTradableAmount` - User provided parameter `amount` is 0.","- `InvalidSqrtPriceLimitDirection` - User provided parameter `sqrt_price_limit` does not match the direction of the trade.","- `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool\'s max/min bounds for sqrt-price.","- `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.","- `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.","- `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.","- `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.","- `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0.","- `InvalidIntermediaryMint` - Error if the intermediary mint between hop one and two do not equal.","- `DuplicateTwoHopPool` - Error if whirlpool one & two are the same pool."],"accounts":[{"name":"whirlpoolOne","isMut":true,"isSigner":false},{"name":"whirlpoolTwo","isMut":true,"isSigner":false},{"name":"tokenMintInput","isMut":false,"isSigner":false},{"name":"tokenMintIntermediate","isMut":false,"isSigner":false},{"name":"tokenMintOutput","isMut":false,"isSigner":false},{"name":"tokenProgramInput","isMut":false,"isSigner":false},{"name":"tokenProgramIntermediate","isMut":false,"isSigner":false},{"name":"tokenProgramOutput","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountInput","isMut":true,"isSigner":false},{"name":"tokenVaultOneInput","isMut":true,"isSigner":false},{"name":"tokenVaultOneIntermediate","isMut":true,"isSigner":false},{"name":"tokenVaultTwoIntermediate","isMut":true,"isSigner":false},{"name":"tokenVaultTwoOutput","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountOutput","isMut":true,"isSigner":false},{"name":"tokenAuthority","isMut":false,"isSigner":true},{"name":"tickArrayOne0","isMut":true,"isSigner":false},{"name":"tickArrayOne1","isMut":true,"isSigner":false},{"name":"tickArrayOne2","isMut":true,"isSigner":false},{"name":"tickArrayTwo0","isMut":true,"isSigner":false},{"name":"tickArrayTwo1","isMut":true,"isSigner":false},{"name":"tickArrayTwo2","isMut":true,"isSigner":false},{"name":"oracleOne","isMut":true,"isSigner":false},{"name":"oracleTwo","isMut":true,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false}],"args":[{"name":"amount","type":"u64"},{"name":"otherAmountThreshold","type":"u64"},{"name":"amountSpecifiedIsInput","type":"bool"},{"name":"aToBOne","type":"bool"},{"name":"aToBTwo","type":"bool"},{"name":"sqrtPriceLimitOne","type":"u128"},{"name":"sqrtPriceLimitTwo","type":"u128"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"initializeConfigExtension","accounts":[{"name":"config","isMut":false,"isSigner":false},{"name":"configExtension","isMut":true,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"feeAuthority","isMut":false,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"setConfigExtensionAuthority","accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpoolsConfigExtension","isMut":true,"isSigner":false},{"name":"configExtensionAuthority","isMut":false,"isSigner":true},{"name":"newConfigExtensionAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"setTokenBadgeAuthority","accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpoolsConfigExtension","isMut":true,"isSigner":false},{"name":"configExtensionAuthority","isMut":false,"isSigner":true},{"name":"newTokenBadgeAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"initializeTokenBadge","accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpoolsConfigExtension","isMut":false,"isSigner":false},{"name":"tokenBadgeAuthority","isMut":false,"isSigner":true},{"name":"tokenMint","isMut":false,"isSigner":false},{"name":"tokenBadge","isMut":true,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"deleteTokenBadge","accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpoolsConfigExtension","isMut":false,"isSigner":false},{"name":"tokenBadgeAuthority","isMut":false,"isSigner":true},{"name":"tokenMint","isMut":false,"isSigner":false},{"name":"tokenBadge","isMut":true,"isSigner":false},{"name":"receiver","isMut":true,"isSigner":false}],"args":[]}],"accounts":[{"name":"WhirlpoolsConfigExtension","type":{"kind":"struct","fields":[{"name":"whirlpoolsConfig","type":"publicKey"},{"name":"configExtensionAuthority","type":"publicKey"},{"name":"tokenBadgeAuthority","type":"publicKey"}]}},{"name":"WhirlpoolsConfig","type":{"kind":"struct","fields":[{"name":"feeAuthority","type":"publicKey"},{"name":"collectProtocolFeesAuthority","type":"publicKey"},{"name":"rewardEmissionsSuperAuthority","type":"publicKey"},{"name":"defaultProtocolFeeRate","type":"u16"}]}},{"name":"FeeTier","type":{"kind":"struct","fields":[{"name":"whirlpoolsConfig","type":"publicKey"},{"name":"tickSpacing","type":"u16"},{"name":"defaultFeeRate","type":"u16"}]}},{"name":"PositionBundle","type":{"kind":"struct","fields":[{"name":"positionBundleMint","type":"publicKey"},{"name":"positionBitmap","type":{"array":["u8",32]}}]}},{"name":"Position","type":{"kind":"struct","fields":[{"name":"whirlpool","type":"publicKey"},{"name":"positionMint","type":"publicKey"},{"name":"liquidity","type":"u128"},{"name":"tickLowerIndex","type":"i32"},{"name":"tickUpperIndex","type":"i32"},{"name":"feeGrowthCheckpointA","type":"u128"},{"name":"feeOwedA","type":"u64"},{"name":"feeGrowthCheckpointB","type":"u128"},{"name":"feeOwedB","type":"u64"},{"name":"rewardInfos","type":{"array":[{"defined":"PositionRewardInfo"},3]}}]}},{"name":"TickArray","type":{"kind":"struct","fields":[{"name":"startTickIndex","type":"i32"},{"name":"ticks","type":{"array":[{"defined":"Tick"},88]}},{"name":"whirlpool","type":"publicKey"}]}},{"name":"TokenBadge","type":{"kind":"struct","fields":[{"name":"whirlpoolsConfig","type":"publicKey"},{"name":"tokenMint","type":"publicKey"}]}},{"name":"Whirlpool","type":{"kind":"struct","fields":[{"name":"whirlpoolsConfig","type":"publicKey"},{"name":"whirlpoolBump","type":{"array":["u8",1]}},{"name":"tickSpacing","type":"u16"},{"name":"tickSpacingSeed","type":{"array":["u8",2]}},{"name":"feeRate","type":"u16"},{"name":"protocolFeeRate","type":"u16"},{"name":"liquidity","type":"u128"},{"name":"sqrtPrice","type":"u128"},{"name":"tickCurrentIndex","type":"i32"},{"name":"protocolFeeOwedA","type":"u64"},{"name":"protocolFeeOwedB","type":"u64"},{"name":"tokenMintA","type":"publicKey"},{"name":"tokenVaultA","type":"publicKey"},{"name":"feeGrowthGlobalA","type":"u128"},{"name":"tokenMintB","type":"publicKey"},{"name":"tokenVaultB","type":"publicKey"},{"name":"feeGrowthGlobalB","type":"u128"},{"name":"rewardLastUpdatedTimestamp","type":"u64"},{"name":"rewardInfos","type":{"array":[{"defined":"WhirlpoolRewardInfo"},3]}}]}}],"types":[{"name":"OpenPositionBumps","type":{"kind":"struct","fields":[{"name":"positionBump","type":"u8"}]}},{"name":"OpenPositionWithMetadataBumps","type":{"kind":"struct","fields":[{"name":"positionBump","type":"u8"},{"name":"metadataBump","type":"u8"}]}},{"name":"PositionRewardInfo","type":{"kind":"struct","fields":[{"name":"growthInsideCheckpoint","type":"u128"},{"name":"amountOwed","type":"u64"}]}},{"name":"Tick","type":{"kind":"struct","fields":[{"name":"initialized","type":"bool"},{"name":"liquidityNet","type":"i128"},{"name":"liquidityGross","type":"u128"},{"name":"feeGrowthOutsideA","type":"u128"},{"name":"feeGrowthOutsideB","type":"u128"},{"name":"rewardGrowthsOutside","type":{"array":["u128",3]}}]}},{"name":"WhirlpoolRewardInfo","docs":["Stores the state relevant for tracking liquidity mining rewards at the `Whirlpool` level.","These values are used in conjunction with `PositionRewardInfo`, `Tick.reward_growths_outside`,","and `Whirlpool.reward_last_updated_timestamp` to determine how many rewards are earned by open","positions."],"type":{"kind":"struct","fields":[{"name":"mint","docs":["Reward token mint."],"type":"publicKey"},{"name":"vault","docs":["Reward vault token account."],"type":"publicKey"},{"name":"authority","docs":["Authority account that has permission to initialize the reward and set emissions."],"type":"publicKey"},{"name":"emissionsPerSecondX64","docs":["Q64.64 number that indicates how many tokens per second are earned per unit of liquidity."],"type":"u128"},{"name":"growthGlobalX64","docs":["Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward","emissions were turned on."],"type":"u128"}]}},{"name":"WhirlpoolBumps","type":{"kind":"struct","fields":[{"name":"whirlpoolBump","type":"u8"}]}},{"name":"RemainingAccountsSlice","type":{"kind":"struct","fields":[{"name":"accountsType","type":{"defined":"AccountsType"}},{"name":"length","type":"u8"}]}},{"name":"RemainingAccountsInfo","type":{"kind":"struct","fields":[{"name":"slices","type":{"vec":{"defined":"RemainingAccountsSlice"}}}]}},{"name":"CurrIndex","type":{"kind":"enum","variants":[{"name":"Below"},{"name":"Inside"},{"name":"Above"}]}},{"name":"TickLabel","type":{"kind":"enum","variants":[{"name":"Upper"},{"name":"Lower"}]}},{"name":"Direction","type":{"kind":"enum","variants":[{"name":"Left"},{"name":"Right"}]}},{"name":"AccountsType","type":{"kind":"enum","variants":[{"name":"TransferHookA"},{"name":"TransferHookB"},{"name":"TransferHookReward"},{"name":"TransferHookInput"},{"name":"TransferHookIntermediate"},{"name":"TransferHookOutput"}]}}],"errors":[{"code":6000,"name":"InvalidEnum","msg":"Enum value could not be converted"},{"code":6001,"name":"InvalidStartTick","msg":"Invalid start tick index provided."},{"code":6002,"name":"TickArrayExistInPool","msg":"Tick-array already exists in this whirlpool"},{"code":6003,"name":"TickArrayIndexOutofBounds","msg":"Attempt to search for a tick-array failed"},{"code":6004,"name":"InvalidTickSpacing","msg":"Tick-spacing is not supported"},{"code":6005,"name":"ClosePositionNotEmpty","msg":"Position is not empty It cannot be closed"},{"code":6006,"name":"DivideByZero","msg":"Unable to divide by zero"},{"code":6007,"name":"NumberCastError","msg":"Unable to cast number into BigInt"},{"code":6008,"name":"NumberDownCastError","msg":"Unable to down cast number"},{"code":6009,"name":"TickNotFound","msg":"Tick not found within tick array"},{"code":6010,"name":"InvalidTickIndex","msg":"Provided tick index is either out of bounds or uninitializable"},{"code":6011,"name":"SqrtPriceOutOfBounds","msg":"Provided sqrt price out of bounds"},{"code":6012,"name":"LiquidityZero","msg":"Liquidity amount must be greater than zero"},{"code":6013,"name":"LiquidityTooHigh","msg":"Liquidity amount must be less than i64::MAX"},{"code":6014,"name":"LiquidityOverflow","msg":"Liquidity overflow"},{"code":6015,"name":"LiquidityUnderflow","msg":"Liquidity underflow"},{"code":6016,"name":"LiquidityNetError","msg":"Tick liquidity net underflowed or overflowed"},{"code":6017,"name":"TokenMaxExceeded","msg":"Exceeded token max"},{"code":6018,"name":"TokenMinSubceeded","msg":"Did not meet token min"},{"code":6019,"name":"MissingOrInvalidDelegate","msg":"Position token account has a missing or invalid delegate"},{"code":6020,"name":"InvalidPositionTokenAmount","msg":"Position token amount must be 1"},{"code":6021,"name":"InvalidTimestampConversion","msg":"Timestamp should be convertible from i64 to u64"},{"code":6022,"name":"InvalidTimestamp","msg":"Timestamp should be greater than the last updated timestamp"},{"code":6023,"name":"InvalidTickArraySequence","msg":"Invalid tick array sequence provided for instruction."},{"code":6024,"name":"InvalidTokenMintOrder","msg":"Token Mint in wrong order"},{"code":6025,"name":"RewardNotInitialized","msg":"Reward not initialized"},{"code":6026,"name":"InvalidRewardIndex","msg":"Invalid reward index"},{"code":6027,"name":"RewardVaultAmountInsufficient","msg":"Reward vault requires amount to support emissions for at least one day"},{"code":6028,"name":"FeeRateMaxExceeded","msg":"Exceeded max fee rate"},{"code":6029,"name":"ProtocolFeeRateMaxExceeded","msg":"Exceeded max protocol fee rate"},{"code":6030,"name":"MultiplicationShiftRightOverflow","msg":"Multiplication with shift right overflow"},{"code":6031,"name":"MulDivOverflow","msg":"Muldiv overflow"},{"code":6032,"name":"MulDivInvalidInput","msg":"Invalid div_u256 input"},{"code":6033,"name":"MultiplicationOverflow","msg":"Multiplication overflow"},{"code":6034,"name":"InvalidSqrtPriceLimitDirection","msg":"Provided SqrtPriceLimit not in the same direction as the swap."},{"code":6035,"name":"ZeroTradableAmount","msg":"There are no tradable amount to swap."},{"code":6036,"name":"AmountOutBelowMinimum","msg":"Amount out below minimum threshold"},{"code":6037,"name":"AmountInAboveMaximum","msg":"Amount in above maximum threshold"},{"code":6038,"name":"TickArraySequenceInvalidIndex","msg":"Invalid index for tick array sequence"},{"code":6039,"name":"AmountCalcOverflow","msg":"Amount calculated overflows"},{"code":6040,"name":"AmountRemainingOverflow","msg":"Amount remaining overflows"},{"code":6041,"name":"InvalidIntermediaryMint","msg":"Invalid intermediary mint"},{"code":6042,"name":"DuplicateTwoHopPool","msg":"Duplicate two hop pool"},{"code":6043,"name":"InvalidBundleIndex","msg":"Bundle index is out of bounds"},{"code":6044,"name":"BundledPositionAlreadyOpened","msg":"Position has already been opened"},{"code":6045,"name":"BundledPositionAlreadyClosed","msg":"Position has already been closed"},{"code":6046,"name":"PositionBundleNotDeletable","msg":"Unable to delete PositionBundle with open positions"},{"code":6047,"name":"UnsupportedTokenMint","msg":"Token mint has unsupported attributes"},{"code":6048,"name":"RemainingAccountsInvalidSlice","msg":"Invalid remaining accounts"},{"code":6049,"name":"RemainingAccountsInsufficient","msg":"Insufficient remaining accounts"},{"code":6050,"name":"NoExtraAccountsForTransferHook","msg":"Unable to call transfer hook without extra accounts"},{"code":6051,"name":"IntermediateTokenAmountMismatch","msg":"Output and input amount mismatch"}]}')},44946:t=>{"use strict";t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},75207:t=>{"use strict";t.exports=JSON.parse('{"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"}}')},1308:t=>{"use strict";t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},29799:t=>{"use strict";t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},18597:t=>{"use strict";t.exports={i8:"6.5.4"}},22562:t=>{"use strict";t.exports=JSON.parse('{"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"}')}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{"use strict";function t(){}function e(t,e){for(const n in e)t[n]=e[n];return t}function r(t){return t()}function i(){return Object.create(null)}function o(t){t.forEach(r)}function s(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(t){return 0===Object.keys(t).length}function c(e,...n){if(null==e)return t;const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}function d(t,e,n,r){if(t){const i=l(t,e,n,r);return t[0](i)}}function l(t,n,r,i){return t[1]&&i?e(r.ctx.slice(),t[1](i(n))):r.ctx}function h(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(void 0===e.dirty)return i;if("object"==typeof i){const t=[],n=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],n=t.ctx.length/32;for(let t=0;t{this._listeners.delete(t),this._observer.unobserve(t)}}_getObserver(){var t;return null!==(t=this._observer)&&void 0!==t?t:this._observer=new ResizeObserver((t=>{var e;for(const n of t)y.entries.set(n.target,n),null===(e=this._listeners.get(n.target))||void 0===e||e(n)}))}}y.entries="WeakMap"in g?new WeakMap:void 0;let b,w=!1;function _(t,e){t.appendChild(e)}function v(t,e,n){t.insertBefore(e,n||null)}function k(t){t.parentNode&&t.parentNode.removeChild(t)}function M(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function T(t){return function(e){return e.preventDefault(),t.call(this,e)}}function P(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function B(t,e){e=""+e,t.data!==e&&(t.data=e)}function L(t,e){t.value=null==e?"":e}function $(t,e,n,r){null==n?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function R(t,e,n){for(let n=0;nt.call(this,e)))}new Map;const U=[],j=[];let Y=[];const F=[],W=Promise.resolve();let H=!1;function K(){H||(H=!0,W.then(J))}function q(){return K(),W}function V(t){Y.push(t)}function G(t){F.push(t)}const Z=new Set;let X=0;function J(){if(0!==X)return;const t=b;do{try{for(;X{tt.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}else r&&r()}function at(t,e){const n=e.token={};function r(t,r,i,o){if(e.token!==n)return;e.resolved=o;let s=e.ctx;void 0!==i&&(s=s.slice(),s[i]=o);const a=t&&(e.current=t)(s);let u=!1;e.block&&(e.blocks?e.blocks.forEach(((t,n)=>{n!==r&&t&&(rt(),st(t,1,1,(()=>{e.blocks[n]===t&&(e.blocks[n]=null)})),it())})):e.block.d(1),a.c(),ot(a,1),a.m(e.mount(),e.anchor),u=!0),e.block=a,e.blocks&&(e.blocks[r]=a),u&&J()}if(!(i=t)||"object"!=typeof i&&"function"!=typeof i||"function"!=typeof i.then){if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}else{const n=N();if(t.then((t=>{C(n),r(e.then,1,e.value,t),C(null)}),(t=>{if(C(n),r(e.catch,2,e.error,t),C(null),!e.hasCatch)throw t})),e.current!==e.pending)return r(e.pending,0),!0}var i}function ut(t,e,n){const r=e.slice(),{resolved:i}=t;t.current===t.then&&(r[t.value]=i),t.current===t.catch&&(r[t.error]=i),t.block.p(r,n)}function ct(t,e){const n={},r={},i={$$scope:1};let o=t.length;for(;o--;){const s=t[o],a=e[o];if(a){for(const t in s)t in a||(r[t]=1);for(const t in a)i[t]||(n[t]=a[t],i[t]=1);t[o]=a}else for(const t in s)i[t]=1}for(const t in r)t in n||(n[t]=void 0);return n}function dt(t){return"object"==typeof t&&null!==t?t:{}}function lt(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function ht(t){t&&t.c()}function ft(t,e,n,i){const{fragment:a,after_update:u}=t.$$;a&&a.m(e,n),i||V((()=>{const e=t.$$.on_mount.map(r).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):o(e),t.$$.on_mount=[]})),u.forEach(V)}function pt(t,e){const n=t.$$;null!==n.fragment&&(function(t){const e=[],n=[];Y.forEach((r=>-1===t.indexOf(r)?e.push(r):n.push(r))),n.forEach((t=>t())),Y=e}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function mt(e,n,r,s,a,u,c,d=[-1]){const l=b;C(e);const h=e.$$={fragment:null,ctx:[],props:u,update:t,not_equal:a,bound:i(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(l?l.$$.context:[])),callbacks:i(),dirty:d,skip_bound:!1,root:n.target||l.$$.root};c&&c(h.root);let f=!1;if(h.ctx=r?r(e,n.props||{},((t,n,...r)=>{const i=r.length?r[0]:n;return h.ctx&&a(h.ctx[t],h.ctx[t]=i)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](i),f&&function(t,e){-1===t.$$.dirty[0]&&(U.push(t),K(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){this.$$set&&!u(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});class gt{$destroy(){pt(this,1),this.$destroy=t}$on(e,n){if(!s(n))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){this.$$set&&!u(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function yt(e){let n,r,i;return{c(){n=A("h2"),n.textContent="Supported Accounts",r=I(),i=A("ul"),i.innerHTML="
  • Whirlpool / Whirlpool
  • \n
  • Whirlpool / WhirlpoolsConfig
  • \n
  • Whirlpool / WhirlpoolsConfigExtension
  • \n
  • Whirlpool / TokenBadge
  • \n
  • Whirlpool / FeeTier
  • \n
  • Whirlpool / Position
  • \n
  • Whirlpool / TickArray
  • \n
  • Whirlpool / PositionBundle
  • \n
  • Token / Mint
  • \n
  • Token / Account
  • \n
  • Token2022 / Mint
  • \n
  • Token2022 / Account
  • \n
  • TokenSwap / SwapState
  • \n
  • Aquafarm / GlobalFarm
  • \n
  • Aquafarm / UserFarm
  • \n
  • Generic
  • "},m(t,e){v(t,n,e),v(t,r,e),v(t,i,e)},p:t,i:t,o:t,d(t){t&&k(n),t&&k(r),t&&k(i)}}}function bt(t){let e,n;return{c(){e=S("@"),n=S(t[2])},m(t,r){v(t,e,r),v(t,n,r)},p(t,e){4&e&&B(n,t[2])},d(t){t&&k(e),t&&k(n)}}}function wt(t){let e,n,r,i,o,s,a,u,c=void 0!==t[2]&&bt(t);const l=t[4].default,m=d(l,t,t[3],null);return{c(){e=A("dt"),n=A("b"),r=S(t[0]),i=I(),o=A("sub"),s=S(t[1]),c&&c.c(),a=A("dd"),m&&m.c(),$(o,"color","#666")},m(t,d){v(t,e,d),_(e,n),_(n,r),_(e,i),_(e,o),_(o,s),c&&c.m(o,null),v(t,a,d),m&&m.m(a,null),u=!0},p(t,[e]){(!u||1&e)&&B(r,t[0]),(!u||2&e)&&B(s,t[1]),void 0!==t[2]?c?c.p(t,e):(c=bt(t),c.c(),c.m(o,null)):c&&(c.d(1),c=null),m&&m.p&&(!u||8&e)&&f(m,l,t,t[3],u?h(l,t[3],e,null):p(t[3]),null)},i(t){u||(ot(m,t),u=!0)},o(t){st(m,t),u=!1},d(t){t&&k(e),c&&c.d(),t&&k(a),m&&m.d(t)}}}function _t(t,e,n){let{$$slots:r={},$$scope:i}=e,{name:o}=e,{type:s=""}=e,{offset:a}=e;return t.$$set=t=>{"name"in t&&n(0,o=t.name),"type"in t&&n(1,s=t.type),"offset"in t&&n(2,a=t.offset),"$$scope"in t&&n(3,i=t.$$scope)},[o,s,a,i,r]}const vt=class extends gt{constructor(t){super(),mt(this,t,_t,wt,a,{name:0,type:1,offset:2})}};var kt=n(78845),Mt=n(18245);let At;function St(t){At=new Mt.Connection(t,"confirmed")}function It(){return At}const xt=[{id:"helius",name:"Mainnet HELIUS",network:"mainnet",url:"https://rpc-proxy-account-microscope.yugure.dev"},{id:"solana",name:"Mainnet Solana",network:"mainnet",url:"https://api.mainnet-beta.solana.com"},{id:"devnet",name:"Devnet Solana",network:"devnet",url:"https://api.devnet.solana.com"},{id:"localnet",name:"Test Validator",network:"localnet",url:"http://localhost:8899"}];function Et(){for(const t of xt)if(t.url===At.rpcEndpoint)return t;return{id:"custom",name:"custom",network:"custom",url:At.rpcEndpoint}}var Tt,Pt,Bt=9e15,Lt=1e9,$t="0123456789abcdef",Rt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ot="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Dt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Bt,maxE:Bt,crypto:!1},Ct=!0,Nt="[DecimalError] ",zt=Nt+"Invalid argument: ",Ut=Nt+"Precision limit exceeded",jt=Nt+"crypto unavailable",Yt="[object Decimal]",Ft=Math.floor,Wt=Math.pow,Ht=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Kt=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,qt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Vt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Gt=1e7,Zt=7,Xt=Rt.length-1,Jt=Ot.length-1,Qt={toStringTag:Yt};function te(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;en)throw Error(zt+t)}function ne(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=Zt,i=0):(i=Math.ceil((e+1)/Zt),e%=Zt),o=Wt(10,Zt-e),a=t[i]%o|0,null==r?e<3?(0==e?a=a/100|0:1==e&&(a=a/10|0),s=n<4&&99999==a||n>3&&49999==a||5e4==a||0==a):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(t[i+1]/o/100|0)==Wt(10,e-2)-1||(a==o/2||0==a)&&0==(t[i+1]/o/100|0):e<4?(0==e?a=a/1e3|0:1==e?a=a/100|0:2==e&&(a=a/10|0),s=(r||n<4)&&9999==a||!r&&n>3&&4999==a):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==Wt(10,e-3)-1,s}function re(t,e,n){for(var r,i,o=[0],s=0,a=t.length;sn-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}Qt.absoluteValue=Qt.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),oe(t)},Qt.ceil=function(){return oe(new this.constructor(this),this.e+1,2)},Qt.clampedTo=Qt.clamp=function(t,e){var n=this,r=n.constructor;if(t=new r(t),e=new r(e),!t.s||!e.s)return new r(NaN);if(t.gt(e))throw Error(zt+e);return n.cmp(t)<0?t:n.cmp(e)>0?e:new r(n)},Qt.comparedTo=Qt.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,u=o.s,c=t.s;if(!s||!a)return u&&c?u!==c?u:s===a?0:!s^u<0?1:-1:NaN;if(!s[0]||!a[0])return s[0]?u:a[0]?-c:0;if(u!==c)return u;if(o.e!==t.e)return o.e>t.e^u<0?1:-1;for(e=0,n=(r=s.length)<(i=a.length)?r:i;ea[e]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1},Qt.cosine=Qt.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+Zt,r.rounding=1,n=function(t,e){var n,r,i;if(e.isZero())return e;(r=e.d.length)<32?i=(1/ve(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=_e(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}(r,ke(r,n)),r.precision=t,r.rounding=e,oe(2==Pt||3==Pt?n.neg():n,t,e,!0)):new r(1):new r(NaN)},Qt.cubeRoot=Qt.cbrt=function(){var t,e,n,r,i,o,s,a,u,c,d=this,l=d.constructor;if(!d.isFinite()||d.isZero())return new l(d);for(Ct=!1,(o=d.s*Wt(d.s*d,1/3))&&Math.abs(o)!=1/0?r=new l(o.toString()):(n=te(d.d),(o=((t=d.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=Wt(n,1/3),t=Ft((t+1)/3)-(t%3==(t<0?-1:2)),(r=new l(n=o==1/0?"5e"+t:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+t)).s=d.s),s=(t=l.precision)+3;;)if(c=(u=(a=r).times(a).times(a)).plus(d),r=ie(c.plus(d).times(a),c.plus(u),s+2,1),te(a.d).slice(0,s)===(n=te(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(oe(r,t+1,1),e=!r.times(r).times(r).eq(d));break}if(!i&&(oe(a,t+1,0),a.times(a).times(a).eq(d))){r=a;break}s+=4,i=1}return Ct=!0,oe(r,t,l.rounding,e)},Qt.decimalPlaces=Qt.dp=function(){var t,e=this.d,n=NaN;if(e){if(n=((t=e.length-1)-Ft(this.e/Zt))*Zt,t=e[t])for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},Qt.dividedBy=Qt.div=function(t){return ie(this,new this.constructor(t))},Qt.dividedToIntegerBy=Qt.divToInt=function(t){var e=this.constructor;return oe(ie(this,new e(t),0,1,1),e.precision,e.rounding)},Qt.equals=Qt.eq=function(t){return 0===this.cmp(t)},Qt.floor=function(){return oe(new this.constructor(this),this.e+1,3)},Qt.greaterThan=Qt.gt=function(t){return this.cmp(t)>0},Qt.greaterThanOrEqualTo=Qt.gte=function(t){var e=this.cmp(t);return 1==e||0===e},Qt.hyperbolicCosine=Qt.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?e=(1/ve(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),o=_e(s,1,o.times(e),new s(1),!0);for(var u,c=t,d=new s(8);c--;)u=o.times(o),o=a.minus(u.times(d.minus(u.times(d))));return oe(o,s.precision=n,s.rounding=r,!0)},Qt.hyperbolicSine=Qt.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=_e(o,2,i,i,!0);else{t=(t=1.4*Math.sqrt(r))>16?16:0|t,i=_e(o,2,i=i.times(1/ve(5,t)),i,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=n,oe(i,e,n,!0)},Qt.hyperbolicTangent=Qt.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,ie(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},Qt.inverseCosine=Qt.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?e.isNeg()?ce(n,i,o):new n(0):new n(NaN):e.isZero()?ce(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=ce(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))},Qt.inverseHyperbolicCosine=Qt.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,Ct=!1,n=n.times(n).minus(1).sqrt().plus(n),Ct=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)},Qt.inverseHyperbolicSine=Qt.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,Ct=!1,n=n.times(n).plus(1).sqrt().plus(n),Ct=!0,r.precision=t,r.rounding=e,n.ln())},Qt.inverseHyperbolicTangent=Qt.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?oe(new o(i),t,e,!0):(o.precision=n=r-i.e,i=ie(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)},Qt.inverseSine=Qt.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==e?0===e?((t=ce(o,n+4,r).times(.5)).s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},Qt.inverseTangent=Qt.atan=function(){var t,e,n,r,i,o,s,a,u,c=this,d=c.constructor,l=d.precision,h=d.rounding;if(c.isFinite()){if(c.isZero())return new d(c);if(c.abs().eq(1)&&l+4<=Jt)return(s=ce(d,l+4,h).times(.25)).s=c.s,s}else{if(!c.s)return new d(NaN);if(l+4<=Jt)return(s=ce(d,l+4,h).times(.5)).s=c.s,s}for(d.precision=a=l+10,d.rounding=1,t=n=Math.min(28,a/Zt+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Ct=!1,e=Math.ceil(a/Zt),r=1,u=c.times(c),s=new d(c),i=c;-1!==t;)if(i=i.times(u),o=s.minus(i.div(r+=2)),i=i.times(u),void 0!==(s=o.plus(i.div(r+=2))).d[e])for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<this.d.length-2},Qt.isNaN=function(){return!this.s},Qt.isNegative=Qt.isNeg=function(){return this.s<0},Qt.isPositive=Qt.isPos=function(){return this.s>0},Qt.isZero=function(){return!!this.d&&0===this.d[0]},Qt.lessThan=Qt.lt=function(t){return this.cmp(t)<0},Qt.lessThanOrEqualTo=Qt.lte=function(t){return this.cmp(t)<1},Qt.logarithm=Qt.log=function(t){var e,n,r,i,o,s,a,u,c=this,d=c.constructor,l=d.precision,h=d.rounding;if(null==t)t=new d(10),e=!0;else{if(n=(t=new d(t)).d,t.s<0||!n||!n[0]||t.eq(1))return new d(NaN);e=t.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new d(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(Ct=!1,s=ge(c,a=l+5),r=e?ue(d,a+10):ge(t,a),ne((u=ie(s,r,a,1)).d,i=l,h))do{if(s=ge(c,a+=10),r=e?ue(d,a+10):ge(t,a),u=ie(s,r,a,1),!o){+te(u.d).slice(i+1,i+15)+1==1e14&&(u=oe(u,l+1,0));break}}while(ne(u.d,i+=10,h));return Ct=!0,oe(u,l,h)},Qt.minus=Qt.sub=function(t){var e,n,r,i,o,s,a,u,c,d,l,h,f=this,p=f.constructor;if(t=new p(t),!f.d||!t.d)return f.s&&t.s?f.d?t.s=-t.s:t=new p(t.d||f.s!==t.s?f:NaN):t=new p(NaN),t;if(f.s!=t.s)return t.s=-t.s,f.plus(t);if(c=f.d,h=t.d,a=p.precision,u=p.rounding,!c[0]||!h[0]){if(h[0])t.s=-t.s;else{if(!c[0])return new p(3===u?-0:0);t=new p(f)}return Ct?oe(t,a,u):t}if(n=Ft(t.e/Zt),d=Ft(f.e/Zt),c=c.slice(),o=d-n){for((l=o<0)?(e=c,o=-o,s=h.length):(e=h,n=d,s=c.length),o>(r=Math.max(Math.ceil(a/Zt),s)+2)&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for((l=(r=c.length)<(s=h.length))&&(s=r),r=0;r0;--r)c[s++]=0;for(r=h.length;r>o;){if(c[--r](s=(o=Math.ceil(a/Zt))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=c.length)-(i=d.length)<0&&(i=s,n=d,d=c,c=n),e=0;i;)e=(c[--i]=c[i]+d[i]+e)/Gt|0,c[i]%=Gt;for(e&&(c.unshift(e),++r),s=c.length;0==c[--s];)c.pop();return t.d=c,t.e=ae(c,r),Ct?oe(t,a,u):t},Qt.precision=Qt.sd=function(t){var e,n=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(zt+t);return n.d?(e=de(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},Qt.round=function(){var t=this,e=t.constructor;return oe(new e(t),t.e+1,e.rounding)},Qt.sine=Qt.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+Zt,r.rounding=1,n=function(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:_e(t,2,e,e);n=(n=1.4*Math.sqrt(r))>16?16:0|n,e=_e(t,2,e=e.times(1/ve(5,n)),e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}(r,ke(r,n)),r.precision=t,r.rounding=e,oe(Pt>2?n.neg():n,t,e,!0)):new r(NaN)},Qt.squareRoot=Qt.sqrt=function(){var t,e,n,r,i,o,s=this,a=s.d,u=s.e,c=s.s,d=s.constructor;if(1!==c||!a||!a[0])return new d(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);for(Ct=!1,0==(c=Math.sqrt(+s))||c==1/0?(((e=te(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=Ft((u+1)/2)-(u<0||u%2),r=new d(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new d(c.toString()),n=(u=d.precision)+3;;)if(r=(o=r).plus(ie(s,o,n+2,1)).times(.5),te(o.d).slice(0,n)===(e=te(r.d)).slice(0,n)){if("9999"!=(e=e.slice(n-3,n+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(oe(r,u+1,1),t=!r.times(r).eq(s));break}if(!i&&(oe(o,u+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}return Ct=!0,oe(r,u,d.rounding,t)},Qt.tangent=Qt.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,(n=n.sin()).s=1,n=ie(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,oe(2==Pt||4==Pt?n.neg():n,t,e,!0)):new r(NaN)},Qt.times=Qt.mul=function(t){var e,n,r,i,o,s,a,u,c,d=this,l=d.constructor,h=d.d,f=(t=new l(t)).d;if(t.s*=d.s,!(h&&h[0]&&f&&f[0]))return new l(!t.s||h&&!h[0]&&!f||f&&!f[0]&&!h?NaN:h&&f?0*t.s:t.s/0);for(n=Ft(d.e/Zt)+Ft(t.e/Zt),(u=h.length)<(c=f.length)&&(o=h,h=f,f=o,s=u,u=c,c=s),o=[],r=s=u+c;r--;)o.push(0);for(r=c;--r>=0;){for(e=0,i=u+r;i>r;)a=o[i]+f[r]*h[i-r-1]+e,o[i--]=a%Gt|0,e=a/Gt|0;o[i]=(o[i]+e)%Gt|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=ae(o,n),Ct?oe(t,l.precision,l.rounding):t},Qt.toBinary=function(t,e){return Me(this,2,t,e)},Qt.toDecimalPlaces=Qt.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),void 0===t?n:(ee(t,0,Lt),void 0===e?e=r.rounding:ee(e,0,8),oe(n,t+n.e+1,e))},Qt.toExponential=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=se(r,!0):(ee(t,0,Lt),void 0===e?e=i.rounding:ee(e,0,8),n=se(r=oe(new i(r),t+1,e),!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},Qt.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return void 0===t?n=se(i):(ee(t,0,Lt),void 0===e?e=o.rounding:ee(e,0,8),n=se(r=oe(new o(i),t+i.e+1,e),!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},Qt.toFraction=function(t){var e,n,r,i,o,s,a,u,c,d,l,h,f=this,p=f.d,m=f.constructor;if(!p)return new m(f);if(c=n=new m(1),r=u=new m(0),s=(o=(e=new m(r)).e=de(p)-f.e-1)%Zt,e.d[0]=Wt(10,s<0?Zt+s:s),null==t)t=o>0?e:c;else{if(!(a=new m(t)).isInt()||a.lt(c))throw Error(zt+a);t=a.gt(e)?o>0?e:c:a}for(Ct=!1,a=new m(te(p)),d=m.precision,m.precision=o=p.length*Zt*2;l=ie(a,e,0,1,1),1!=(i=n.plus(l.times(r))).cmp(t);)n=r,r=i,i=c,c=u.plus(l.times(i)),u=i,i=e,e=a.minus(l.times(i)),a=i;return i=ie(t.minus(n),r,0,1,1),u=u.plus(i.times(c)),n=n.plus(i.times(r)),u.s=c.s=f.s,h=ie(c,r,o,1).minus(f).abs().cmp(ie(u,n,o,1).minus(f).abs())<1?[c,r]:[u,n],m.precision=d,Ct=!0,h},Qt.toHexadecimal=Qt.toHex=function(t,e){return Me(this,16,t,e)},Qt.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),null==t){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),void 0===e?e=r.rounding:ee(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(Ct=!1,n=ie(n,t,0,e,1).times(t),Ct=!0,oe(n)):(t.s=n.s,n=t),n},Qt.toNumber=function(){return+this},Qt.toOctal=function(t,e){return Me(this,8,t,e)},Qt.toPower=Qt.pow=function(t){var e,n,r,i,o,s,a=this,u=a.constructor,c=+(t=new u(t));if(!(a.d&&t.d&&a.d[0]&&t.d[0]))return new u(Wt(+a,c));if((a=new u(a)).eq(1))return a;if(r=u.precision,o=u.rounding,t.eq(1))return oe(a,r,o);if((e=Ft(t.e/Zt))>=t.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=he(u,a,n,r),t.s<0?new u(1).div(i):oe(i,r,o);if((s=a.s)<0){if(eu.maxE+1||e0?s/0:0):(Ct=!1,u.rounding=a.s=1,n=Math.min(12,(e+"").length),(i=me(t.times(ge(a,r+n)),r)).d&&ne((i=oe(i,r+5,1)).d,r,o)&&(e=r+10,+te((i=oe(me(t.times(ge(a,e+n)),e),e+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=oe(i,r+1,0))),i.s=s,Ct=!0,u.rounding=o,oe(i,r,o))},Qt.toPrecision=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=se(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(ee(t,1,Lt),void 0===e?e=i.rounding:ee(e,0,8),n=se(r=oe(new i(r),t,e),t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},Qt.toSignificantDigits=Qt.toSD=function(t,e){var n=this.constructor;return void 0===t?(t=n.precision,e=n.rounding):(ee(t,1,Lt),void 0===e?e=n.rounding:ee(e,0,8)),oe(new n(this),t,e)},Qt.toString=function(){var t=this,e=t.constructor,n=se(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},Qt.truncated=Qt.trunc=function(){return oe(new this.constructor(this),this.e+1,1)},Qt.valueOf=Qt.toJSON=function(){var t=this,e=t.constructor,n=se(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};var ie=function(){function t(t,e,n){var r,i=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+i,t[o]=r%n|0,i=r/n|0;return i&&t.unshift(i),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;)t.shift()}return function(r,i,o,s,a,u){var c,d,l,h,f,p,m,g,y,b,w,_,v,k,M,A,S,I,x,E,T=r.constructor,P=r.s==i.s?1:-1,B=r.d,L=i.d;if(!(B&&B[0]&&L&&L[0]))return new T(r.s&&i.s&&(B?!L||B[0]!=L[0]:L)?B&&0==B[0]||!L?0*P:P/0:NaN);for(u?(f=1,d=r.e-i.e):(u=Gt,f=Zt,d=Ft(r.e/f)-Ft(i.e/f)),x=L.length,S=B.length,b=(y=new T(P)).d=[],l=0;L[l]==(B[l]||0);l++);if(L[l]>(B[l]||0)&&d--,null==o?(k=o=T.precision,s=T.rounding):k=a?o+(r.e-i.e)+1:o,k<0)b.push(1),p=!0;else{if(k=k/f+2|0,l=0,1==x){for(h=0,L=L[0],k++;(l1&&(L=t(L,h,u),B=t(B,h,u),x=L.length,S=B.length),A=x,_=(w=B.slice(0,x)).length;_=u/2&&++I;do{h=0,(c=e(L,w,x,_))<0?(v=w[0],x!=_&&(v=v*u+(w[1]||0)),(h=v/I|0)>1?(h>=u&&(h=u-1),1==(c=e(m=t(L,h,u),w,g=m.length,_=w.length))&&(h--,n(m,x=10;h/=10)l++;y.e=l+d*f-1,oe(y,a?o+y.e+1:o,s,p)}return y}}();function oe(t,e,n,r){var i,o,s,a,u,c,d,l,h,f=t.constructor;t:if(null!=e){if(!(l=t.d))return t;for(i=1,a=l[0];a>=10;a/=10)i++;if((o=e-i)<0)o+=Zt,s=e,u=(d=l[h=0])/Wt(10,i-s-1)%10|0;else if((h=Math.ceil((o+1)/Zt))>=(a=l.length)){if(!r)break t;for(;a++<=h;)l.push(0);d=u=0,i=1,s=(o%=Zt)-Zt+1}else{for(d=a=l[h],i=1;a>=10;a/=10)i++;u=(s=(o%=Zt)-Zt+i)<0?0:d/Wt(10,i-s-1)%10|0}if(r=r||e<0||void 0!==l[h+1]||(s<0?d:d%Wt(10,i-s-1)),c=n<4?(u||r)&&(0==n||n==(t.s<0?3:2)):u>5||5==u&&(4==n||r||6==n&&(o>0?s>0?d/Wt(10,i-s):0:l[h-1])%10&1||n==(t.s<0?8:7)),e<1||!l[0])return l.length=0,c?(e-=t.e+1,l[0]=Wt(10,(Zt-e%Zt)%Zt),t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=h,a=1,h--):(l.length=h+1,a=Wt(10,Zt-o),l[h]=s>0?(d/Wt(10,i-s)%Wt(10,s)|0)*a:0),c)for(;;){if(0==h){for(o=1,s=l[0];s>=10;s/=10)o++;for(s=l[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,l[0]==Gt&&(l[0]=1));break}if(l[h]+=a,l[h]!=Gt)break;l[h--]=0,a=1}for(o=l.length;0===l[--o];)l.pop()}return Ct&&(t.e>f.maxE?(t.d=null,t.e=NaN):t.e0?o=o.charAt(0)+"."+o.slice(1)+le(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+le(-i-1)+o,n&&(r=n-s)>0&&(o+=le(r))):i>=s?(o+=le(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+le(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=le(r))),o}function ae(t,e){var n=t[0];for(e*=Zt;n>=10;n/=10)e++;return e}function ue(t,e,n){if(e>Xt)throw Ct=!0,n&&(t.precision=n),Error(Ut);return oe(new t(Rt),e,1,!0)}function ce(t,e,n){if(e>Jt)throw Error(Ut);return oe(new t(Ot),e,n,!0)}function de(t){var e=t.length-1,n=e*Zt+1;if(e=t[e]){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function le(t){for(var e="";t--;)e+="0";return e}function he(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/Zt+4);for(Ct=!1;;){if(n%2&&Ae((o=o.times(e)).d,s)&&(i=!0),0===(n=Ft(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}Ae((e=e.times(e)).d,s)}return Ct=!0,o}function fe(t){return 1&t.d[t.d.length-1]}function pe(t,e,n){for(var r,i=new t(e[0]),o=0;++o17)return new h(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(Ct=!1,u=p):u=e,a=new h(.03125);t.e>-2;)t=t.times(a),l+=5;for(u+=r=Math.log(Wt(2,l))/Math.LN10*2+5|0,n=o=s=new h(1),h.precision=u;;){if(o=oe(o.times(t),u,1),n=n.times(++d),te((a=s.plus(ie(o,n,u,1))).d).slice(0,u)===te(s.d).slice(0,u)){for(i=l;i--;)s=oe(s.times(s),u,1);if(null!=e)return h.precision=p,s;if(!(c<3&&ne(s.d,u-r,f,c)))return oe(s,h.precision=p,f,Ct=!0);h.precision=u+=10,n=o=a=new h(1),d=0,c++}s=a}}function ge(t,e){var n,r,i,o,s,a,u,c,d,l,h,f=1,p=t,m=p.d,g=p.constructor,y=g.rounding,b=g.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==e?(Ct=!1,d=b):d=e,g.precision=d+=10,r=(n=te(m)).charAt(0),!(Math.abs(o=p.e)<15e14))return c=ue(g,d+2,b).times(o+""),p=ge(new g(r+"."+n.slice(1)),d-10).plus(c),g.precision=b,null==e?oe(p,b,y,Ct=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=te((p=p.times(t)).d)).charAt(0),f++;for(o=p.e,r>1?(p=new g("0."+n),o++):p=new g(r+"."+n.slice(1)),l=p,u=s=p=ie(p.minus(1),p.plus(1),d,1),h=oe(p.times(p),d,1),i=3;;){if(s=oe(s.times(h),d,1),te((c=u.plus(ie(s,new g(i),d,1))).d).slice(0,d)===te(u.d).slice(0,d)){if(u=u.times(2),0!==o&&(u=u.plus(ue(g,d+2,b).times(o+""))),u=ie(u,new g(f),d,1),null!=e)return g.precision=b,u;if(!ne(u.d,d-10,y,a))return oe(u,g.precision=b,y,Ct=!0);g.precision=d+=10,c=s=p=ie(l.minus(1),l.plus(1),d,1),h=oe(p.times(p),d,1),i=a=1}u=c,i+=2}}function ye(t){return String(t.s*t.s/0)}function be(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;48===e.charCodeAt(r);r++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(r,i)){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%Zt,n<0&&(r+=Zt),rt.constructor.maxE?(t.d=null,t.e=NaN):t.e-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Vt.test(e))return be(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Kt.test(e))n=16,e=e.toLowerCase();else if(Ht.test(e))n=2;else{if(!qt.test(e))throw Error(zt+e);n=8}for((o=e.search(/p/i))>0?(u=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),s=(o=e.indexOf("."))>=0,r=t.constructor,s&&(o=(a=(e=e.replace(".","")).length)-o,i=he(r,new r(n),o,2*o)),o=d=(c=re(e,n,Gt)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*t.s):(t.e=ae(c,d),t.d=c,Ct=!1,s&&(t=ie(t,i,4*a)),u&&(t=t.times(Math.abs(u)<54?Wt(2,u):hn.pow(2,u))),Ct=!0,t)}function _e(t,e,n,r,i){var o,s,a,u,c=t.precision,d=Math.ceil(c/Zt);for(Ct=!1,u=n.times(n),a=new t(r);;){if(s=ie(a.times(u),new t(e++*e++),c,1),a=i?r.plus(s):r.minus(s),r=ie(s.times(u),new t(e++*e++),c,1),void 0!==(s=a.plus(r)).d[d]){for(o=d;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=r,r=s,s=o}return Ct=!0,s.d.length=d+1,s}function ve(t,e){for(var n=t;--e;)n*=t;return n}function ke(t,e){var n,r=e.s<0,i=ce(t,t.precision,1),o=i.times(.5);if((e=e.abs()).lte(o))return Pt=r?4:1,e;if((n=e.divToInt(i)).isZero())Pt=r?3:2;else{if((e=e.minus(n.times(i))).lte(o))return Pt=fe(n)?r?2:3:r?4:1,e;Pt=fe(n)?r?1:4:r?3:2}return e.minus(i).abs()}function Me(t,e,n,r){var i,o,s,a,u,c,d,l,h,f=t.constructor,p=void 0!==n;if(p?(ee(n,1,Lt),void 0===r?r=f.rounding:ee(r,0,8)):(n=f.precision,r=f.rounding),t.isFinite()){for(p?(i=2,16==e?n=4*n-3:8==e&&(n=3*n-2)):i=e,(s=(d=se(t)).indexOf("."))>=0&&(d=d.replace(".",""),(h=new f(1)).e=d.length-s,h.d=re(se(h),10,i),h.e=h.d.length),o=u=(l=re(d,10,i)).length;0==l[--u];)l.pop();if(l[0]){if(s<0?o--:((t=new f(t)).d=l,t.e=o,l=(t=ie(t,h,n,r,0,i)).d,o=t.e,c=Tt),s=l[n],a=i/2,c=c||void 0!==l[n+1],c=r<4?(void 0!==s||c)&&(0===r||r===(t.s<0?3:2)):s>a||s===a&&(4===r||c||6===r&&1&l[n-1]||r===(t.s<0?8:7)),l.length=n,c)for(;++l[--n]>i-1;)l[n]=0,n||(++o,l.unshift(1));for(u=l.length;!l[u-1];--u);for(s=0,d="";s1)if(16==e||8==e){for(s=16==e?4:3,--u;u%s;u++)d+="0";for(u=(l=re(d,i,e)).length;!l[u-1];--u);for(s=1,d="1.";su)for(o-=u;o--;)d+="0";else oe)return t.length=e,!0}function Se(t){return new this(t).abs()}function Ie(t){return new this(t).acos()}function xe(t){return new this(t).acosh()}function Ee(t,e){return new this(t).plus(e)}function Te(t){return new this(t).asin()}function Pe(t){return new this(t).asinh()}function Be(t){return new this(t).atan()}function Le(t){return new this(t).atanh()}function $e(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(n=e.s<0?ce(this,r,i):new this(0)).s=t.s:!t.d||e.isZero()?(n=ce(this,o,1).times(.5)).s=t.s:e.s<0?(this.precision=o,this.rounding=1,n=this.atan(ie(t,e,o,1)),e=ce(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(ie(t,e,o,1)):(n=ce(this,o,1).times(e.s>0?.25:.75)).s=t.s:n=new this(NaN),n}function Re(t){return new this(t).cbrt()}function Oe(t){return oe(t=new this(t),t.e+1,2)}function De(t,e,n){return new this(t).clamp(e,n)}function Ce(t){if(!t||"object"!=typeof t)throw Error(Nt+"Object expected");var e,n,r,i=!0===t.defaults,o=["precision",1,Lt,"rounding",0,8,"toExpNeg",-Bt,0,"toExpPos",0,Bt,"maxE",0,Bt,"minE",-Bt,0,"modulo",0,9];for(e=0;e=o[e+1]&&r<=o[e+2]))throw Error(zt+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=Dt[n]),void 0!==(r=t[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(zt+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(jt);this[n]=!0}else this[n]=!1}return this}function Ne(t){return new this(t).cos()}function ze(t){return new this(t).cosh()}function Ue(t,e){return new this(t).div(e)}function je(t){return new this(t).exp()}function Ye(t){return oe(t=new this(t),t.e+1,3)}function Fe(){var t,e,n=new this(0);for(Ct=!1,t=0;t=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(jt);for(e=crypto.randomBytes(r*=4);o=214e7?crypto.randomBytes(4).copy(e,o):(a.push(i%1e7),o+=4);o=r/4}else for(;o=10;i/=10)r++;ro.maxE?(i.e=NaN,i.d=null):t.e=10;n/=10)e++;return void(Ct?e>o.maxE?(i.e=NaN,i.d=null):e`"${t}": ${JSON.stringify(e,null,4)}`)).join(",\n"):null}function En(t,e){return t.symbolAe.symbolA?1:t.symbolBe.symbolB?1:t.tickSpacinge.tickSpacing?1:0}let Tn=null,Pn=null;const Bn="https://api.mainnet.orca.so/v1/token/list";class Ln{constructor(t){this.tokenList=t,this.tokenMintMap=new Map;for(const e of t)this.tokenMintMap.set(e.mint.toBase58(),e)}getTokenInfoByMint(t){return this.tokenMintMap.get(t.toString())}}let $n=null;async function Rn(){if($n)return $n;const t=await(await mn()(Bn)).json(),e=[];return t.tokens.forEach((t=>{e.push({mint:new Mt.PublicKey(t.mint),symbol:zn(t.symbol,t.mint),name:zn(t.name,t.mint),decimals:t.decimals,logoURI:t.logoURI,coingeckoId:t.coingeckoId,whitelisted:t.whitelisted,poolToken:t.poolToken})})),e.sort(((t,e)=>t.symbol.localeCompare(e.symbol))),$n=new Ln(e),$n}const On="https://api.orca.so/configs";class Dn{constructor(t,e,n){this.pools=t,this.aquafarms=e,this.doubledips=n,this.poolAddressMap=new Map;for(const e of t)this.poolAddressMap.set(e.account.toBase58(),e).set(e.poolTokenMint.toBase58(),e);this.aquafarmAddressMap=new Map;for(const t of e)this.aquafarmAddressMap.set(t.account.toBase58(),t).set(t.baseTokenMint.toBase58(),t).set(t.farmTokenMint.toBase58(),t);this.doubledipAddressMap=new Map;for(const t of n)this.doubledipAddressMap.set(t.account.toBase58(),t).set(t.baseTokenMint.toBase58(),t).set(t.farmTokenMint.toBase58(),t);this.tuples=[];for(const t of this.pools){const e=this.getAquaFarmByAddress(t.poolTokenMint),n=this.getDoubleDipByAddress(null==e?void 0:e.farmTokenMint);this.tuples.push({pool:t,aquafarm:e,doubledip:n})}this.tuples.sort(((t,e)=>t.pool.name.localeCompare(e.pool.name)))}getPoolByAddress(t){if(t)return this.poolAddressMap.get(t.toString())}getAquaFarmByAddress(t){if(t)return this.aquafarmAddressMap.get(t.toString())}getDoubleDipByAddress(t){if(t)return this.doubledipAddressMap.get(t.toString())}}let Cn=null;async function Nn(){if(Cn)return Cn;const t=await(await mn()(On)).json(),e=[];Object.keys(t.pools).forEach((n=>{var r;const i=t.pools[n];e.push({name:n,account:new Mt.PublicKey(i.account),authority:new Mt.PublicKey(i.authority),nonce:i.nonce,poolTokenMint:new Mt.PublicKey(i.poolTokenMint),tokenAccountA:new Mt.PublicKey(i.tokenAccountA),tokenAccountB:new Mt.PublicKey(i.tokenAccountB),feeAccount:new Mt.PublicKey(i.feeAccount),feeNumerator:i.feeNumerator,feeDenominator:i.feeDenominator,ownerTradeFeeNumerator:i.ownerTradeFeeNumerator,ownerTradeFeeDenominator:i.ownerTradeFeeDenominator,ownerWithdrawFeeNumerator:i.ownerWithdrawFeeNumerator,ownerWithdrawFeeDenominator:i.ownerWithdrawFeeDenominator,hostFeeNumerator:i.hostFeeNumerator,hostFeeDenominator:i.hostFeeDenominator,tokenAName:i.tokenAName,tokenBName:i.tokenBName,curveType:"ConstantProduct"===i.curveType?"ConstantProduct":"Stable",deprecated:null!==(r=i.deprecated)&&void 0!==r&&r})}));const n=[];Object.keys(t.aquafarms).forEach((e=>{const r=t.aquafarms[e];n.push({account:new Mt.PublicKey(r.account),nonce:r.nonce,tokenProgramId:new Mt.PublicKey(r.tokenProgramId),emissionsAuthority:new Mt.PublicKey(r.emissionsAuthority),removeRewardsAuthority:new Mt.PublicKey(r.removeRewardsAuthority),baseTokenMint:new Mt.PublicKey(r.baseTokenMint),baseTokenVault:new Mt.PublicKey(r.baseTokenVault),rewardTokenMint:new Mt.PublicKey(r.rewardTokenMint),rewardTokenVault:new Mt.PublicKey(r.rewardTokenVault),farmTokenMint:new Mt.PublicKey(r.farmTokenMint)})}));const r=[];Object.keys(t.doubleDips).forEach((e=>{const n=t.doubleDips[e];r.push({account:new Mt.PublicKey(n.account),nonce:n.nonce,tokenProgramId:new Mt.PublicKey(n.tokenProgramId),emissionsAuthority:new Mt.PublicKey(n.emissionsAuthority),removeRewardsAuthority:new Mt.PublicKey(n.removeRewardsAuthority),baseTokenMint:new Mt.PublicKey(n.baseTokenMint),baseTokenVault:new Mt.PublicKey(n.baseTokenVault),rewardTokenMint:new Mt.PublicKey(n.rewardTokenMint),rewardTokenVault:new Mt.PublicKey(n.rewardTokenVault),farmTokenMint:new Mt.PublicKey(n.farmTokenMint),dateStart:n.dateStart,dateEnd:n.dateEnd,totalEmissions:n.totalEmissions})}));const i=new Dn(e,n,r);return Cn=i,i}function zn(t,e){return(null==t?void 0:t.trim())||`❓(${kn(e,4)})`}function Un(t){let e;return{c(){e=S(t[0])},m(t,n){v(t,e,n)},p(t,n){1&n&&B(e,t[0])},d(t){t&&k(e)}}}function jn(t){let e,n,r,i,s,a,u,c,d;function l(t,e){return t[1]?Fn:Yn}let h=l(t),f=h(t),p=("token2022/mint"===t[3]||"token2022/account"===t[3])&&Wn(),m=t[4]&&!t[4].poolToken&&Hn(t),g=t[0]&&Kn(t);return{c(){e=S("📘\n"),n=A("span"),r=A("a"),f.c(),i=I(),p&&p.c(),s=I(),m&&m.c(),a=I(),u=A("span"),g&&g.c(),P(r,"href",t[10]),P(r,"class","svelte-1ugqnji"),$(u,"visibility","hidden"),$(n,"cursor","pointer")},m(o,l){v(o,e,l),v(o,n,l),_(n,r),f.m(r,null),_(r,i),p&&p.m(r,null),_(r,s),m&&m.m(r,null),_(n,a),_(n,u),g&&g.m(u,null),t[12](u),c||(d=[E(n,"mouseenter",t[13]),E(n,"mouseleave",t[14])],c=!0)},p(t,e){h===(h=l(t))&&f?f.p(t,e):(f.d(1),f=h(t),f&&(f.c(),f.m(r,i))),"token2022/mint"===t[3]||"token2022/account"===t[3]?p||(p=Wn(),p.c(),p.m(r,s)):p&&(p.d(1),p=null),t[4]&&!t[4].poolToken?m?m.p(t,e):(m=Hn(t),m.c(),m.m(r,null)):m&&(m.d(1),m=null),t[0]?g?g.p(t,e):(g=Kn(t),g.c(),g.m(u,null)):g&&(g.d(1),g=null)},d(r){r&&k(e),r&&k(n),f.d(),p&&p.d(),m&&m.d(),g&&g.d(),t[12](null),c=!1,o(d)}}}function Yn(t){let e,n;return{c(){e=A("span"),n=S(t[0])},m(t,r){v(t,e,r),_(e,n)},p(t,e){1&e&&B(n,t[0])},d(t){t&&k(e)}}}function Fn(t){let e,n,r=kn(t[0],t[2])+"";return{c(){e=A("span"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){5&e&&r!==(r=kn(t[0],t[2])+"")&&B(n,r)},d(t){t&&k(e)}}}function Wn(t){let e;return{c(){e=S("[2022]")},m(t,n){v(t,e,n)},d(t){t&&k(e)}}}function Hn(t){let e,n,r,i=t[4].symbol+"";return{c(){e=S("("),n=S(i),r=S(")")},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,e){16&e&&i!==(i=t[4].symbol+"")&&B(n,i)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Kn(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m;return{c(){e=A("a"),n=S("🔍"),i=I(),o=A("a"),s=S("📻"),u=I(),c=A("a"),d=S("🪣"),h=I(),f=A("span"),f.textContent="📎",P(e,"target","_blank"),P(e,"rel","noreferrer"),P(e,"href",r=t[7](t[0])),P(e,"class","svelte-1ugqnji"),P(o,"target","_blank"),P(o,"rel","noreferrer"),P(o,"href",a=t[8](t[0])),P(o,"class","svelte-1ugqnji"),P(c,"href",l="#/generic/"+t[0]),P(c,"class","svelte-1ugqnji")},m(r,a){v(r,e,a),_(e,n),v(r,i,a),v(r,o,a),_(o,s),v(r,u,a),v(r,c,a),_(c,d),v(r,h,a),v(r,f,a),t[11](f),p||(m=E(f,"click",t[9]),p=!0)},p(t,n){1&n&&r!==(r=t[7](t[0]))&&P(e,"href",r),1&n&&a!==(a=t[8](t[0]))&&P(o,"href",a),1&n&&l!==(l="#/generic/"+t[0])&&P(c,"href",l)},d(n){n&&k(e),n&&k(i),n&&k(o),n&&k(u),n&&k(c),n&&k(h),n&&k(f),t[11](null),p=!1,m()}}}function qn(e){let n;function r(t,e){return t[0]?jn:Un}let i=r(e),o=i(e);return{c(){o.c(),n=x()},m(t,e){o.m(t,e),v(t,n,e)},p(t,[e]){i===(i=r(t))&&o?o.p(t,e):(o.d(1),o=i(t),o&&(o.c(),o.m(n.parentNode,n)))},i:t,o:t,d(t){o.d(t),t&&k(n)}}}function Vn(t,e,n){let r,i,o,{address:s}=e,{short:a=!1}=e,{length:u=5}=e,{type:c="generic"}=e;Rn().then((t=>{n(4,r=t.getTokenInfoByMint(s))}));let d=`#/${c}/${s}`;return t.$$set=t=>{"address"in t&&n(0,s=t.address),"short"in t&&n(1,a=t.short),"length"in t&&n(2,u=t.length),"type"in t&&n(3,c=t.type)},[s,a,u,c,r,i,o,function(t){if(!t)return"";const e=Et();let n="";return"devnet"===e.network&&(n="?cluster=devnet"),"localnet"===e.network&&(n=`?cluster=custom&customUrl=${e.url}`),e.network,`https://solscan.io/account/${t.toString()}${n}`},function(t){if(!t)return"";const e=Et();let n="";return"devnet"===e.network&&(n="?cluster=devnet-solana"),e.network,e.network,`https://solana.fm/address/${t.toString()}${n}`},function(){navigator.clipboard.writeText(s.toString()),n(6,o.textContent="✅",o),setTimeout((()=>n(6,o.textContent="📎",o)),1e3)},d,function(t){j[t?"unshift":"push"]((()=>{o=t,n(6,o)}))},function(t){j[t?"unshift":"push"]((()=>{i=t,n(5,i)}))},()=>i.style.setProperty("visibility","visible"),()=>i.style.setProperty("visibility","hidden")]}const Gn=class extends gt{constructor(t){super(),mt(this,t,Vn,qn,a,{address:0,short:1,length:2,type:3})}};async function Zn(t,e){const n=await t.getAccountInfoAndContext(e);return{accountInfo:n.value,slotContext:n.context.slot}}function Xn(t,e,n){return Object.assign({slotContext:n,pubkey:t},e)}function Jn(t,e){return new fn(t.toFixed(e))}function Qn(t){return bn.DecimalUtil.toBN(new fn(t.toString()),0)}function tr(t,e){var n;const r=e?{slotContext:t.slotContext}:{};return Object.assign({pubkey:t.pubkey.toBase58(),account:{executable:t.executable,lamports:t.lamports,owner:t.owner.toBase58(),rentEpoch:null!==(n=t.rentEpoch)&&void 0!==n?n:0,data:[t.data.toString("base64"),"base64"]}},r)}function er(t){return 3480*(128+t)*2}function nr(t){const e=JSON.stringify(t);return new Blob([e],{type:"application/json"})}function rr(t,e){const n=document.createElement("a");n.href=URL.createObjectURL(t),n.download=e,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}function ir(e){let n,r,i,o;return{c(){n=A("button"),r=S(e[2]),n.disabled=e[1],P(n,"style",e[3])},m(t,a){v(t,n,a),_(n,r),i||(o=E(n,"click",(function(){s(e[0])&&e[0].apply(this,arguments)})),i=!0)},p(t,[i]){e=t,4&i&&B(r,e[2]),2&i&&(n.disabled=e[1]),8&i&&P(n,"style",e[3])},i:t,o:t,d(t){t&&k(n),i=!1,o()}}}function or(t,e,n){let r,{download:i}=e,{disabled:o=!1}=e,{label:s="Download JSON!"}=e,{width:a}=e;return t.$$set=t=>{"download"in t&&n(0,i=t.download),"disabled"in t&&n(1,o=t.disabled),"label"in t&&n(2,s=t.label),"width"in t&&n(4,a=t.width)},t.$$.update=()=>{16&t.$$.dirty&&n(3,r=a?`width: ${a}px;`:"")},[i,o,s,r,a]}const sr=class extends gt{constructor(t){super(),mt(this,t,or,ir,a,{download:0,disabled:1,label:2,width:4})}};function ar(t){let e,n;return e=new Gn({props:{type:t[1],address:t[0].pubkey}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.type=t[1]),1&n&&(r.address=t[0].pubkey),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ur(t){let e,n;return e=new Gn({props:{address:t[0].owner}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};1&n&&(r.address=t[0].owner),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function cr(t){let e,n,r,i,o,s,a,u,c=t[0].lamports+"",d=vn(t[0].lamports)+"",l=er(t[0].data.length)+"",h=t[0].lamports-er(t[0].data.length)+"";return{c(){e=S(c),n=S(" ("),r=S(d),i=S(" SOL) (Rent: "),o=S(l),s=S(", NotRent: "),a=S(h),u=S(")")},m(t,c){v(t,e,c),v(t,n,c),v(t,r,c),v(t,i,c),v(t,o,c),v(t,s,c),v(t,a,c),v(t,u,c)},p(t,n){1&n&&c!==(c=t[0].lamports+"")&&B(e,c),1&n&&d!==(d=vn(t[0].lamports)+"")&&B(r,d),1&n&&l!==(l=er(t[0].data.length)+"")&&B(o,l),1&n&&h!==(h=t[0].lamports-er(t[0].data.length)+"")&&B(a,h)},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(i),t&&k(o),t&&k(s),t&&k(a),t&&k(u)}}}function dr(t){let e,n=t[0].data.length+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){1&r&&n!==(n=t[0].data.length+"")&&B(e,n)},d(t){t&&k(e)}}}function lr(t){let e,n=t[0].executable+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){1&r&&n!==(n=t[0].executable+"")&&B(e,n)},d(t){t&&k(e)}}}function hr(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M=t[0].slotContext+"";return u=new vt({props:{name:"pubkey",type:"PublicKey",$$slots:{default:[ar]},$$scope:{ctx:t}}}),c=new vt({props:{name:"owner program",type:"PublicKey",$$slots:{default:[ur]},$$scope:{ctx:t}}}),d=new vt({props:{name:"lamports",type:"u64",$$slots:{default:[cr]},$$scope:{ctx:t}}}),f=new vt({props:{name:"data size",$$slots:{default:[dr]},$$scope:{ctx:t}}}),g=new vt({props:{name:"executable",$$slots:{default:[lr]},$$scope:{ctx:t}}}),b=new sr({props:{download:t[2]}}),{c(){e=A("h3"),n=S("🔖 Meta "),r=A("span"),i=S("slot "),o=S(M),s=I(),a=A("dl"),ht(u.$$.fragment),ht(c.$$.fragment),ht(d.$$.fragment),l=A("div"),h=A("span"),ht(f.$$.fragment),p=I(),m=A("span"),ht(g.$$.fragment),y=I(),ht(b.$$.fragment),$(r,"color","#999"),$(r,"font-size","small"),$(r,"font-weight","normal"),P(l,"class","col svelte-gqivmw"),$(a,"font-size","smaller")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(r,i),_(r,o),v(t,s,k),v(t,a,k),ft(u,a,null),ft(c,a,null),ft(d,a,null),_(a,l),_(l,h),ft(f,h,null),_(l,p),_(l,m),ft(g,m,null),v(t,y,k),ft(b,t,k),w=!0},p(t,[e]){(!w||1&e)&&M!==(M=t[0].slotContext+"")&&B(o,M);const n={};11&e&&(n.$$scope={dirty:e,ctx:t}),u.$set(n);const r={};9&e&&(r.$$scope={dirty:e,ctx:t}),c.$set(r);const i={};9&e&&(i.$$scope={dirty:e,ctx:t}),d.$set(i);const s={};9&e&&(s.$$scope={dirty:e,ctx:t}),f.$set(s);const a={};9&e&&(a.$$scope={dirty:e,ctx:t}),g.$set(a)},i(t){w||(ot(u.$$.fragment,t),ot(c.$$.fragment,t),ot(d.$$.fragment,t),ot(f.$$.fragment,t),ot(g.$$.fragment,t),ot(b.$$.fragment,t),w=!0)},o(t){st(u.$$.fragment,t),st(c.$$.fragment,t),st(d.$$.fragment,t),st(f.$$.fragment,t),st(g.$$.fragment,t),st(b.$$.fragment,t),w=!1},d(t){t&&k(e),t&&k(s),t&&k(a),pt(u),pt(c),pt(d),pt(f),pt(g),t&&k(y),pt(b,t)}}}function fr(t,e,n){let{meta:r}=e,{accountType:i}=e;return t.$$set=t=>{"meta"in t&&n(0,r=t.meta),"accountType"in t&&n(1,i=t.accountType)},[r,i,function(){const t=tr(r,!0),e=`${r.pubkey}.json`;rr(nr(t),e)}]}const pr=class extends gt{constructor(t){super(),mt(this,t,fr,hr,a,{meta:0,accountType:1})}};function mr(t){let e,n,r,i,o;const s=t[1].default,a=d(s,t,t[0],null);return{c(){e=A("div"),n=A("h3"),n.textContent="📖 Parsed",r=I(),i=A("dl"),a&&a.c(),$(i,"font-size","smaller"),$(e,"margin-right","5em")},m(t,s){v(t,e,s),_(e,n),_(e,r),_(e,i),a&&a.m(i,null),o=!0},p(t,[e]){a&&a.p&&(!o||1&e)&&f(a,s,t,t[0],o?h(s,t[0],e,null):p(t[0]),null)},i(t){o||(ot(a,t),o=!0)},o(t){st(a,t),o=!1},d(t){t&&k(e),a&&a.d(t)}}}function gr(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=t=>{"$$scope"in t&&n(0,i=t.$$scope)},[i,r]}const yr=class extends gt{constructor(t){super(),mt(this,t,gr,mr,a,{})}};function br(t){let e,n,r,i,o;const s=t[1].default,a=d(s,t,t[0],null);return{c(){e=A("div"),n=A("h3"),n.textContent="🧰 Derived",r=I(),i=A("dl"),a&&a.c(),$(i,"font-size","smaller")},m(t,s){v(t,e,s),_(e,n),_(e,r),_(e,i),a&&a.m(i,null),o=!0},p(t,[e]){a&&a.p&&(!o||1&e)&&f(a,s,t,t[0],o?h(s,t[0],e,null):p(t[0]),null)},i(t){o||(ot(a,t),o=!0)},o(t){st(a,t),o=!1},d(t){t&&k(e),a&&a.d(t)}}}function wr(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=t=>{"$$scope"in t&&n(0,i=t.$$scope)},[i,r]}const _r=class extends gt{constructor(t){super(),mt(this,t,wr,br,a,{})}};function vr(t){let e,n;const r=t[1].default,i=d(r,t,t[0],null);return{c(){e=A("div"),i&&i.c(),$(e,"display","flex"),$(e,"flex-wrap","wrap")},m(t,r){v(t,e,r),i&&i.m(e,null),n=!0},p(t,[e]){i&&i.p&&(!n||1&e)&&f(i,r,t,t[0],n?h(r,t[0],e,null):p(t[0]),null)},i(t){n||(ot(i,t),n=!0)},o(t){st(i,t),n=!1},d(t){t&&k(e),i&&i.d(t)}}}function kr(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=t=>{"$$scope"in t&&n(0,i=t.$$scope)},[i,r]}const Mr=class extends gt{constructor(t){super(),mt(this,t,kr,vr,a,{})}};function Ar(e){let n,r;return{c(){n=A("a"),r=S("🔡"),P(n,"target","_blank"),P(n,"rel","noreferrer"),P(n,"href",e[0]),$(n,"font-size","small"),$(n,"font-weight","normal"),$(n,"text-decoration","none")},m(t,e){v(t,n,e),_(n,r)},p(t,[e]){1&e&&P(n,"href",t[0])},i:t,o:t,d(t){t&&k(n)}}}function Sr(t,e,n){let{href:r}=e;return t.$$set=t=>{"href"in t&&n(0,r=t.href)},[r]}const Ir=class extends gt{constructor(t){super(),mt(this,t,Sr,Ar,a,{href:0})}},xr=[];function Er(t,e){return{subscribe:Tr(t,e).subscribe}}function Tr(e,n=t){let r;const i=new Set;function o(t){if(a(e,t)&&(e=t,r)){const t=!xr.length;for(const t of i)t[1](),xr.push(t,e);if(t){for(let t=0;t{i.delete(u),0===i.size&&r&&(r(),r=null)}}}}function Pr(e,n,r){const i=!Array.isArray(e),a=i?[e]:e,u=n.length<2;return Er(r,(e=>{let r=!1;const d=[];let l=0,h=t;const f=()=>{if(l)return;h();const r=n(i?d[0]:d,e);u?e(r):h=s(r)?r:t},p=a.map(((t,e)=>c(t,(t=>{d[e]=t,l&=~(1<{l|=1<{pt(t,1)})),it()}s?(n=D(s,a()),n.$on("routeEvent",t[7]),ht(n.$$.fragment),ot(n.$$.fragment,1),ft(n,r.parentNode,r)):n=null}else s&&n.$set(i)},i(t){i||(n&&ot(n.$$.fragment,t),i=!0)},o(t){n&&st(n.$$.fragment,t),i=!1},d(t){t&&k(r),n&&pt(n,t)}}}function Lr(t){let n,r,i;const o=[{params:t[1]},t[2]];var s=t[0];function a(t){let n={};for(let t=0;t{pt(t,1)})),it()}s?(n=D(s,a()),n.$on("routeEvent",t[6]),ht(n.$$.fragment),ot(n.$$.fragment,1),ft(n,r.parentNode,r)):n=null}else s&&n.$set(i)},i(t){i||(n&&ot(n.$$.fragment,t),i=!0)},o(t){n&&st(n.$$.fragment,t),i=!1},d(t){t&&k(r),n&&pt(n,t)}}}function $r(t){let e,n,r,i;const o=[Lr,Br],s=[];function a(t,e){return t[1]?0:1}return e=a(t),n=s[e]=o[e](t),{c(){n.c(),r=x()},m(t,n){s[e].m(t,n),v(t,r,n),i=!0},p(t,[i]){let u=e;e=a(t),e===u?s[e].p(t,i):(rt(),st(s[u],1,1,(()=>{s[u]=null})),it(),n=s[e],n?n.p(t,i):(n=s[e]=o[e](t),n.c()),ot(n,1),n.m(r.parentNode,r))},i(t){i||(ot(n),i=!0)},o(t){st(n),i=!1},d(t){s[e].d(t),t&&k(r)}}}function Rr(){const t=window.location.href.indexOf("#/");let e=t>-1?window.location.href.substr(t+1):"/";const n=e.indexOf("?");let r="";return n>-1&&(r=e.substr(n+1),e=e.substr(0,n)),{location:e,querystring:r}}const Or=Er(null,(function(t){t(Rr());const e=()=>{t(Rr())};return window.addEventListener("hashchange",e,!1),function(){window.removeEventListener("hashchange",e,!1)}})),Dr=Pr(Or,(t=>t.location)),Cr=(Pr(Or,(t=>t.querystring)),Tr(void 0));async function Nr(t){if(!t||t.length<1||"/"!=t.charAt(0)&&0!==t.indexOf("#/"))throw Error("Invalid parameter location");await q(),history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0),window.location.hash=("#"==t.charAt(0)?"":"#")+t}function zr(t,e,n){let{routes:r={}}=e,{prefix:i=""}=e,{restoreScrollState:o=!1}=e;class s{constructor(t,e){if(!e||"function"!=typeof e&&("object"!=typeof e||!0!==e._sveltesparouter))throw Error("Invalid component object");if(!t||"string"==typeof t&&(t.length<1||"/"!=t.charAt(0)&&"*"!=t.charAt(0))||"object"==typeof t&&!(t instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:n,keys:r}=function(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var n,r,i,o,s=[],a="",u=t.split("/");for(u[0]||u.shift();i=u.shift();)"*"===(n=i[0])?(s.push("wild"),a+="/(.*)"):":"===n?(r=i.indexOf("?",1),o=i.indexOf(".",1),s.push(i.substring(1,~r?r:~o?o:i.length)),a+=~r&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(a+=(~r?"?":"")+"\\"+i.substring(o))):a+="/"+i;return{keys:s,pattern:new RegExp("^"+a+"/?$","i")}}(t);this.path=t,"object"==typeof e&&!0===e._sveltesparouter?(this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}):(this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}),this._pattern=n,this._keys=r}match(t){if(i)if("string"==typeof i){if(!t.startsWith(i))return null;t=t.substr(i.length)||"/"}else if(i instanceof RegExp){const e=t.match(i);if(!e||!e[0])return null;t=t.substr(e[0].length)||"/"}const e=this._pattern.exec(t);if(null===e)return null;if(!1===this._keys)return e;const n={};let r=0;for(;r{a.push(new s(e,t))})):Object.keys(r).forEach((t=>{a.push(new s(t,r[t]))}));let u=null,c=null,d={};const l=function(){const t=N();return(e,n,{cancelable:r=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=function(t,e,{bubbles:n=!1,cancelable:r=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n,r,e),i}(e,n,{cancelable:r});return i.slice().forEach((e=>{e.call(t,o)})),!o.defaultPrevented}return!0}}();async function h(t,e){await q(),l(t,e)}let f=null,p=null;var m;o&&(p=t=>{f=t.state&&(t.state.__svelte_spa_router_scrollY||t.state.__svelte_spa_router_scrollX)?t.state:null},window.addEventListener("popstate",p),m=()=>{var t;(t=f)?window.scrollTo(t.__svelte_spa_router_scrollX,t.__svelte_spa_router_scrollY):window.scrollTo(0,0)},N().$$.after_update.push(m));let g=null,y=null;const b=Or.subscribe((async t=>{g=t;let e=0;for(;e{Cr.set(c)}))}n(0,u=null),y=null,Cr.set(void 0)}));return N().$$.on_destroy.push((()=>{b(),p&&window.removeEventListener("popstate",p)})),t.$$set=t=>{"routes"in t&&n(3,r=t.routes),"prefix"in t&&n(4,i=t.prefix),"restoreScrollState"in t&&n(5,o=t.restoreScrollState)},t.$$.update=()=>{32&t.$$.dirty&&(history.scrollRestoration=o?"manual":"auto")},[u,c,d,r,i,o,function(e){z.call(this,t,e)},function(e){z.call(this,t,e)}]}const Ur=class extends gt{constructor(t){super(),mt(this,t,zr,$r,a,{routes:3,prefix:4,restoreScrollState:5})}};var jr=n(40273),Yr=n(79468),Fr=n(73936),Wr=n(93018);const Hr=new Mt.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new Mt.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),new Mt.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),new Mt.PublicKey("So11111111111111111111111111111111111111112"),new Mt.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const Kr=new Mt.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),qr=new Mt.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");new Mt.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),new Mt.PublicKey("So11111111111111111111111111111111111111112"),new Mt.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const Vr=9,Gr=[1,2,4,8,16,32,64,128,256,512];function Zr(t){if(t){if(t.equals(Hr))return"token";if(t.equals(qr))return"token-2022";throw new Error(`Unknown token program: ${t.toBase58()}`)}}var Xr;function Jr(t,e,n){const r=jr.TickUtil.getStartTickIndex(t,e);for(const i of n)if((null==i?void 0:i.startTickIndex)===r)return jr.TickArrayUtil.getTickFromArray(i,t,e)}!function(t){t.PriceIsInRange="Price is In Range",t.PriceIsAboveRange="Price is Above Range",t.PriceIsBelowRange="Price is Below Range"}(Xr||(Xr={}));const Qr=(t,e)=>{const n=t.parsed.tickLowerIndex-e.parsed.tickLowerIndex;return n||t.parsed.tickUpperIndex-e.parsed.tickUpperIndex},ti=(t,e)=>{const n=e.parsed.tickUpperIndex-t.parsed.tickUpperIndex;return n||e.parsed.tickLowerIndex-t.parsed.tickLowerIndex},ei=(t,e)=>{const n=e.derived.amountA.cmp(t.derived.amountA);return n||e.derived.amountB.cmp(t.derived.amountB)},ni=(t,e)=>{const n=e.derived.amountB.cmp(t.derived.amountB);return n||e.derived.amountA.cmp(t.derived.amountA)};function ri(t){let e,n,r,i,o;const s=t[1].default,a=d(s,t,t[0],null);return{c(){e=A("div"),n=A("h3"),n.textContent="🧑‍🔬 Laboratory",r=I(),i=A("dl"),a&&a.c(),$(i,"font-size","smaller")},m(t,s){v(t,e,s),_(e,n),_(e,r),_(e,i),a&&a.m(i,null),o=!0},p(t,[e]){a&&a.p&&(!o||1&e)&&f(a,s,t,t[0],o?h(s,t[0],e,null):p(t[0]),null)},i(t){o||(ot(a,t),o=!0)},o(t){st(a,t),o=!1},d(t){t&&k(e),a&&a.d(t)}}}function ii(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=t=>{"$$scope"in t&&n(0,i=t.$$scope)},[i,r]}const oi=class extends gt{constructor(t){super(),mt(this,t,ii,ri,a,{})}};var si=n(58147),ai=n.n(si),ui=n(42693),ci=n.n(ui),di=n(48764).Buffer;const li={slotContext:0,accounts:{}},hi=2e4,fi={retries:5,minTimeout:1e3,maxTimeout:1e3};async function pi(t,e,n,r="confirmed",i){const o=await t.getProgramAccounts(e,{commitment:r,encoding:"base64",withContext:!0,filters:n,minContextSlot:i});return{slotContext:o.context.slot,accounts:Object.fromEntries(o.value.map((({pubkey:t,account:e})=>[t.toBase58(),e])))}}function mi(t,e){const n=Object.keys(t.accounts).sort(),r=Object.keys(e.accounts).sort();if(n.length!==r.length)return!1;if(JSON.stringify(n)!==JSON.stringify(r))return!1;for(const r of n){const n=t.accounts[r],i=e.accounts[r];if(n.executable!==i.executable)return!1;if(n.lamports!==i.lamports)return!1;if(n.owner.toBase58()!==i.owner.toBase58())return!1;if(n.rentEpoch!==i.rentEpoch)return!1;if(0!==di.compare(n.data,i.data))return!1}return!0}function gi(t,e){const n={slotContext:t.slotContext,accounts:Object.assign({},t.accounts)};for(const t of Object.keys(e.accounts))void 0!==n.accounts[t]&&(n.accounts[t]=e.accounts[t]);return n}function yi(e){let n,r,i,o,s,a,u;return{c(){n=A("div"),r=A("input"),i=I(),o=A("span"),s=S(e[1]),P(r,"type","checkbox"),$(o,"margin-left","5px"),$(n,"display","flex"),$(n,"flex-direction","row")},m(t,c){v(t,n,c),_(n,r),r.checked=e[0],_(n,i),_(n,o),_(o,s),a||(u=E(r,"change",e[2]),a=!0)},p(t,[e]){1&e&&(r.checked=t[0]),2&e&&B(s,t[1])},i:t,o:t,d(t){t&&k(n),a=!1,u()}}}function bi(t,e,n){let{value:r}=e,{label:i}=e;return t.$$set=t=>{"value"in t&&n(0,r=t.value),"label"in t&&n(1,i=t.label)},[r,i,function(){r=this.checked,n(0,r)}]}const wi=class extends gt{constructor(t){super(),mt(this,t,bi,yi,a,{value:0,label:1})}};var _i=n(55733),vi=n.n(_i);function ki(t,e,n){const r=t.slice();return r[6]=e[n],r[8]=n,r}function Mi(t){let e,n,r,i,o,s,a,u,c,d=t[6]+"";return a=function(t){let e;return{p(...n){e=n,e.forEach((e=>t.push(e)))},r(){e.forEach((e=>t.splice(t.indexOf(e),1)))}}}(t[5][0]),{c(){e=A("label"),n=A("input"),i=I(),o=S(d),s=I(),P(n,"type","radio"),P(n,"name",t[1]),n.__value=r=t[8],n.value=n.__value,a.p(n)},m(r,a){v(r,e,a),_(e,n),n.checked=n.__value===t[0],_(e,i),_(e,o),_(e,s),u||(c=E(n,"change",t[4]),u=!0)},p(t,e){2&e&&P(n,"name",t[1]),5&e&&(n.checked=n.__value===t[0]),4&e&&d!==(d=t[6]+"")&&B(o,d)},d(t){t&&k(e),a.r(),u=!1,c()}}}function Ai(e){let n,r,i=e[2],o=[];for(let t=0;t{"group"in t&&n(1,r=t.group),"values"in t&&n(2,i=t.values),"selected"in t&&n(0,o=t.selected),"direction"in t&&n(3,s=t.direction)},[o,r,i,s,function(){o=this.__value,n(0,o)},[[]]]}const Ii=class extends gt{constructor(t){super(),mt(this,t,Si,Ai,a,{group:1,values:2,selected:0,direction:3})}};function xi(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,B,L,R,O,D,C,N,z,U,Y,F,W,H,K,q,V,Z,X,J,Q,tt,et;function nt(e){t[14](e)}let rt={label:"append filename prefix"};function it(e){t[15](e)}void 0!==t[3]&&(rt.value=t[3]),o=new wi({props:rt}),j.push((()=>lt(o,"value",nt)));let at={label:"with WhirlpoolsConfig"};function ut(e){t[16](e)}void 0!==t[4]&&(at.value=t[4]),d=new wi({props:at}),j.push((()=>lt(d,"value",it)));let ct={label:"with FeeTier"};function dt(e){t[17](e)}void 0!==t[5]&&(ct.value=t[5]),m=new wi({props:ct}),j.push((()=>lt(m,"value",ut)));let mt={label:"with TickArray"};function gt(e){t[18](e)}void 0!==t[0]&&(mt.value=t[0]),M=new wi({props:mt}),j.push((()=>lt(M,"value",dt)));let yt={group:"tickArraySelection",values:t[9]};function bt(e){t[19](e)}void 0!==t[2]&&(yt.selected=t[2]),T=new Ii({props:yt}),j.push((()=>lt(T,"selected",gt)));let wt={label:"with VaultTokenAccount"};function _t(e){t[20](e)}void 0!==t[6]&&(wt.value=t[6]),C=new wi({props:wt}),j.push((()=>lt(C,"value",bt)));let vt={label:"with MintAccount"};function kt(e){t[21](e)}void 0!==t[7]&&(vt.value=t[7]),F=new wi({props:vt}),j.push((()=>lt(F,"value",_t)));let Mt={label:"with Position"};return void 0!==t[1]&&(Mt.value=t[1]),V=new wi({props:Mt}),j.push((()=>lt(V,"value",kt))),tt=new sr({props:{download:t[10],disabled:t[8][0],label:t[8][1],width:320}}),{c(){e=A("div"),n=A("table"),r=A("tr"),i=A("td"),ht(o.$$.fragment),a=I(),u=A("tr"),c=A("td"),ht(d.$$.fragment),h=I(),f=A("tr"),p=A("td"),ht(m.$$.fragment),y=I(),b=A("tr"),w=A("td"),ht(M.$$.fragment),E=S("\n  (\n "),ht(T.$$.fragment),L=S("\n  )"),R=I(),O=A("tr"),D=A("td"),ht(C.$$.fragment),z=I(),U=A("tr"),Y=A("td"),ht(F.$$.fragment),H=I(),K=A("tr"),q=A("td"),ht(V.$$.fragment),X=I(),J=A("tr"),Q=A("td"),ht(tt.$$.fragment),P(i,"class","svelte-hnlsv"),P(c,"class","svelte-hnlsv"),P(p,"class","svelte-hnlsv"),$(w,"display","flex"),$(w,"flex-direction","row"),P(w,"class","svelte-hnlsv"),P(D,"class","svelte-hnlsv"),P(Y,"class","svelte-hnlsv"),P(q,"class","svelte-hnlsv"),P(Q,"class","svelte-hnlsv"),$(n,"border-spacing","0")},m(t,s){v(t,e,s),_(e,n),_(n,r),_(r,i),ft(o,i,null),_(n,a),_(n,u),_(u,c),ft(d,c,null),_(n,h),_(n,f),_(f,p),ft(m,p,null),_(n,y),_(n,b),_(b,w),ft(M,w,null),_(w,E),ft(T,w,null),_(w,L),_(n,R),_(n,O),_(O,D),ft(C,D,null),_(n,z),_(n,U),_(U,Y),ft(F,Y,null),_(n,H),_(n,K),_(K,q),ft(V,q,null),_(n,X),_(n,J),_(J,Q),ft(tt,Q,null),et=!0},p(t,[e]){const n={};!s&&8&e&&(s=!0,n.value=t[3],G((()=>s=!1))),o.$set(n);const r={};!l&&16&e&&(l=!0,r.value=t[4],G((()=>l=!1))),d.$set(r);const i={};!g&&32&e&&(g=!0,i.value=t[5],G((()=>g=!1))),m.$set(i);const a={};!x&&1&e&&(x=!0,a.value=t[0],G((()=>x=!1))),M.$set(a);const u={};!B&&4&e&&(B=!0,u.selected=t[2],G((()=>B=!1))),T.$set(u);const c={};!N&&64&e&&(N=!0,c.value=t[6],G((()=>N=!1))),C.$set(c);const h={};!W&&128&e&&(W=!0,h.value=t[7],G((()=>W=!1))),F.$set(h);const f={};!Z&&2&e&&(Z=!0,f.value=t[1],G((()=>Z=!1))),V.$set(f);const p={};256&e&&(p.disabled=t[8][0]),256&e&&(p.label=t[8][1]),tt.$set(p)},i(t){et||(ot(o.$$.fragment,t),ot(d.$$.fragment,t),ot(m.$$.fragment,t),ot(M.$$.fragment,t),ot(T.$$.fragment,t),ot(C.$$.fragment,t),ot(F.$$.fragment,t),ot(V.$$.fragment,t),ot(tt.$$.fragment,t),et=!0)},o(t){st(o.$$.fragment,t),st(d.$$.fragment,t),st(m.$$.fragment,t),st(M.$$.fragment,t),st(T.$$.fragment,t),st(C.$$.fragment,t),st(F.$$.fragment,t),st(V.$$.fragment,t),st(tt.$$.fragment,t),et=!1},d(t){t&&k(e),pt(o),pt(d),pt(m),pt(M),pt(T),pt(C),pt(F),pt(V),pt(tt)}}}function Ei(t,e,n){let r,i,{whirlpoolInfo:o}=e,s=!1,a=!0,u=!0,c=!0,d=!0,l=!0,h=!1,f=0;var p;!function(t){t.NOT_PROCESSING="not processing",t.NOT_PROCESSING_RETRY="not processing (retry)",t.FETCHING="fetching",t.PACKING="packing",t.DOWNLOADING="downloading"}(p||(p={}));let m=p.NOT_PROCESSING;return t.$$set=t=>{"whirlpoolInfo"in t&&n(11,o=t.whirlpoolInfo)},t.$$.update=()=>{4&t.$$.dirty&&n(13,r=1===f),12291&t.$$.dirty&&n(8,i=function(t,e){switch(t){case p.NOT_PROCESSING:return[!1,e?"Download JSON! ( takes up to 1 minute ⌛ )":"Download JSON!"];case p.NOT_PROCESSING_RETRY:return[!1,"Download JSON! ( retry )"];case p.FETCHING:case p.PACKING:case p.DOWNLOADING:return[!0,"Processing..."]}}(m,c&&r||h))},[c,h,f,s,a,u,d,l,i,["only neighborhood","all"],async function(){var t,e,i,f;const g={withWhirlpoolsConfig:a,withFeeTier:u,withTickArray:c,withVaultTokenAccount:d,withMintAccount:l,withPosition:h,tickArraySelection:r?"all":"neighborhood"};try{n(12,m=p.FETCHING);const y=await async function(t,e,n=fi){return await ci()((async()=>ai()(async function(t,e){const{meta:n,parsed:r}=t,i=It(),o=n.owner,s=e.withTickArray&&"all"===e.tickArraySelection,a=n.pubkey,u=r.whirlpoolsConfig,c=jr.PDAUtil.getFeeTier(o,u,r.tickSpacing).publicKey,d=r.tokenMintA,l=r.tokenMintB,h=r.tokenVaultA,f=r.tokenVaultB,p=r.rewardInfos.filter((t=>jr.PoolUtil.isRewardInitialized(t))),m=p.map((t=>t.mint)),g=p.map((t=>t.vault)),y=function(t){const e=new Set(t.map((t=>t.toBase58())));return Array.from(e).map((t=>new Mt.PublicKey(t)))}([d,l,...m]),b=[h,f,...g],w=[-3,-2,-1,0,1,2,3].map((t=>{const e=jr.TickUtil.getStartTickIndex(r.tickCurrentIndex,r.tickSpacing,t);return jr.PDAUtil.getTickArray(o,n.pubkey,e).publicKey})),_=[a,u,c,...w,...y,...b],v="confirmed",k=[{dataSize:(0,jr.getAccountSize)(jr.AccountName.TickArray)},{memcmp:{offset:9956,bytes:a.toBase58()}}],M=[{dataSize:(0,jr.getAccountSize)(jr.AccountName.Position)},{memcmp:{offset:8,bytes:a.toBase58()}}],A=s?pi(i,o,k,v):Promise.resolve(li),S=e.withPosition?pi(i,o,M,v):Promise.resolve(li),[I,x]=await Promise.all([A,S]),E=Math.max(I.slotContext,x.slotContext),T=await async function(t,e,n="confirmed",r){const i=await t.getMultipleAccountsInfoAndContext(e,{commitment:n,minContextSlot:r});return{slotContext:i.context.slot,accounts:Object.fromEntries(e.map(((t,e)=>[t.toBase58(),i.value[e]])).filter((([,t])=>null!==t)))}}(i,_,v,E),P=s?pi(i,o,k,v,T.slotContext):Promise.resolve(li),B=e.withPosition?pi(i,o,M,v,T.slotContext):Promise.resolve(li),[L,$]=await Promise.all([P,B]),R=T.slotContext,O=gi(I,T),D=gi(L,T);if(!mi(O,D))throw new Error("cannot fetch TickArray accounts consistently");if(!mi(x,$))throw new Error("cannot fetch Position accounts consistently");function C(t,e){return tr(Xn(t,e.accounts[t.toBase58()],R),!0)}const N=Object.keys(D.accounts).map((t=>new Mt.PublicKey(t))),z=Object.keys($.accounts).map((t=>new Mt.PublicKey(t)));return{slotContext:R,whirlpool:C(a,T),whirlpoolsConfig:e.withWhirlpoolsConfig?C(u,T):void 0,feeTier:e.withFeeTier?C(c,T):void 0,tickArrays:e.withTickArray?"all"===e.tickArraySelection?N.map((t=>C(t,D))):w.filter((t=>!!T.accounts[t.toBase58()])).map((t=>C(t,T))):void 0,mintAccounts:e.withMintAccount?y.map((t=>C(t,T))):void 0,vaultTokenAccounts:e.withVaultTokenAccount?b.map((t=>C(t,T))):void 0,positions:e.withPosition?z.map((t=>C(t,$))):void 0}}(t,e),hi)),n)}(o,g);n(12,m=p.PACKING);const b=new(vi());function w(t,e){if(!t)return;const n=s?`${e}.${t.pubkey}.json`:`${t.pubkey}.json`;b.file(n,nr(t))}w(y.whirlpool,"whirlpool"),w(y.whirlpoolsConfig,"config"),w(y.feeTier,"feetier"),null===(t=y.tickArrays)||void 0===t||t.forEach((t=>w(t,"tickarray"))),null===(e=y.vaultTokenAccounts)||void 0===e||e.forEach((t=>w(t,"vault"))),null===(i=y.mintAccounts)||void 0===i||i.forEach((t=>w(t,"mint"))),null===(f=y.positions)||void 0===f||f.forEach((t=>w(t,"position")));const _=`${o.meta.pubkey.toBase58()}.${y.slotContext}.zip`,v=await b.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:5}});n(12,m=p.DOWNLOADING),rr(v,_),n(12,m=p.NOT_PROCESSING)}catch(k){console.error(k),n(12,m=p.NOT_PROCESSING_RETRY)}},o,m,r,function(t){s=t,n(3,s)},function(t){a=t,n(4,a)},function(t){u=t,n(5,u)},function(t){c=t,n(0,c)},function(t){f=t,n(2,f)},function(t){d=t,n(6,d)},function(t){l=t,n(7,l)},function(t){h=t,n(1,h)}]}const Ti=class extends gt{constructor(t){super(),mt(this,t,Ei,xi,a,{whirlpoolInfo:11})}};function Pi(t){let e,n;return e=new Gn({props:{address:t[0],short:t[1],length:t[2],type:t[3]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,[n]){const r={};1&n&&(r.address=t[0]),2&n&&(r.short=t[1]),4&n&&(r.length=t[2]),8&n&&(r.type=t[3]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Bi(t,e,n){let{address:r}=e,{type:i}=e,{program:o}=e,{short:s=!1}=e,{length:a=5}=e,u=i;if("token-2022"===o)switch(u){case"token/mint":u="token2022/mint";break;case"token/account":u="token2022/account"}return t.$$set=t=>{"address"in t&&n(0,r=t.address),"type"in t&&n(4,i=t.type),"program"in t&&n(5,o=t.program),"short"in t&&n(1,s=t.short),"length"in t&&n(2,a=t.length)},[r,s,a,u,i,o]}const Li=class extends gt{constructor(t){super(),mt(this,t,Bi,Pi,a,{address:0,type:4,program:5,short:1,length:2})}};function $i(t,e,n){const r=t.slice();return r[4]=e[n],r}function Ri(t,e,n){const r=t.slice();return r[7]=e[n],r}function Oi(t,e,n){const r=t.slice();return r[7]=e[n],r}function Di(t,e,n){const r=t.slice();return r[7]=e[n],r}function Ci(t,e,n){const r=t.slice();return r[7]=e[n],r}function Ni(t,e,n){const r=t.slice();return r[16]=e[n],r}function zi(t,e,n){const r=t.slice();return r[16]=e[n],r}function Ui(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function ji(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/whirlpool",meta:t[3].meta}}),r=new Mr({props:{$$slots:{default:[ts]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[3].meta),e.$set(i);const o={};2097154&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Yi(t){let e,n;return e=new Gn({props:{type:"whirlpool/config",address:t[3].parsed.whirlpoolsConfig}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.whirlpoolsConfig),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Fi(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.tokenMintA,program:t[3].derived.tokenProgramA}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.tokenMintA),2&n&&(r.program=t[3].derived.tokenProgramA),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Wi(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.tokenMintB,program:t[3].derived.tokenProgramB}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.tokenMintB),2&n&&(r.program=t[3].derived.tokenProgramB),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Hi(t){let e,n=t[3].parsed.tickSpacing+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.tickSpacing+"")&&B(e,n)},d(t){t&&k(e)}}}function Ki(t){let e,n=t[3].parsed.liquidity+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.liquidity+"")&&B(e,n)},d(t){t&&k(e)}}}function qi(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.tokenVaultA,program:t[3].derived.tokenProgramA}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.tokenVaultA),2&n&&(r.program=t[3].derived.tokenProgramA),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Vi(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.tokenVaultB,program:t[3].derived.tokenProgramB}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.tokenVaultB),2&n&&(r.program=t[3].derived.tokenProgramB),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Gi(t){let e,n=t[3].parsed.sqrtPrice+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.sqrtPrice+"")&&B(e,n)},d(t){t&&k(e)}}}function Zi(t){let e,n=t[3].parsed.tickCurrentIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.tickCurrentIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function Xi(t){let e,n=t[3].parsed.feeGrowthGlobalA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.feeGrowthGlobalA+"")&&B(e,n)},d(t){t&&k(e)}}}function Ji(t){let e,n=t[3].parsed.feeGrowthGlobalB+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.feeGrowthGlobalB+"")&&B(e,n)},d(t){t&&k(e)}}}function Qi(t){let e,n=t[3].parsed.feeRate+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.feeRate+"")&&B(e,n)},d(t){t&&k(e)}}}function to(t){let e,n=t[3].parsed.protocolFeeRate+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.protocolFeeRate+"")&&B(e,n)},d(t){t&&k(e)}}}function eo(t){let e,n=t[3].parsed.protocolFeeOwedA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.protocolFeeOwedA+"")&&B(e,n)},d(t){t&&k(e)}}}function no(t){let e,n=t[3].parsed.protocolFeeOwedB+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.protocolFeeOwedB+"")&&B(e,n)},d(t){t&&k(e)}}}function ro(t){let e,n,r,i=t[3].parsed.whirlpoolBump[0]+"";return{c(){e=S("["),n=S(i),r=S("]")},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,e){2&e&&i!==(i=t[3].parsed.whirlpoolBump[0]+"")&&B(n,i)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function io(t){let e,n=t[3].parsed.rewardLastUpdatedTimestamp+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardLastUpdatedTimestamp+"")&&B(e,n)},d(t){t&&k(e)}}}function oo(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.rewardInfos[0].mint,program:t[3].derived.tokenProgramR0}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[0].mint),2&n&&(r.program=t[3].derived.tokenProgramR0),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function so(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.rewardInfos[0].vault,program:t[3].derived.tokenProgramR0}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[0].vault),2&n&&(r.program=t[3].derived.tokenProgramR0),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ao(t){let e,n=t[3].parsed.rewardInfos[0].emissionsPerSecondX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[0].emissionsPerSecondX64+"")&&B(e,n)},d(t){t&&k(e)}}}function uo(t){let e,n;return e=new Gn({props:{address:t[3].parsed.rewardInfos[0].authority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[0].authority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function co(t){let e,n=t[3].parsed.rewardInfos[0].growthGlobalX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[0].growthGlobalX64+"")&&B(e,n)},d(t){t&&k(e)}}}function lo(t){let e,n,r,i,o,s,a,u,c,d;return e=new vt({props:{name:"mint",type:"PublicKey",offset:"269",$$slots:{default:[oo]},$$scope:{ctx:t}}}),r=new vt({props:{name:"vault",type:"PublicKey",offset:"301",$$slots:{default:[so]},$$scope:{ctx:t}}}),o=new vt({props:{name:"emissionsPerSecondX64",type:"u128",offset:"365",$$slots:{default:[ao]},$$scope:{ctx:t}}}),a=new vt({props:{name:"authority",type:"PublicKey",offset:"333",$$slots:{default:[uo]},$$scope:{ctx:t}}}),c=new vt({props:{name:"growthGlobalX64",type:"u128",offset:"381",$$slots:{default:[co]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment)},m(t,l){ft(e,t,l),v(t,n,l),ft(r,t,l),v(t,i,l),ft(o,t,l),v(t,s,l),ft(a,t,l),v(t,u,l),ft(c,t,l),d=!0},p(t,n){const i={};2097154&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};2097154&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};2097154&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};2097154&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const l={};2097154&n&&(l.$$scope={dirty:n,ctx:t}),c.$set(l)},i(t){d||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),d=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),d=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t)}}}function ho(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.rewardInfos[1].mint,program:t[3].derived.tokenProgramR1}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[1].mint),2&n&&(r.program=t[3].derived.tokenProgramR1),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function fo(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.rewardInfos[1].vault,program:t[3].derived.tokenProgramR1}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[1].vault),2&n&&(r.program=t[3].derived.tokenProgramR1),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function po(t){let e,n=t[3].parsed.rewardInfos[1].emissionsPerSecondX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[1].emissionsPerSecondX64+"")&&B(e,n)},d(t){t&&k(e)}}}function mo(t){let e,n;return e=new Gn({props:{address:t[3].parsed.rewardInfos[1].authority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[1].authority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function go(t){let e,n=t[3].parsed.rewardInfos[1].growthGlobalX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[1].growthGlobalX64+"")&&B(e,n)},d(t){t&&k(e)}}}function yo(t){let e,n,r,i,o,s,a,u,c,d;return e=new vt({props:{name:"mint",type:"PublicKey",offset:"397",$$slots:{default:[ho]},$$scope:{ctx:t}}}),r=new vt({props:{name:"vault",type:"PublicKey",offset:"429",$$slots:{default:[fo]},$$scope:{ctx:t}}}),o=new vt({props:{name:"emissionsPerSecondX64",type:"u128",offset:"493",$$slots:{default:[po]},$$scope:{ctx:t}}}),a=new vt({props:{name:"authority",type:"PublicKey",offset:"461",$$slots:{default:[mo]},$$scope:{ctx:t}}}),c=new vt({props:{name:"growthGlobalX64",type:"u128",offset:"509",$$slots:{default:[go]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment)},m(t,l){ft(e,t,l),v(t,n,l),ft(r,t,l),v(t,i,l),ft(o,t,l),v(t,s,l),ft(a,t,l),v(t,u,l),ft(c,t,l),d=!0},p(t,n){const i={};2097154&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};2097154&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};2097154&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};2097154&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const l={};2097154&n&&(l.$$scope={dirty:n,ctx:t}),c.$set(l)},i(t){d||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),d=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),d=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t)}}}function bo(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.rewardInfos[2].mint,program:t[3].derived.tokenProgramR2}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[2].mint),2&n&&(r.program=t[3].derived.tokenProgramR2),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function wo(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.rewardInfos[2].vault,program:t[3].derived.tokenProgramR2}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[2].vault),2&n&&(r.program=t[3].derived.tokenProgramR2),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function _o(t){let e,n=t[3].parsed.rewardInfos[2].emissionsPerSecondX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[2].emissionsPerSecondX64+"")&&B(e,n)},d(t){t&&k(e)}}}function vo(t){let e,n;return e=new Gn({props:{address:t[3].parsed.rewardInfos[2].authority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[2].authority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ko(t){let e,n=t[3].parsed.rewardInfos[2].growthGlobalX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[2].growthGlobalX64+"")&&B(e,n)},d(t){t&&k(e)}}}function Mo(t){let e,n,r,i,o,s,a,u,c,d;return e=new vt({props:{name:"mint",type:"PublicKey",offset:"525",$$slots:{default:[bo]},$$scope:{ctx:t}}}),r=new vt({props:{name:"vault",type:"PublicKey",offset:"557",$$slots:{default:[wo]},$$scope:{ctx:t}}}),o=new vt({props:{name:"emissionsPerSecondX64",type:"u128",offset:"621",$$slots:{default:[_o]},$$scope:{ctx:t}}}),a=new vt({props:{name:"authority",type:"PublicKey",offset:"589",$$slots:{default:[vo]},$$scope:{ctx:t}}}),c=new vt({props:{name:"growthGlobalX64",type:"u128",offset:"637",$$slots:{default:[ko]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment)},m(t,l){ft(e,t,l),v(t,n,l),ft(r,t,l),v(t,i,l),ft(o,t,l),v(t,s,l),ft(a,t,l),v(t,u,l),ft(c,t,l),d=!0},p(t,n){const i={};2097154&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};2097154&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};2097154&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};2097154&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const l={};2097154&n&&(l.$$scope={dirty:n,ctx:t}),c.$set(l)},i(t){d||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),d=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),d=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t)}}}function Ao(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,x,E,T,P,B,L,$,R,O,D,C,N,z,U,j,Y,F;return e=new vt({props:{name:"whirlpoolsConfig",type:"PublicKey",offset:"8",$$slots:{default:[Yi]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tokenMintA",type:"PublicKey",offset:"101",$$slots:{default:[Fi]},$$scope:{ctx:t}}}),o=new vt({props:{name:"tokenMintB",type:"PublicKey",offset:"181",$$slots:{default:[Wi]},$$scope:{ctx:t}}}),a=new vt({props:{name:"tickSpacing",type:"u16",offset:"41",$$slots:{default:[Hi]},$$scope:{ctx:t}}}),c=new vt({props:{name:"liquidity",type:"u128",offset:"49",$$slots:{default:[Ki]},$$scope:{ctx:t}}}),l=new vt({props:{name:"tokenVaultA",type:"PublicKey",offset:"133",$$slots:{default:[qi]},$$scope:{ctx:t}}}),f=new vt({props:{name:"tokenVaultB",type:"PublicKey",offset:"213",$$slots:{default:[Vi]},$$scope:{ctx:t}}}),m=new vt({props:{name:"sqrtPrice",type:"u128",offset:"65",$$slots:{default:[Gi]},$$scope:{ctx:t}}}),y=new vt({props:{name:"tickCurrentIndex",type:"i32",offset:"81",$$slots:{default:[Zi]},$$scope:{ctx:t}}}),w=new vt({props:{name:"feeGrowthGlobalA",type:"u128",offset:"165",$$slots:{default:[Xi]},$$scope:{ctx:t}}}),M=new vt({props:{name:"feeGrowthGlobalB",type:"u128",offset:"245",$$slots:{default:[Ji]},$$scope:{ctx:t}}}),S=new vt({props:{name:"feeRate",type:"u16",offset:"45",$$slots:{default:[Qi]},$$scope:{ctx:t}}}),E=new vt({props:{name:"protocolFeeRate",type:"u16",offset:"47",$$slots:{default:[to]},$$scope:{ctx:t}}}),P=new vt({props:{name:"protocolFeeOwedA",type:"u64",offset:"85",$$slots:{default:[eo]},$$scope:{ctx:t}}}),L=new vt({props:{name:"protocolFeeOwedB",type:"u64",offset:"93",$$slots:{default:[no]},$$scope:{ctx:t}}}),R=new vt({props:{name:"whirlpoolBump",type:"[u8; 1]",offset:"40",$$slots:{default:[ro]},$$scope:{ctx:t}}}),D=new vt({props:{name:"rewardLastUpdatedTimestamp",type:"u64",offset:"261",$$slots:{default:[io]},$$scope:{ctx:t}}}),N=new vt({props:{name:"rewardInfos[0]",$$slots:{default:[lo]},$$scope:{ctx:t}}}),U=new vt({props:{name:"rewardInfos[1]",$$slots:{default:[yo]},$$scope:{ctx:t}}}),Y=new vt({props:{name:"rewardInfos[2]",$$slots:{default:[Mo]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment),A=I(),ht(S.$$.fragment),x=I(),ht(E.$$.fragment),T=I(),ht(P.$$.fragment),B=I(),ht(L.$$.fragment),$=I(),ht(R.$$.fragment),O=I(),ht(D.$$.fragment),C=I(),ht(N.$$.fragment),z=I(),ht(U.$$.fragment),j=I(),ht(Y.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),v(t,A,k),ft(S,t,k),v(t,x,k),ft(E,t,k),v(t,T,k),ft(P,t,k),v(t,B,k),ft(L,t,k),v(t,$,k),ft(R,t,k),v(t,O,k),ft(D,t,k),v(t,C,k),ft(N,t,k),v(t,z,k),ft(U,t,k),v(t,j,k),ft(Y,t,k),F=!0},p(t,n){const i={};2097154&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};2097154&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};2097154&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};2097154&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};2097154&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};2097154&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};2097154&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};2097154&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};2097154&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};2097154&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};2097154&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k);const A={};2097154&n&&(A.$$scope={dirty:n,ctx:t}),S.$set(A);const I={};2097154&n&&(I.$$scope={dirty:n,ctx:t}),E.$set(I);const x={};2097154&n&&(x.$$scope={dirty:n,ctx:t}),P.$set(x);const T={};2097154&n&&(T.$$scope={dirty:n,ctx:t}),L.$set(T);const B={};2097154&n&&(B.$$scope={dirty:n,ctx:t}),R.$set(B);const $={};2097154&n&&($.$$scope={dirty:n,ctx:t}),D.$set($);const O={};2097154&n&&(O.$$scope={dirty:n,ctx:t}),N.$set(O);const C={};2097154&n&&(C.$$scope={dirty:n,ctx:t}),U.$set(C);const z={};2097154&n&&(z.$$scope={dirty:n,ctx:t}),Y.$set(z)},i(t){F||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),ot(S.$$.fragment,t),ot(E.$$.fragment,t),ot(P.$$.fragment,t),ot(L.$$.fragment,t),ot(R.$$.fragment,t),ot(D.$$.fragment,t),ot(N.$$.fragment,t),ot(U.$$.fragment,t),ot(Y.$$.fragment,t),F=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),st(S.$$.fragment,t),st(E.$$.fragment,t),st(P.$$.fragment,t),st(L.$$.fragment,t),st(R.$$.fragment,t),st(D.$$.fragment,t),st(N.$$.fragment,t),st(U.$$.fragment,t),st(Y.$$.fragment,t),F=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t),t&&k(A),pt(S,t),t&&k(x),pt(E,t),t&&k(T),pt(P,t),t&&k(B),pt(L,t),t&&k($),pt(R,t),t&&k(O),pt(D,t),t&&k(C),pt(N,t),t&&k(z),pt(U,t),t&&k(j),pt(Y,t)}}}function So(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,L,R,O,D,C,N,z,U,j,Y,F,W,H,K,q,V,G,Z,X,J,Q,tt,et,nt,rt,it=rs(t[3].derived.tokenInfoA)+"",ot=t[3].derived.tokenProgramA+"",st=t[3].derived.decimalsA+"",at=rs(t[3].derived.tokenInfoB)+"",ut=t[3].derived.tokenProgramB+"",ct=t[3].derived.decimalsB+"",dt=rs(t[3].derived.tokenInfoR0)+"",lt=t[3].derived.tokenProgramR0+"",ht=t[3].derived.decimalsR0+"",ft=rs(t[3].derived.tokenInfoR1)+"",pt=t[3].derived.tokenProgramR1+"",mt=t[3].derived.decimalsR1+"",gt=rs(t[3].derived.tokenInfoR2)+"",yt=t[3].derived.tokenProgramR2+"",bt=t[3].derived.decimalsR2+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokenprogramdecimals',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("A"),u=S(it),c=A("td"),d=S(ot),l=A("td"),h=S(st),f=I(),p=A("tr"),m=A("td"),g=S("B"),y=S(at),b=A("td"),w=S(ut),M=A("td"),x=S(ct),E=I(),T=A("tr"),L=A("td"),R=S("reward0"),O=S(dt),D=A("td"),C=S(lt),N=A("td"),z=S(ht),U=I(),j=A("tr"),Y=A("td"),F=S("reward1"),W=S(ft),H=A("td"),K=S(pt),q=A("td"),V=S(mt),G=I(),Z=A("tr"),X=A("td"),J=S("reward2"),Q=S(gt),tt=A("td"),et=S(yt),nt=A("td"),rt=S(bt),P(s,"class","svelte-1jz58vl"),P(c,"class","svelte-1jz58vl"),P(l,"class","svelte-1jz58vl"),P(m,"class","svelte-1jz58vl"),P(b,"class","svelte-1jz58vl"),P(M,"class","svelte-1jz58vl"),P(L,"class","svelte-1jz58vl"),P(D,"class","svelte-1jz58vl"),P(N,"class","svelte-1jz58vl"),P(Y,"class","svelte-1jz58vl"),P(H,"class","svelte-1jz58vl"),P(q,"class","svelte-1jz58vl"),P(X,"class","svelte-1jz58vl"),P(tt,"class","svelte-1jz58vl"),P(nt,"class","svelte-1jz58vl"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(o,l),_(l,h),_(i,f),_(i,p),_(p,m),_(m,g),_(m,y),_(p,b),_(b,w),_(p,M),_(M,x),_(i,E),_(i,T),_(T,L),_(L,R),_(L,O),_(T,D),_(D,C),_(T,N),_(N,z),_(i,U),_(i,j),_(j,Y),_(Y,F),_(Y,W),_(j,H),_(H,K),_(j,q),_(q,V),_(i,G),_(i,Z),_(Z,X),_(X,J),_(X,Q),_(Z,tt),_(tt,et),_(Z,nt),_(nt,rt)},p(t,e){2&e&&it!==(it=rs(t[3].derived.tokenInfoA)+"")&&B(u,it),2&e&&ot!==(ot=t[3].derived.tokenProgramA+"")&&B(d,ot),2&e&&st!==(st=t[3].derived.decimalsA+"")&&B(h,st),2&e&&at!==(at=rs(t[3].derived.tokenInfoB)+"")&&B(y,at),2&e&&ut!==(ut=t[3].derived.tokenProgramB+"")&&B(w,ut),2&e&&ct!==(ct=t[3].derived.decimalsB+"")&&B(x,ct),2&e&&dt!==(dt=rs(t[3].derived.tokenInfoR0)+"")&&B(O,dt),2&e&<!==(lt=t[3].derived.tokenProgramR0+"")&&B(C,lt),2&e&&ht!==(ht=t[3].derived.decimalsR0+"")&&B(z,ht),2&e&&ft!==(ft=rs(t[3].derived.tokenInfoR1)+"")&&B(W,ft),2&e&&pt!==(pt=t[3].derived.tokenProgramR1+"")&&B(K,pt),2&e&&mt!==(mt=t[3].derived.decimalsR1+"")&&B(V,mt),2&e&>!==(gt=rs(t[3].derived.tokenInfoR2)+"")&&B(Q,gt),2&e&&yt!==(yt=t[3].derived.tokenProgramR2+"")&&B(et,yt),2&e&&bt!==(bt=t[3].derived.decimalsR2+"")&&B(rt,bt)},d(t){t&&k(e)}}}function Io(t){let e,n,r,i=t[3].derived.price+"",o=is(t[3].derived.tokenInfoA,t[3].derived.tokenInfoB)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[3].derived.price+"")&&B(e,i),2&n&&o!==(o=is(t[3].derived.tokenInfoA,t[3].derived.tokenInfoB)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function xo(t){let e,n,r,i=t[3].derived.invertedPrice+"",o=is(t[3].derived.tokenInfoB,t[3].derived.tokenInfoA)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[3].derived.invertedPrice+"")&&B(e,i),2&n&&o!==(o=is(t[3].derived.tokenInfoB,t[3].derived.tokenInfoA)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Eo(t){let e,n,r=t[3].derived.feeRate+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[3].derived.feeRate+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function To(t){let e,n,r,i,o=t[3].derived.protocolFeeRate+"",s=t[3].derived.feeRate.mul(t[3].derived.protocolFeeRate.div(100))+"";return{c(){e=S(o),n=S(" % of fee ("),r=S(s),i=S(" %)")},m(t,o){v(t,e,o),v(t,n,o),v(t,r,o),v(t,i,o)},p(t,n){2&n&&o!==(o=t[3].derived.protocolFeeRate+"")&&B(e,o),2&n&&s!==(s=t[3].derived.feeRate.mul(t[3].derived.protocolFeeRate.div(100))+"")&&B(r,s)},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(i)}}}function Po(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,L,R,O,D,C,N,z,U,j,Y,F,W,H,K,q,V=rs(t[3].derived.tokenInfoA)+"",G=t[3].derived.tokenVaultAAmount+"",Z=rs(t[3].derived.tokenInfoB)+"",X=t[3].derived.tokenVaultBAmount+"",J=rs(t[3].derived.tokenInfoR0)+"",Q=t[3].derived.tokenVaultR0Amount+"",tt=rs(t[3].derived.tokenInfoR1)+"",et=t[3].derived.tokenVaultR1Amount+"",nt=rs(t[3].derived.tokenInfoR2)+"",rt=t[3].derived.tokenVaultR2Amount+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokenamount',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("A"),u=S(V),c=A("td"),d=S(G),l=I(),h=A("tr"),f=A("td"),p=S("B"),m=S(Z),g=A("td"),y=S(X),b=I(),w=A("tr"),M=A("td"),x=S("reward0"),E=S(J),T=A("td"),L=S(Q),R=I(),O=A("tr"),D=A("td"),C=S("reward1"),N=S(tt),z=A("td"),U=S(et),j=I(),Y=A("tr"),F=A("td"),W=S("reward2"),H=S(nt),K=A("td"),q=S(rt),P(s,"class","svelte-1jz58vl"),P(c,"class","svelte-1jz58vl"),P(f,"class","svelte-1jz58vl"),P(g,"class","svelte-1jz58vl"),P(M,"class","svelte-1jz58vl"),P(T,"class","svelte-1jz58vl"),P(D,"class","svelte-1jz58vl"),P(z,"class","svelte-1jz58vl"),P(F,"class","svelte-1jz58vl"),P(K,"class","svelte-1jz58vl"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y),_(i,b),_(i,w),_(w,M),_(M,x),_(M,E),_(w,T),_(T,L),_(i,R),_(i,O),_(O,D),_(D,C),_(D,N),_(O,z),_(z,U),_(i,j),_(i,Y),_(Y,F),_(F,W),_(F,H),_(Y,K),_(K,q)},p(t,e){2&e&&V!==(V=rs(t[3].derived.tokenInfoA)+"")&&B(u,V),2&e&&G!==(G=t[3].derived.tokenVaultAAmount+"")&&B(d,G),2&e&&Z!==(Z=rs(t[3].derived.tokenInfoB)+"")&&B(m,Z),2&e&&X!==(X=t[3].derived.tokenVaultBAmount+"")&&B(y,X),2&e&&J!==(J=rs(t[3].derived.tokenInfoR0)+"")&&B(E,J),2&e&&Q!==(Q=t[3].derived.tokenVaultR0Amount+"")&&B(L,Q),2&e&&tt!==(tt=rs(t[3].derived.tokenInfoR1)+"")&&B(N,tt),2&e&&et!==(et=t[3].derived.tokenVaultR1Amount+"")&&B(U,et),2&e&&nt!==(nt=rs(t[3].derived.tokenInfoR2)+"")&&B(H,nt),2&e&&rt!==(rt=t[3].derived.tokenVaultR2Amount+"")&&B(q,rt)},d(t){t&&k(e)}}}function Bo(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,L,R=rs(t[3].derived.tokenInfoR0)+"",O=t[3].derived.reward0WeeklyEmission+"",D=rs(t[3].derived.tokenInfoR1)+"",C=t[3].derived.reward1WeeklyEmission+"",N=rs(t[3].derived.tokenInfoR2)+"",z=t[3].derived.reward2WeeklyEmission+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='rewardemission',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("reward0"),u=S(R),c=A("td"),d=S(O),l=I(),h=A("tr"),f=A("td"),p=S("reward1"),m=S(D),g=A("td"),y=S(C),b=I(),w=A("tr"),M=A("td"),x=S("reward2"),E=S(N),T=A("td"),L=S(z),P(s,"class","svelte-1jz58vl"),P(c,"class","svelte-1jz58vl"),P(f,"class","svelte-1jz58vl"),P(g,"class","svelte-1jz58vl"),P(M,"class","svelte-1jz58vl"),P(T,"class","svelte-1jz58vl"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y),_(i,b),_(i,w),_(w,M),_(M,x),_(M,E),_(w,T),_(T,L)},p(t,e){2&e&&R!==(R=rs(t[3].derived.tokenInfoR0)+"")&&B(u,R),2&e&&O!==(O=t[3].derived.reward0WeeklyEmission+"")&&B(d,O),2&e&&D!==(D=rs(t[3].derived.tokenInfoR1)+"")&&B(m,D),2&e&&C!==(C=t[3].derived.reward1WeeklyEmission+"")&&B(y,C),2&e&&N!==(N=rs(t[3].derived.tokenInfoR2)+"")&&B(E,N),2&e&&z!==(z=t[3].derived.reward2WeeklyEmission+"")&&B(L,z)},d(t){t&&k(e)}}}function Lo(t){let e,n=t[3].derived.rewardLastUpdatedTimestamp.format("YYYY/MM/DD HH:mm:ss UTCZZ")+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].derived.rewardLastUpdatedTimestamp.format("YYYY/MM/DD HH:mm:ss UTCZZ")+"")&&B(e,n)},d(t){t&&k(e)}}}function $o(t){let e,n;return e=new Gn({props:{address:t[3].derived.oracle}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].derived.oracle),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ro(t){let e,n,r,i,o,s,a,u,c,d,l,h,f=t[16].isInitialized+"",p=t[16].startTickIndex+"";return c=new Gn({props:{type:"whirlpool/tickarray",address:t[16].pubkey,short:!0}}),{c(){e=A("tr"),n=A("td"),r=S(f),i=I(),o=A("td"),s=S(p),a=I(),u=A("td"),ht(c.$$.fragment),d=I(),P(n,"class","svelte-1jz58vl"),P(o,"class","svelte-1jz58vl"),P(u,"class","svelte-1jz58vl"),P(e,"class",l=m(t[16].isInitialized?"initialized":"uninitialized")+" svelte-1jz58vl")},m(t,l){v(t,e,l),_(e,n),_(n,r),_(e,i),_(e,o),_(o,s),_(e,a),_(e,u),ft(c,u,null),_(e,d),h=!0},p(t,n){(!h||2&n)&&f!==(f=t[16].isInitialized+"")&&B(r,f),(!h||2&n)&&p!==(p=t[16].startTickIndex+"")&&B(s,p);const i={};2&n&&(i.address=t[16].pubkey),c.$set(i),(!h||2&n&&l!==(l=m(t[16].isInitialized?"initialized":"uninitialized")+" svelte-1jz58vl"))&&P(e,"class",l)},i(t){h||(ot(c.$$.fragment,t),h=!0)},o(t){st(c.$$.fragment,t),h=!1},d(t){t&&k(e),pt(c)}}}function Oo(t){let e,n,r,i,o,s=t[3].derived.fullRangeTickArrays,a=[];for(let e=0;est(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='initializedstart tickpubkey',r=I(),i=A("tbody");for(let t=0;tst(C[t],1,1,(()=>{C[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='currentinitializedstart tickstart pricepubkey',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("B"),u=S(T),c=S(" to A"),d=S(L),l=S(" direction (price up)"),h=I();for(let t=0;tst(V[t],1,1,(()=>{V[t]=null}));let Z=t[3].derived.tickArrayTradableAmounts.downward,X=[];for(let e=0;est(X[t],1,1,(()=>{X[t]=null}));return{c(){e=A("table"),n=A("thead"),r=A("th"),r.textContent="start price",i=A("th"),o=S("tokenA"),s=S(j),a=A("th"),u=S("tokenB"),c=S(Y),d=A("th"),d.textContent="pubkey",l=I(),h=A("tbody"),f=A("tr"),p=A("td"),m=S("B"),g=S(F),y=S(" to A"),b=S(W),w=S(" direction (price up)"),x=I();for(let t=0;t{s[u]=null})),it(),n=s[e],n?n.p(t,i):(n=s[e]=o[e](t),n.c()),ot(n,1),n.m(r.parentNode,r))},i(t){i||(ot(n),i=!0)},o(t){st(n),i=!1},d(t){s[e].d(t),t&&k(r)}}}function Fo(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,x,E,T,L,R,O,D,C,N,z,U=rs(t[3].derived.tokenInfoA)+"",j=rs(t[3].derived.tokenInfoB)+"",Y=rs(t[3].derived.tokenInfoB)+"",F=rs(t[3].derived.tokenInfoA)+"",W=rs(t[3].derived.tokenInfoA)+"",H=rs(t[3].derived.tokenInfoB)+"",K=t[3].derived.tradableAmounts.upward.reverse(),q=[];for(let e=0;est(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='tsfeeliquiditytickpricepubkey',r=I(),i=A("tbody");for(let t=0;to.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function rs(t,e=!1){return void 0===t?"":e?t.symbol:`(${t.symbol})`}function is(t,e){return void 0===t||void 0===e?"":`${e.symbol}/${t.symbol}`}function os(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){var e,n,r,i,o,s;const a=bn.AddressUtil.toPubKey(t),u=It(),c=(0,jr.buildDefaultAccountFetcher)(u),{accountInfo:d,slotContext:l}=await Zn(u,a),h=jr.ParsableWhirlpool.parse(a,d),f=[];f.push(h.tokenMintA),f.push(h.tokenMintB),f.push(h.rewardInfos[0].mint),f.push(h.rewardInfos[1].mint),f.push(h.rewardInfos[2].mint);const p=await c.getMintInfos(f,jr.IGNORE_CACHE),m=p.get(f[0].toBase58()).decimals,g=p.get(f[1].toBase58()).decimals,y=null===(e=p.get(f[2].toBase58()))||void 0===e?void 0:e.decimals,b=null===(n=p.get(f[3].toBase58()))||void 0===n?void 0:n.decimals,w=null===(r=p.get(f[4].toBase58()))||void 0===r?void 0:r.decimals,_=Zr(p.get(f[0].toBase58()).tokenProgram),v=Zr(p.get(f[1].toBase58()).tokenProgram),k=Zr(null===(i=p.get(f[2].toBase58()))||void 0===i?void 0:i.tokenProgram),M=Zr(null===(o=p.get(f[3].toBase58()))||void 0===o?void 0:o.tokenProgram),A=Zr(null===(s=p.get(f[4].toBase58()))||void 0===s?void 0:s.tokenProgram),S=[];S.push(h.tokenVaultA),S.push(h.tokenVaultB),S.push(h.rewardInfos[0].vault),S.push(h.rewardInfos[1].vault),S.push(h.rewardInfos[2].vault);const I=await c.getTokenInfos(S,jr.IGNORE_CACHE),x=[I.get(S[0].toBase58()),I.get(S[1].toBase58()),I.get(S[2].toBase58()),I.get(S[3].toBase58()),I.get(S[4].toBase58())],E=await Rn(),T=E.getTokenInfoByMint(f[0]),P=E.getTokenInfoByMint(f[1]),B=E.getTokenInfoByMint(f[2]),L=E.getTokenInfoByMint(f[3]),$=E.getTokenInfoByMint(f[4]),R=h.tickSpacing*jr.TICK_ARRAY_SIZE,O=jr.TickUtil.getStartTickIndex(h.tickCurrentIndex,h.tickSpacing),D=[],C=[];for(let t=-Vr;t<=Vr;t++){const e=jr.TickUtil.getStartTickIndex(h.tickCurrentIndex,h.tickSpacing,t);e+R<=jr.MIN_TICK_INDEX||e>jr.MAX_TICK_INDEX||(D.push(e),C.push(jr.PDAUtil.getTickArray(d.owner,a,e).publicKey))}const N=await c.getTickArrays(C,jr.IGNORE_CACHE),z=[];D.forEach(((t,e)=>{z.push({pubkey:C[e],startTickIndex:t,startPrice:Jn(jr.PriceMath.tickIndexToPrice(t,m,g),g),isInitialized:!!N[e],hasTickCurrentIndex:t===O})}));const U=Math.ceil(jr.MIN_TICK_INDEX/h.tickSpacing)*h.tickSpacing,j=Math.floor(jr.MAX_TICK_INDEX/h.tickSpacing)*h.tickSpacing,Y=jr.TickUtil.getStartTickIndex(U,h.tickSpacing),F=jr.TickUtil.getStartTickIndex(j,h.tickSpacing),W=jr.PDAUtil.getTickArray(d.owner,a,Y).publicKey,H=jr.PDAUtil.getTickArray(d.owner,a,F).publicKey,K=await c.getTickArrays([W,H],jr.IGNORE_CACHE),q=[{pubkey:W,startTickIndex:Y,isInitialized:!!K[0]},{pubkey:H,startTickIndex:F,isInitialized:!!K[1]}],V=[];Gr.forEach((t=>{V.push(jr.PDAUtil.getWhirlpool(d.owner,h.whirlpoolsConfig,h.tokenMintA,h.tokenMintB,t).publicKey)}));const G=await c.getPools(V,jr.IGNORE_CACHE),Z=[];Gr.forEach(((t,e)=>{const n=G.get(V[e].toBase58());n&&Z.push({tickSpacing:t,feeRate:jr.PoolUtil.getFeeRate(n.feeRate).toDecimal().mul(100),pubkey:V[e],tickCurrentIndex:n.tickCurrentIndex,price:Jn(jr.PriceMath.sqrtPriceX64ToPrice(n.sqrtPrice,m,g),g),liquidity:n.liquidity})}));const X=jr.PDAUtil.getOracle(d.owner,a).publicKey;let J={downward:[],upward:[],error:!0};try{const t=function(t,e,n,r){let i,o,s,a,u,c,d;const l=t.tickCurrentIndex,h=t.tickSpacing,f=Math.floor(l/h)*h,p=f+h;i=t.tickCurrentIndex,s=t.sqrtPrice,u=t.liquidity;const m=[];for(let t=0;t<10&&(o=p+t*h,d=Jr(o,h,e),void 0===d&&o--,!(o<=i));t++){a=jr.PriceMath.tickIndexToSqrtPriceX64(o),c=Jn(jr.PriceMath.tickIndexToPrice(o,n,r),r);const t=(0,Fr.getAmountDeltaA)(s,a,u,!1),e=(0,Fr.getAmountDeltaB)(s,a,u,!0);if(m.push({tickIndex:o,price:c,amountA:bn.DecimalUtil.fromBN(new kt.BN(t),n),amountB:bn.DecimalUtil.fromBN(new kt.BN(e),r)}),void 0===d)break;i=o,s=a,u=u.add(d.liquidityNet)}i=t.tickCurrentIndex,s=t.sqrtPrice,u=t.liquidity;const g=[];for(let t=0;t<10&&(o=f-t*h,d=Jr(o,h,e),void 0!==d);t++){a=jr.PriceMath.tickIndexToSqrtPriceX64(o),c=Jn(jr.PriceMath.tickIndexToPrice(o,n,r),r);const t=(0,Fr.getAmountDeltaA)(s,a,u,!0),e=(0,Fr.getAmountDeltaB)(s,a,u,!1);g.push({tickIndex:o,price:c,amountA:bn.DecimalUtil.fromBN(new kt.BN(t),n),amountB:bn.DecimalUtil.fromBN(new kt.BN(e),r)}),i=o,s=a,u=u.sub(d.liquidityNet)}return{upward:m,downward:g,error:!1}}(h,N.slice(),m,g);J=t}catch(t){console.log(t)}let Q={downward:[],upward:[],error:!0};try{const t=function(t,e,n,r,i,o){let s,a,u,c,d,l,h;const f=t.tickCurrentIndex,p=t.tickSpacing,m=p*jr.TICK_ARRAY_SIZE,g=Math.floor(f/p)*p,y=g+p,b=Math.floor(f/m)*m,w=(b-e[0])/m,_=[],v=[],k=[],M=[],A=[];for(let t=0;w+tS);t++){c=jr.PriceMath.tickIndexToSqrtPriceX64(a),l=Jn(jr.PriceMath.tickIndexToPrice(a,i,o),o);const t=(0,Fr.getAmountDeltaA)(u,c,d,!1),e=(0,Fr.getAmountDeltaB)(u,c,d,!0),n=bn.DecimalUtil.fromBN(new kt.BN(t),i),f=bn.DecimalUtil.fromBN(new kt.BN(e),o);M[I]=M[I].add(n),A[I]=A[I].add(f),h=Jr(a,p,r),void 0!==h&&(d=d.add(h.liquidityNet)),s=a,u=c,a%m==0&&I++}const x=[],E=[],T=[],P=[],B=[];for(let t=0;w-t>=0;t++)x.push(n[w-t]),E.push(e[w-t]),T.push(r[w-t]),P.push(new fn(0)),B.push(new fn(0));const L=Math.max(jr.MIN_TICK_INDEX,b-(T.length-1)*m);let $=0;s=t.tickCurrentIndex,u=t.sqrtPrice,d=t.liquidity;for(let t=0;a=g-t*p,!(aMath.min(Math.max(t,p),m),k=v(fn.log(g.pow(2),1.0001).toDecimalPlaces(3).toNumber()),M=m-p;let A=k;function S(t,e){const r="inc"===t?1:-1,i="TA"===e?f*jr.TICK_ARRAY_SIZE:"TS"===e?f:1;n(10,A=v(A+r*i))}return t.$$set=t=>{"positionInfo"in t&&n(9,d=t.positionInfo)},t.$$.update=()=>{1024&t.$$.dirty[0]&&n(2,r=A),1024&t.$$.dirty[0]&&n(0,i=(A-p)/M*1e3),1024&t.$$.dirty[0]&&n(1,o=function(t){const e=d.derived.decimalsA,n=d.derived.decimalsB,r=new fn(10).pow(e-n),i=new fn("1.0001").pow(t).mul(r),o=new fn(1).div(i),s=new fn(1.0001).pow(t).sqrt(),a=bn.MathUtil.toX64(s),u=jr.PoolUtil.getTokenAmountsFromLiquidity(d.parsed.liquidity,a,w,_,!1),c=new fn(1).sub(s.div(b)),l=new fn(1).sub(y.div(s)),h=c.div(c.add(l)).mul(100).toFixed(2),f=l.div(c.add(l)).mul(100).toFixed(2);return{price:i.toFixed(n),invertedPrice:o.toFixed(e),withdrawableA:bn.DecimalUtil.fromBN(u.tokenA,e).toString(),withdrawableB:bn.DecimalUtil.fromBN(u.tokenB,n).toString(),ratioA:h,ratioB:f}}(A))},[i,o,r,l,h,S,function(){n(10,A=Math.round(A))},function(){n(10,A=k)},function(){var t;n(10,A=v((t=p+M*i/1e3,Math.round(1e3*t)/1e3)))},d,A,()=>S("dec","TA"),()=>S("dec","TS"),()=>S("dec","tick"),function(){r=this.value,n(2,r),n(10,A)},()=>S("inc","tick"),()=>S("inc","TS"),()=>S("inc","TA"),function(){var t;t=this.value,i=""===t?null:+t,n(0,i),n(10,A)}]}const ls=class extends gt{constructor(t){super(),mt(this,t,ds,us,a,{positionInfo:9},null,[-1,-1])}};function hs(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function fs(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/position",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[ea]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function ps(t){let e,n;return e=new Gn({props:{type:"whirlpool/whirlpool",address:t[2].parsed.whirlpool}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpool),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ms(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.positionMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.positionMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function gs(t){let e,n=t[2].parsed.liquidity+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.liquidity+"")&&B(e,n)},d(t){t&&k(e)}}}function ys(t){let e,n=t[2].parsed.tickLowerIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.tickLowerIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function bs(t){let e,n=t[2].parsed.tickUpperIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.tickUpperIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function ws(t){let e,n=t[2].parsed.feeGrowthCheckpointA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.feeGrowthCheckpointA+"")&&B(e,n)},d(t){t&&k(e)}}}function _s(t){let e,n=t[2].parsed.feeGrowthCheckpointB+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.feeGrowthCheckpointB+"")&&B(e,n)},d(t){t&&k(e)}}}function vs(t){let e,n=t[2].parsed.feeOwedA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.feeOwedA+"")&&B(e,n)},d(t){t&&k(e)}}}function ks(t){let e,n=t[2].parsed.feeOwedB+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.feeOwedB+"")&&B(e,n)},d(t){t&&k(e)}}}function Ms(t){let e,n=t[2].parsed.rewardInfos[0].amountOwed+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[0].amountOwed+"")&&B(e,n)},d(t){t&&k(e)}}}function As(t){let e,n=t[2].parsed.rewardInfos[0].growthInsideCheckpoint+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[0].growthInsideCheckpoint+"")&&B(e,n)},d(t){t&&k(e)}}}function Ss(t){let e,n,r,i;return e=new vt({props:{name:"amountOwed",type:"u64",offset:"160",$$slots:{default:[Ms]},$$scope:{ctx:t}}}),r=new vt({props:{name:"growthInsideCheckpoint",type:"u128",offset:"144",$$slots:{default:[As]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Is(t){let e,n=t[2].parsed.rewardInfos[1].amountOwed+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[1].amountOwed+"")&&B(e,n)},d(t){t&&k(e)}}}function xs(t){let e,n=t[2].parsed.rewardInfos[1].growthInsideCheckpoint+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[1].growthInsideCheckpoint+"")&&B(e,n)},d(t){t&&k(e)}}}function Es(t){let e,n,r,i;return e=new vt({props:{name:"amountOwed",type:"u64",offset:"184",$$slots:{default:[Is]},$$scope:{ctx:t}}}),r=new vt({props:{name:"growthInsideCheckpoint",type:"u128",offset:"168",$$slots:{default:[xs]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ts(t){let e,n=t[2].parsed.rewardInfos[2].amountOwed+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[2].amountOwed+"")&&B(e,n)},d(t){t&&k(e)}}}function Ps(t){let e,n=t[2].parsed.rewardInfos[2].growthInsideCheckpoint+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[2].growthInsideCheckpoint+"")&&B(e,n)},d(t){t&&k(e)}}}function Bs(t){let e,n,r,i;return e=new vt({props:{name:"amountOwed",type:"u64",offset:"208",$$slots:{default:[Ts]},$$scope:{ctx:t}}}),r=new vt({props:{name:"growthInsideCheckpoint",type:"u128",offset:"192",$$slots:{default:[Ps]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ls(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,x;return e=new vt({props:{name:"whirlpool",type:"PublicKey",offset:"8",$$slots:{default:[ps]},$$scope:{ctx:t}}}),r=new vt({props:{name:"positionMint",type:"PublicKey",offset:"40",$$slots:{default:[ms]},$$scope:{ctx:t}}}),o=new vt({props:{name:"liquidity",type:"u128",offset:"72",$$slots:{default:[gs]},$$scope:{ctx:t}}}),a=new vt({props:{name:"tickLowerIndex",type:"i32",offset:"88",$$slots:{default:[ys]},$$scope:{ctx:t}}}),c=new vt({props:{name:"tickUpperIndex",type:"i32",offset:"92",$$slots:{default:[bs]},$$scope:{ctx:t}}}),l=new vt({props:{name:"feeGrowthCheckpointA",type:"u128",offset:"96",$$slots:{default:[ws]},$$scope:{ctx:t}}}),f=new vt({props:{name:"feeGrowthCheckpointB",type:"u128",offset:"120",$$slots:{default:[_s]},$$scope:{ctx:t}}}),m=new vt({props:{name:"feeOwedA",type:"u64",offset:"112",$$slots:{default:[vs]},$$scope:{ctx:t}}}),y=new vt({props:{name:"feeOwedB",type:"u64",offset:"136",$$slots:{default:[ks]},$$scope:{ctx:t}}}),w=new vt({props:{name:"rewardInfos[0]",$$slots:{default:[Ss]},$$scope:{ctx:t}}}),M=new vt({props:{name:"rewardInfos[1]",$$slots:{default:[Es]},$$scope:{ctx:t}}}),S=new vt({props:{name:"rewardInfos[2]",$$slots:{default:[Bs]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment),A=I(),ht(S.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),v(t,A,k),ft(S,t,k),x=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};10&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k);const A={};10&n&&(A.$$scope={dirty:n,ctx:t}),S.$set(A)},i(t){x||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),ot(S.$$.fragment,t),x=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),st(S.$$.fragment,t),x=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t),t&&k(A),pt(S,t)}}}function $s(t){let e,n=t[2].derived.isBundledPosition+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isBundledPosition+"")&&B(e,n)},d(t){t&&k(e)}}}function Rs(t){let e,n;return e=new vt({props:{name:"position bundle",$$slots:{default:[Os]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Os(t){let e,n;return e=new Gn({props:{type:"whirlpool/positionbundle",address:t[2].derived.positionBundle}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.positionBundle),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ds(t){let e,n=t[2].derived.isFullRange+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isFullRange+"")&&B(e,n)},d(t){t&&k(e)}}}function Cs(t){let e,n,r,i=t[2].derived.priceLower+"",o=oa(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.priceLower+"")&&B(e,i),2&n&&o!==(o=oa(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Ns(t){let e,n,r,i=t[2].derived.priceUpper+"",o=oa(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.priceUpper+"")&&B(e,i),2&n&&o!==(o=oa(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function zs(t){let e,n,r,i=t[2].derived.invertedPriceLower+"",o=oa(t[2].derived.tokenInfoB,t[2].derived.tokenInfoA)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.invertedPriceLower+"")&&B(e,i),2&n&&o!==(o=oa(t[2].derived.tokenInfoB,t[2].derived.tokenInfoA)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Us(t){let e,n,r,i=t[2].derived.invertedPriceUpper+"",o=oa(t[2].derived.tokenInfoB,t[2].derived.tokenInfoA)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.invertedPriceUpper+"")&&B(e,i),2&n&&o!==(o=oa(t[2].derived.tokenInfoB,t[2].derived.tokenInfoA)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function js(t){let e,n,r,i=t[2].derived.amountA+"",o=ia(t[2].derived.tokenInfoA,!0)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.amountA+"")&&B(e,i),2&n&&o!==(o=ia(t[2].derived.tokenInfoA,!0)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Ys(t){let e,n,r,i=t[2].derived.amountB+"",o=ia(t[2].derived.tokenInfoB,!0)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.amountB+"")&&B(e,i),2&n&&o!==(o=ia(t[2].derived.tokenInfoB,!0)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Fs(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,L,R,O,D,C,N,z,U,j,Y,F,W,H,K,q,V=ia(t[2].derived.tokenInfoA)+"",G=t[2].derived.feeAmountA+"",Z=ia(t[2].derived.tokenInfoB)+"",X=t[2].derived.feeAmountB+"",J=ia(t[2].derived.tokenInfoR0)+"",Q=t[2].derived.rewardAmount0+"",tt=ia(t[2].derived.tokenInfoR1)+"",et=t[2].derived.rewardAmount1+"",nt=ia(t[2].derived.tokenInfoR2)+"",rt=t[2].derived.rewardAmount2+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokenamount',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("fee A"),u=S(V),c=A("td"),d=S(G),l=I(),h=A("tr"),f=A("td"),p=S("fee B"),m=S(Z),g=A("td"),y=S(X),b=I(),w=A("tr"),M=A("td"),x=S("reward0"),E=S(J),T=A("td"),L=S(Q),R=I(),O=A("tr"),D=A("td"),C=S("reward1"),N=S(tt),z=A("td"),U=S(et),j=I(),Y=A("tr"),F=A("td"),W=S("reward2"),H=S(nt),K=A("td"),q=S(rt),P(s,"class","svelte-6eiq7d"),P(c,"class","svelte-6eiq7d"),P(f,"class","svelte-6eiq7d"),P(g,"class","svelte-6eiq7d"),P(M,"class","svelte-6eiq7d"),P(T,"class","svelte-6eiq7d"),P(D,"class","svelte-6eiq7d"),P(z,"class","svelte-6eiq7d"),P(F,"class","svelte-6eiq7d"),P(K,"class","svelte-6eiq7d"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y),_(i,b),_(i,w),_(w,M),_(M,x),_(M,E),_(w,T),_(T,L),_(i,R),_(i,O),_(O,D),_(D,C),_(D,N),_(O,z),_(z,U),_(i,j),_(i,Y),_(Y,F),_(F,W),_(F,H),_(Y,K),_(K,q)},p(t,e){2&e&&V!==(V=ia(t[2].derived.tokenInfoA)+"")&&B(u,V),2&e&&G!==(G=t[2].derived.feeAmountA+"")&&B(d,G),2&e&&Z!==(Z=ia(t[2].derived.tokenInfoB)+"")&&B(m,Z),2&e&&X!==(X=t[2].derived.feeAmountB+"")&&B(y,X),2&e&&J!==(J=ia(t[2].derived.tokenInfoR0)+"")&&B(E,J),2&e&&Q!==(Q=t[2].derived.rewardAmount0+"")&&B(L,Q),2&e&&tt!==(tt=ia(t[2].derived.tokenInfoR1)+"")&&B(N,tt),2&e&&et!==(et=t[2].derived.rewardAmount1+"")&&B(U,et),2&e&&nt!==(nt=ia(t[2].derived.tokenInfoR2)+"")&&B(H,nt),2&e&&rt!==(rt=t[2].derived.rewardAmount2+"")&&B(q,rt)},d(t){t&&k(e)}}}function Ws(t){let e,n=t[2].derived.poolLiquidity+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.poolLiquidity+"")&&B(e,n)},d(t){t&&k(e)}}}function Hs(t){let e,n=t[2].derived.tickCurrentIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.tickCurrentIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function Ks(t){let e,n=t[2].derived.currentPrice+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.currentPrice+"")&&B(e,n)},d(t){t&&k(e)}}}function qs(t){let e,n,r=t[2].derived.positionMintSupply+"",i=0===t[2].derived.positionMintSupply?" (burnt)":"";return{c(){e=S(r),n=S(i)},m(t,r){v(t,e,r),v(t,n,r)},p(t,o){2&o&&r!==(r=t[2].derived.positionMintSupply+"")&&B(e,r),2&o&&i!==(i=0===t[2].derived.positionMintSupply?" (burnt)":"")&&B(n,i)},d(t){t&&k(e),t&&k(n)}}}function Vs(t){let e,n=t[2].derived.status+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.status+"")&&B(e,n)},d(t){t&&k(e)}}}function Gs(t){let e,n,r=t[2].derived.sharePercentOfLiquidity+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.sharePercentOfLiquidity+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function Zs(t){let e,n;return e=new Gn({props:{type:"whirlpool/tickarray",address:t[2].derived.lowerTickArray}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.lowerTickArray),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Xs(t){let e,n;return e=new Gn({props:{type:"whirlpool/tickarray",address:t[2].derived.upperTickArray}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.upperTickArray),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Js(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,x,E,T,P,B,L,$,R,O,D,C,N;e=new vt({props:{name:"is bundled position",$$slots:{default:[$s]},$$scope:{ctx:t}}});let z=t[2].derived.isBundledPosition&&Rs(t);return i=new vt({props:{name:"is full range",$$slots:{default:[Ds]},$$scope:{ctx:t}}}),s=new vt({props:{name:"lower price",$$slots:{default:[Cs]},$$scope:{ctx:t}}}),u=new vt({props:{name:"upper price",$$slots:{default:[Ns]},$$scope:{ctx:t}}}),d=new vt({props:{name:"inverted lower price",$$slots:{default:[zs]},$$scope:{ctx:t}}}),h=new vt({props:{name:"inverted upper price",$$slots:{default:[Us]},$$scope:{ctx:t}}}),p=new vt({props:{name:"token A amount",$$slots:{default:[js]},$$scope:{ctx:t}}}),g=new vt({props:{name:"token B amount",$$slots:{default:[Ys]},$$scope:{ctx:t}}}),b=new vt({props:{name:"harvestable amount",$$slots:{default:[Fs]},$$scope:{ctx:t}}}),_=new vt({props:{name:"pool liquidity",$$slots:{default:[Ws]},$$scope:{ctx:t}}}),A=new vt({props:{name:"current tick index",$$slots:{default:[Hs]},$$scope:{ctx:t}}}),x=new vt({props:{name:"current price",$$slots:{default:[Ks]},$$scope:{ctx:t}}}),T=new vt({props:{name:"position mint supply",$$slots:{default:[qs]},$$scope:{ctx:t}}}),B=new vt({props:{name:"position status",$$slots:{default:[Vs]},$$scope:{ctx:t}}}),$=new vt({props:{name:"share of liquidity",$$slots:{default:[Gs]},$$scope:{ctx:t}}}),O=new vt({props:{name:"lower tick array",$$slots:{default:[Zs]},$$scope:{ctx:t}}}),C=new vt({props:{name:"upper tick array",$$slots:{default:[Xs]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),z&&z.c(),r=I(),ht(i.$$.fragment),o=I(),ht(s.$$.fragment),a=I(),ht(u.$$.fragment),c=I(),ht(d.$$.fragment),l=I(),ht(h.$$.fragment),f=I(),ht(p.$$.fragment),m=I(),ht(g.$$.fragment),y=I(),ht(b.$$.fragment),w=I(),ht(_.$$.fragment),M=I(),ht(A.$$.fragment),S=I(),ht(x.$$.fragment),E=I(),ht(T.$$.fragment),P=I(),ht(B.$$.fragment),L=I(),ht($.$$.fragment),R=I(),ht(O.$$.fragment),D=I(),ht(C.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),z&&z.m(t,k),v(t,r,k),ft(i,t,k),v(t,o,k),ft(s,t,k),v(t,a,k),ft(u,t,k),v(t,c,k),ft(d,t,k),v(t,l,k),ft(h,t,k),v(t,f,k),ft(p,t,k),v(t,m,k),ft(g,t,k),v(t,y,k),ft(b,t,k),v(t,w,k),ft(_,t,k),v(t,M,k),ft(A,t,k),v(t,S,k),ft(x,t,k),v(t,E,k),ft(T,t,k),v(t,P,k),ft(B,t,k),v(t,L,k),ft($,t,k),v(t,R,k),ft(O,t,k),v(t,D,k),ft(C,t,k),N=!0},p(t,n){const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),e.$set(o),t[2].derived.isBundledPosition?z?(z.p(t,n),2&n&&ot(z,1)):(z=Rs(t),z.c(),ot(z,1),z.m(r.parentNode,r)):z&&(rt(),st(z,1,1,(()=>{z=null})),it());const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),i.$set(a);const c={};10&n&&(c.$$scope={dirty:n,ctx:t}),s.$set(c);const l={};10&n&&(l.$$scope={dirty:n,ctx:t}),u.$set(l);const f={};10&n&&(f.$$scope={dirty:n,ctx:t}),d.$set(f);const m={};10&n&&(m.$$scope={dirty:n,ctx:t}),h.$set(m);const y={};10&n&&(y.$$scope={dirty:n,ctx:t}),p.$set(y);const w={};10&n&&(w.$$scope={dirty:n,ctx:t}),g.$set(w);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),b.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),_.$set(k);const M={};10&n&&(M.$$scope={dirty:n,ctx:t}),A.$set(M);const S={};10&n&&(S.$$scope={dirty:n,ctx:t}),x.$set(S);const I={};10&n&&(I.$$scope={dirty:n,ctx:t}),T.$set(I);const E={};10&n&&(E.$$scope={dirty:n,ctx:t}),B.$set(E);const P={};10&n&&(P.$$scope={dirty:n,ctx:t}),$.$set(P);const L={};10&n&&(L.$$scope={dirty:n,ctx:t}),O.$set(L);const R={};10&n&&(R.$$scope={dirty:n,ctx:t}),C.$set(R)},i(t){N||(ot(e.$$.fragment,t),ot(z),ot(i.$$.fragment,t),ot(s.$$.fragment,t),ot(u.$$.fragment,t),ot(d.$$.fragment,t),ot(h.$$.fragment,t),ot(p.$$.fragment,t),ot(g.$$.fragment,t),ot(b.$$.fragment,t),ot(_.$$.fragment,t),ot(A.$$.fragment,t),ot(x.$$.fragment,t),ot(T.$$.fragment,t),ot(B.$$.fragment,t),ot($.$$.fragment,t),ot(O.$$.fragment,t),ot(C.$$.fragment,t),N=!0)},o(t){st(e.$$.fragment,t),st(z),st(i.$$.fragment,t),st(s.$$.fragment,t),st(u.$$.fragment,t),st(d.$$.fragment,t),st(h.$$.fragment,t),st(p.$$.fragment,t),st(g.$$.fragment,t),st(b.$$.fragment,t),st(_.$$.fragment,t),st(A.$$.fragment,t),st(x.$$.fragment,t),st(T.$$.fragment,t),st(B.$$.fragment,t),st($.$$.fragment,t),st(O.$$.fragment,t),st(C.$$.fragment,t),N=!1},d(t){pt(e,t),t&&k(n),z&&z.d(t),t&&k(r),pt(i,t),t&&k(o),pt(s,t),t&&k(a),pt(u,t),t&&k(c),pt(d,t),t&&k(l),pt(h,t),t&&k(f),pt(p,t),t&&k(m),pt(g,t),t&&k(y),pt(b,t),t&&k(w),pt(_,t),t&&k(M),pt(A,t),t&&k(S),pt(x,t),t&&k(E),pt(T,t),t&&k(P),pt(B,t),t&&k(L),pt($,t),t&&k(R),pt(O,t),t&&k(D),pt(C,t)}}}function Qs(t){let e,n;return e=new ls({props:{positionInfo:t[2]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.positionInfo=t[2]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ta(t){let e,n;return e=new vt({props:{name:"simulation",$$slots:{default:[Qs]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ea(t){let e,n,r,i,o,s;return e=new yr({props:{$$slots:{default:[Ls]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Js]},$$scope:{ctx:t}}}),o=new oi({props:{$$slots:{default:[ta]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function na(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function ra(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/src/state/position.rs#L20"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:na,then:fs,catch:hs,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🌀Whirlpool::Position "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function ia(t,e=!1){return void 0===t?"":e?t.symbol:`(${t.symbol})`}function oa(t,e){return void 0===t||void 0===e?"":`${e.symbol}/${t.symbol}`}function sa(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){var e,n,r,i,o,s;const a=bn.AddressUtil.toPubKey(t),u=It(),c=(0,jr.buildDefaultAccountFetcher)(u),{accountInfo:d,slotContext:l}=await Zn(u,a),h=jr.ParsablePosition.parse(a,d),f=await c.getPool(h.whirlpool,jr.IGNORE_CACHE),p=Yr.PositionUtil.getPositionStatus(f.tickCurrentIndex,h.tickLowerIndex,h.tickUpperIndex);let m=new fn(0);p!==Yr.PositionStatus.InRange||h.liquidity.isZero()||(m=Jn(new fn(h.liquidity.toString()).div(f.liquidity.toString()).mul(100),9));const g=[];g.push(f.tokenMintA),g.push(f.tokenMintB),g.push(f.rewardInfos[0].mint),g.push(f.rewardInfos[1].mint),g.push(f.rewardInfos[2].mint),g.push(h.positionMint);const y=await c.getMintInfos(g,jr.IGNORE_CACHE),b=y.get(g[0].toBase58()).decimals,w=y.get(g[1].toBase58()).decimals,_=null===(e=y.get(g[2].toBase58()))||void 0===e?void 0:e.decimals,v=null===(n=y.get(g[3].toBase58()))||void 0===n?void 0:n.decimals,k=null===(r=y.get(g[4].toBase58()))||void 0===r?void 0:r.decimals,M=Zr(y.get(g[0].toBase58()).tokenProgram),A=Zr(y.get(g[1].toBase58()).tokenProgram),S=Zr(null===(i=y.get(g[2].toBase58()))||void 0===i?void 0:i.tokenProgram),I=Zr(null===(o=y.get(g[3].toBase58()))||void 0===o?void 0:o.tokenProgram),x=Zr(null===(s=y.get(g[4].toBase58()))||void 0===s?void 0:s.tokenProgram),E=Number(y.get(g[5].toBase58()).supply.toString()),T=Jn(jr.PriceMath.tickIndexToPrice(h.tickLowerIndex,b,w),w),P=Jn(jr.PriceMath.tickIndexToPrice(h.tickUpperIndex,b,w),w),B=Jn(new fn(1).div(jr.PriceMath.tickIndexToPrice(h.tickUpperIndex,b,w)),b),L=Jn(new fn(1).div(jr.PriceMath.tickIndexToPrice(h.tickLowerIndex,b,w)),b),$=jr.PoolUtil.getTokenAmountsFromLiquidity(h.liquidity,f.sqrtPrice,jr.PriceMath.tickIndexToSqrtPriceX64(h.tickLowerIndex),jr.PriceMath.tickIndexToSqrtPriceX64(h.tickUpperIndex),!1),R=[];R.push(jr.PDAUtil.getTickArray(d.owner,h.whirlpool,jr.TickUtil.getStartTickIndex(h.tickLowerIndex,f.tickSpacing)).publicKey),R.push(jr.PDAUtil.getTickArray(d.owner,h.whirlpool,jr.TickUtil.getStartTickIndex(h.tickUpperIndex,f.tickSpacing)).publicKey);const O=await c.getTickArrays(R,jr.IGNORE_CACHE),D=jr.TickArrayUtil.getTickFromArray(O[0],h.tickLowerIndex,f.tickSpacing),C=jr.TickArrayUtil.getTickFromArray(O[1],h.tickUpperIndex,f.tickSpacing),N=await Wr.TokenExtensionUtil.buildTokenExtensionContext(c,f,jr.IGNORE_CACHE),z=(0,jr.collectFeesQuote)({position:h,tickLower:D,tickUpper:C,whirlpool:f,tokenExtensionCtx:N}),U=(0,jr.collectRewardsQuote)({position:h,tickLower:D,tickUpper:C,whirlpool:f,tokenExtensionCtx:N}),j=await Rn(),Y=j.getTokenInfoByMint(g[0]),F=j.getTokenInfoByMint(g[1]),W=j.getTokenInfoByMint(g[2]),H=j.getTokenInfoByMint(g[3]),K=j.getTokenInfoByMint(g[4]),q=jr.PDAUtil.getPosition(d.owner,h.positionMint).publicKey,V=jr.PDAUtil.getPositionBundle(d.owner,h.positionMint).publicKey,G=!q.equals(a),Z=Math.ceil(jr.MIN_TICK_INDEX/f.tickSpacing)*f.tickSpacing,X=Math.floor(jr.MAX_TICK_INDEX/f.tickSpacing)*f.tickSpacing,J=h.tickLowerIndex===Z&&h.tickUpperIndex===X;return{meta:Xn(a,d,l),parsed:h,derived:{priceLower:T,priceUpper:P,invertedPriceLower:B,invertedPriceUpper:L,amounts:$,amountA:bn.DecimalUtil.fromBN($.tokenA,b),amountB:bn.DecimalUtil.fromBN($.tokenB,w),decimalsA:b,decimalsB:w,decimalsR0:_,decimalsR1:v,decimalsR2:k,tokenProgramA:M,tokenProgramB:A,tokenProgramR0:S,tokenProgramR1:I,tokenProgramR2:x,tokenMintA:f.tokenMintA,tokenMintB:f.tokenMintB,tokenMintR0:f.rewardInfos[0].mint,tokenMintR1:f.rewardInfos[1].mint,tokenMintR2:f.rewardInfos[2].mint,tokenInfoA:Y,tokenInfoB:F,tokenInfoR0:W,tokenInfoR1:H,tokenInfoR2:K,feeQuote:z,feeAmountA:bn.DecimalUtil.fromBN(z.feeOwedA,b),feeAmountB:bn.DecimalUtil.fromBN(z.feeOwedB,w),rewardsQuote:U,rewardAmount0:void 0===U[0]?void 0:bn.DecimalUtil.fromBN(U[0],_),rewardAmount1:void 0===U[1]?void 0:bn.DecimalUtil.fromBN(U[1],v),rewardAmount2:void 0===U[2]?void 0:bn.DecimalUtil.fromBN(U[2],k),status:p===Yr.PositionStatus.InRange?Xr.PriceIsInRange:p===Yr.PositionStatus.AboveRange?Xr.PriceIsAboveRange:Xr.PriceIsBelowRange,sharePercentOfLiquidity:m,tickCurrentIndex:f.tickCurrentIndex,currentSqrtPrice:f.sqrtPrice,currentPrice:Jn(jr.PriceMath.sqrtPriceX64ToPrice(f.sqrtPrice,b,w),w),poolLiquidity:f.liquidity,poolTickSpacing:f.tickSpacing,lowerTickArray:R[0],upperTickArray:R[1],isBundledPosition:G,isFullRange:J,positionBundle:G?V:void 0,positionMintSupply:E}}}(i.pubkey))},[i,r]}function aa(t,e,n){const r=t.slice();return r[3]=e[n],r}function ua(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function ca(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/config",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[_a]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};66&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function da(t){let e,n;return e=new Gn({props:{address:t[2].parsed.feeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.feeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function la(t){let e,n;return e=new Gn({props:{address:t[2].parsed.collectProtocolFeesAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.collectProtocolFeesAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ha(t){let e,n;return e=new Gn({props:{address:t[2].parsed.rewardEmissionsSuperAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.rewardEmissionsSuperAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function fa(t){let e,n=t[2].parsed.defaultProtocolFeeRate+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.defaultProtocolFeeRate+"")&&B(e,n)},d(t){t&&k(e)}}}function pa(t){let e,n,r,i,o,s,a,u;return e=new vt({props:{name:"feeAuthority",type:"PublicKey",offset:"8",$$slots:{default:[da]},$$scope:{ctx:t}}}),r=new vt({props:{name:"collectProtocolFeesAuthority",type:"PublicKey",offset:"40",$$slots:{default:[la]},$$scope:{ctx:t}}}),o=new vt({props:{name:"rewardEmissionsSuperAuthority",type:"PublicKey",offset:"72",$$slots:{default:[ha]},$$scope:{ctx:t}}}),a=new vt({props:{name:"defaultProtocolFeeRate",type:"u16",offset:"104",$$slots:{default:[fa]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment)},m(t,c){ft(e,t,c),v(t,n,c),ft(r,t,c),v(t,i,c),ft(o,t,c),v(t,s,c),ft(a,t,c),u=!0},p(t,n){const i={};66&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};66&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};66&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const c={};66&n&&(c.$$scope={dirty:n,ctx:t}),a.$set(c)},i(t){u||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),u=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),u=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t)}}}function ma(t){let e,n,r=t[2].derived.defaultProtocolFeeRate+"";return{c(){e=S(r),n=S(" % of fee")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.defaultProtocolFeeRate+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function ga(t){let e,n;return e=new Gn({props:{type:"whirlpool/configextension",address:t[2].derived.configExtension}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.configExtension),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ya(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,g,y=t[3].tickSpacing+"",b=t[3].isInitialized+"",w=(void 0===t[3].defaultFeeRate?void 0:t[3].defaultFeeRate+" %")+"";return h=new Gn({props:{type:"whirlpool/feetier",address:t[3].pubkey,short:!0}}),{c(){e=A("tr"),n=A("td"),r=S(y),i=I(),o=A("td"),s=S(b),a=I(),u=A("td"),c=S(w),d=I(),l=A("td"),ht(h.$$.fragment),f=I(),P(n,"class","svelte-v6w8v6"),P(o,"class","svelte-v6w8v6"),P(u,"class","svelte-v6w8v6"),P(l,"class","svelte-v6w8v6"),P(e,"class",p=m(t[3].isInitialized?"initialized":"uninitialized")+" svelte-v6w8v6")},m(t,p){v(t,e,p),_(e,n),_(n,r),_(e,i),_(e,o),_(o,s),_(e,a),_(e,u),_(u,c),_(e,d),_(e,l),ft(h,l,null),_(e,f),g=!0},p(t,n){(!g||2&n)&&y!==(y=t[3].tickSpacing+"")&&B(r,y),(!g||2&n)&&b!==(b=t[3].isInitialized+"")&&B(s,b),(!g||2&n)&&w!==(w=(void 0===t[3].defaultFeeRate?void 0:t[3].defaultFeeRate+" %")+"")&&B(c,w);const i={};2&n&&(i.address=t[3].pubkey),h.$set(i),(!g||2&n&&p!==(p=m(t[3].isInitialized?"initialized":"uninitialized")+" svelte-v6w8v6"))&&P(e,"class",p)},i(t){g||(ot(h.$$.fragment,t),g=!0)},o(t){st(h.$$.fragment,t),g=!1},d(t){t&&k(e),pt(h)}}}function ba(t){let e,n,r,i,o,s=t[2].derived.feeTiers,a=[];for(let e=0;est(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='tick spacinginitializeddefault fee ratepubkey',r=I(),i=A("tbody");for(let t=0;to.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Ma(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=jr.ParsableWhirlpoolsConfig.parse(e,r),s=[];for(let t=1;t<65536;t*=2)s.push(jr.PDAUtil.getFeeTier(r.owner,e,t).publicKey);const a=await n.getMultipleAccountsInfo(s),u=[];a.forEach(((t,e)=>{const n=jr.ParsableFeeTier.parse(s[e],t);u.push({pubkey:s[e],tickSpacing:2**e,isInitialized:null!==n,defaultFeeRate:null===n?void 0:jr.PoolUtil.getFeeRate(n.defaultFeeRate).toDecimal().mul(100)})}));const c=jr.PDAUtil.getConfigExtension(r.owner,e).publicKey;return{meta:Xn(e,r,i),parsed:o,derived:{defaultProtocolFeeRate:jr.PoolUtil.getProtocolFeeRate(o.defaultProtocolFeeRate).toDecimal().mul(100),configExtension:c,feeTiers:u}}}(i.pubkey))},[i,r]}function Aa(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Sa(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/configextension",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Pa]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ia(t){let e,n;return e=new Gn({props:{type:"whirlpool/config",address:t[2].parsed.whirlpoolsConfig}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpoolsConfig),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function xa(t){let e,n;return e=new Gn({props:{address:t[2].parsed.configExtensionAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.configExtensionAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ea(t){let e,n;return e=new Gn({props:{address:t[2].parsed.tokenBadgeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.tokenBadgeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ta(t){let e,n,r,i,o,s;return e=new vt({props:{name:"whirlpoolsConfig",type:"PublicKey",offset:"8",$$slots:{default:[Ia]},$$scope:{ctx:t}}}),r=new vt({props:{name:"configExtensionAuthority",type:"PublicKey",offset:"40",$$slots:{default:[xa]},$$scope:{ctx:t}}}),o=new vt({props:{name:"tokenBadgeAuthority",type:"PublicKey",offset:"72",$$slots:{default:[Ea]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function Pa(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Ta]},$$scope:{ctx:t}}}),r=new _r({}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ba(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function La(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/src/state/config_extension.rs#L11"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Ba,then:Sa,catch:Aa,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🌀Whirlpool::WhirlpoolsConfigExtension "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function $a(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=jr.ParsableWhirlpoolsConfigExtension.parse(e,r);return{meta:Xn(e,r,i),parsed:o,derived:{}}}(i.pubkey))},[i,r]}function Ra(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Oa(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/tokenbadge",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[za]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Da(t){let e,n;return e=new Gn({props:{type:"whirlpool/config",address:t[2].parsed.whirlpoolsConfig}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpoolsConfig),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ca(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[2].parsed.tokenMint,program:t[2].derived.tokenProgram}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.tokenMint),2&n&&(r.program=t[2].derived.tokenProgram),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Na(t){let e,n,r,i;return e=new vt({props:{name:"whirlpoolsConfig",type:"PublicKey",offset:"8",$$slots:{default:[Da]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tokenMint",type:"PublicKey",offset:"40",$$slots:{default:[Ca]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function za(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Na]},$$scope:{ctx:t}}}),r=new _r({}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ua(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function ja(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/src/state/token_badge.rs#L5"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Ua,then:Oa,catch:Ra,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🌀Whirlpool::TokenBadge "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Ya(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=jr.ParsableTokenBadge.parse(e,i),a=await r.getMintInfo(s.tokenMint,jr.IGNORE_CACHE);return{meta:Xn(e,i,o),parsed:s,derived:{tokenProgram:Zr(a.tokenProgram)}}}(i.pubkey))},[i,r]}function Fa(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Wa(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/feetier",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Xa]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ha(t){let e,n;return e=new Gn({props:{type:"whirlpool/config",address:t[2].parsed.whirlpoolsConfig}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpoolsConfig),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ka(t){let e,n=t[2].parsed.tickSpacing+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.tickSpacing+"")&&B(e,n)},d(t){t&&k(e)}}}function qa(t){let e,n=t[2].parsed.defaultFeeRate+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.defaultFeeRate+"")&&B(e,n)},d(t){t&&k(e)}}}function Va(t){let e,n,r,i,o,s;return e=new vt({props:{name:"whirlpoolsConfig",type:"PublicKey",offset:"8",$$slots:{default:[Ha]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tickSpacing",type:"u16",offset:"40",$$slots:{default:[Ka]},$$scope:{ctx:t}}}),o=new vt({props:{name:"defaultFeeRate",type:"u16",offset:"42",$$slots:{default:[qa]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function Ga(t){let e,n,r=t[2].derived.defaultFeeRate+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.defaultFeeRate+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function Za(t){let e,n;return e=new vt({props:{name:"default fee rate",$$slots:{default:[Ga]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Xa(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Va]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Za]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ja(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Qa(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/src/state/fee_tier.rs#L12"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Ja,then:Wa,catch:Fa,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🌀Whirlpool::FeeTier "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function tu(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=jr.ParsableFeeTier.parse(e,r);return{meta:Xn(e,r,i),parsed:o,derived:{defaultFeeRate:jr.PoolUtil.getFeeRate(o.defaultFeeRate).toDecimal().mul(100)}}}(i.pubkey))},[i,r]}function eu(t,e,n){const r=t.slice();return r[3]=e[n],r[5]=n,r}function nu(t,e,n){const r=t.slice();return r[3]=e[n],r[5]=n,r}function ru(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function iu(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/tickarray",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[_u]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};130&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function ou(t){let e,n;return e=new Gn({props:{type:"whirlpool/whirlpool",address:t[2].parsed.whirlpool}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpool),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function su(t){let e,n=t[2].parsed.startTickIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.startTickIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function au(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p=t[2].parsed.startTickIndex+t[5]*t[2].derived.tickSpacing+"",g=t[3].initialized+"",y=t[3].liquidityNet+"";return{c(){e=A("tr"),n=A("td"),r=S(t[5]),i=I(),o=A("td"),s=S(p),a=I(),u=A("td"),c=S(g),d=I(),l=A("td"),h=S(y),P(n,"class","svelte-v6w8v6"),P(o,"class","svelte-v6w8v6"),P(u,"class","svelte-v6w8v6"),P(l,"class","svelte-v6w8v6"),P(e,"class",f=m(t[3].initialized?"initialized":"uninitialized")+" svelte-v6w8v6")},m(t,f){v(t,e,f),_(e,n),_(n,r),_(e,i),_(e,o),_(o,s),_(e,a),_(e,u),_(u,c),_(e,d),_(e,l),_(l,h)},p(t,n){2&n&&p!==(p=t[2].parsed.startTickIndex+t[5]*t[2].derived.tickSpacing+"")&&B(s,p),2&n&&g!==(g=t[3].initialized+"")&&B(c,g),2&n&&y!==(y=t[3].liquidityNet+"")&&B(h,y),2&n&&f!==(f=m(t[3].initialized?"initialized":"uninitialized")+" svelte-v6w8v6")&&P(e,"class",f)},d(t){t&&k(e)}}}function uu(t){let e,n,r,i,o,s,a,u,c=t[2].parsed.ticks,d=[];for(let e=0;eoffsettick indexinitializedliquidity net',r=I(),i=A("tbody"),o=A("tr"),o.innerHTML='A to B direction (price down)',s=I();for(let t=0;tB to A direction (price up)',$(e,"border-spacing","0")},m(t,c){v(t,e,c),_(e,n),_(e,r),_(e,i),_(i,o),_(i,s);for(let t=0;t{r=null})),it())},i(t){n||(ot(r),n=!0)},o(t){st(r),n=!1},d(t){r&&r.d(t),t&&k(e)}}}function hu(t){let e,n,r=t[2].parsed.ticks,i=[];for(let e=0;est(i[t],1,1,(()=>{i[t]=null}));return{c(){for(let t=0;to.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Mu(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=jr.ParsableTickArray.parse(e,i),a=await r.getPool(s.whirlpool,jr.IGNORE_CACHE),u=a.tickSpacing*jr.TICK_ARRAY_SIZE,c=jr.PDAUtil.getTickArray(i.owner,s.whirlpool,s.startTickIndex-u).publicKey,d=jr.PDAUtil.getTickArray(i.owner,s.whirlpool,s.startTickIndex+u).publicKey;return{meta:Xn(e,i,o),parsed:s,derived:{prevTickArray:c,nextTickArray:d,tickCurrentIndex:a.tickCurrentIndex,tickSpacing:a.tickSpacing,ticksInArray:u}}}(i.pubkey))},[i,r]}function Au(t,e,n){const r=t.slice();return r[4]=e[n],r}function Su(t,e,n){const r=t.slice();return r[7]=e[n],r[9]=n,r}function Iu(t,e,n){const r=t.slice();return r[10]=e[n],r}function xu(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Eu(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/tickarray",meta:t[3].meta}}),r=new Mr({props:{$$slots:{default:[zu]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[3].meta),e.$set(i);const o={};8194&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Tu(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[3].parsed.positionBundleMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.positionBundleMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Pu(t){let e,n,r=(t[10]?1:0)+"";return{c(){e=A("td"),n=S(r),P(e,"class","svelte-1i4wn2p")},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=(t[10]?1:0)+"")&&B(n,r)},d(t){t&&k(e)}}}function Bu(t){let e,n,r,i,o;function s(...e){return t[2](t[7],...e)}let a=[0,1,2,3,4,5,6,7].map(s),u=[];for(let e=0;eindex01234567',r=I(),i=A("tbody");for(let t=0;tst(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='indexpositionwhirlpooltickLowerIndextickUpperIndexliquidity',r=I(),i=A("tbody");for(let t=0;to.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Yu(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=jr.ParsablePositionBundle.parse(e,i),a=await r.getMintInfo(s.positionBundleMint,jr.IGNORE_CACHE),u=Number(a.supply.toString()),c=jr.PositionBundleUtil.getOccupiedBundleIndexes(s),d=c.map((t=>jr.PDAUtil.getBundledPosition(i.owner,s.positionBundleMint,t).publicKey)),l=await r.getPositions(d,jr.IGNORE_CACHE),h=d.map((t=>l.get(t.toBase58()))),f=[];for(let t=0;t(t&1<0]}function Fu(t,e,n){const r=t.slice();return r[12]=e[n],r}function Wu(e){return{c:t,m:t,p:t,d:t}}function Hu(t){let e,n,r,i,o=t[11],s=[];for(let e=0;enamemintAmintBtickSpacingprice$TVLday $volume',r=I(),i=A("tbody");for(let t=0;tlt(f,"selected",S)));let R={ctx:t,current:null,token:null,hasCatch:!1,pending:qu,then:Hu,catch:Wu,value:11};return at(y=t[2],R),{c(){e=A("h2"),e.textContent="🌀Whirlpool::list",n=I(),r=A("form"),i=A("input"),s=I(),a=A("input"),u=I(),c=A("div"),d=A("div"),d.textContent="order by",l=I(),h=A("div"),ht(f.$$.fragment),m=I(),g=x(),R.block.c(),$(i,"margin","0.5em 0em"),P(i,"type","text"),P(i,"size","64"),P(i,"placeholder","SOL/USDC or orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE"),P(a,"type","submit"),a.value="Set Filter!",$(r,"margin-bottom","0em"),$(c,"margin-top","0.5em"),$(c,"margin-left","0em"),$(c,"margin-bottom","1.0em"),$(c,"font-size","smaller"),$(c,"display","flex"),$(c,"flex-direction","row")},m(o,p){v(o,e,p),v(o,n,p),v(o,r,p),_(r,i),L(i,t[1]),_(r,s),_(r,a),v(o,u,p),v(o,c,p),_(c,d),_(c,l),_(c,h),ft(f,h,null),v(o,m,p),v(o,g,p),R.block.m(o,R.anchor=p),R.mount=()=>g.parentNode,R.anchor=g,b=!0,w||(M=[E(i,"input",t[6]),E(r,"submit",T(t[4]))],w=!0)},p(e,[n]){t=e,2&n&&i.value!==t[1]&&L(i,t[1]);const r={};!p&&1&n&&(p=!0,r.selected=t[0],G((()=>p=!1))),f.$set(r),R.ctx=t,4&n&&y!==(y=t[2])&&at(y,R)||ut(R,t,n)},i(t){b||(ot(f.$$.fragment,t),b=!0)},o(t){st(f.$$.fragment,t),b=!1},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(u),t&&k(c),pt(f),t&&k(m),t&&k(g),R.block.d(t),R.token=null,R=null,w=!1,o(M)}}}function Gu(t,e,n){let r,i;var o;!function(t){t.volumeDesc="day $volume (desc)",t.volumeAsc="day $volume (asc)",t.tvlDesc="$TVL (desc)",t.tvlAsc="$TVL (asc)",t.nameAsc="name (asc)"}(o||(o={}));const s=Object.values(o);let a,u=s.indexOf(o.volumeDesc);return t.$$.update=()=>{33&t.$$.dirty&&n(2,i=async function(t,e){return(await async function(){const t=yn()();if(null!==Tn&&Pn.isAfter(t))return Tn;const e=await(await mn()("https://api.mainnet.orca.so/v1/whirlpool/list")).json(),n=[];return e.whirlpools.forEach((t=>{var e,r,i;const o=zn(t.tokenA.symbol,t.tokenA.mint),s=zn(t.tokenB.symbol,t.tokenB.mint);n.push({address:new Mt.PublicKey(t.address),name:`${o}/${s}(${t.tickSpacing})`,invertedName:`${s}/${o}(${t.tickSpacing})`,symbolA:o,symbolB:s,mintA:new Mt.PublicKey(t.tokenA.mint),mintB:new Mt.PublicKey(t.tokenB.mint),tickSpacing:t.tickSpacing,price:new fn(t.price),usdTVL:new fn(null!==(e=t.tvl)&&void 0!==e?e:0),usdVolumeDay:new fn(null!==(i=null===(r=t.volume)||void 0===r?void 0:r.day)&&void 0!==i?i:0)})})),Pn=t.add("15","m"),Tn=n,Tn}()).filter((e=>0==t.length||e.name.toUpperCase().indexOf(t.toUpperCase())>=0||e.invertedName.toUpperCase().indexOf(t.toUpperCase())>=0||e.mintA.toBase58().indexOf(t)>=0||e.mintB.toBase58().indexOf(t)>=0)).sort(e)}(r,function(t){switch(s[t]){case o.volumeDesc:return(t,e)=>e.usdVolumeDay.cmp(t.usdVolumeDay);case o.volumeAsc:return(t,e)=>t.usdVolumeDay.cmp(e.usdVolumeDay);case o.tvlDesc:return(t,e)=>e.usdTVL.cmp(t.usdTVL);case o.tvlAsc:return(t,e)=>t.usdTVL.cmp(e.usdTVL);case o.nameAsc:return En;default:return(t,e)=>0}}(u)))},n(5,r=""),[u,a,i,s,function(){n(5,r=a)},r,function(){a=this.value,n(1,a)},function(t){u=t,n(0,u)}]}function Zu(t,e,n){const r=t.slice();return r[20]=e[n],r}function Xu(e){let n,r=e[23].message+"";return{c(){n=S(r)},m(t,e){v(t,n,e)},p(t,e){32&e&&r!==(r=t[23].message+"")&&B(n,r)},i:t,o:t,d(t){t&&k(n)}}}function Ju(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,x,E,T,L,R,O,D,C,N,z,U,j,Y,F,W,H,K,q,V,G,Z,X,J,Q,tt,et,nt,at,ut,ct,dt,lt,mt,gt,yt,bt,wt,_t,vt,kt,Mt,At,St,It,xt,Et,Tt,Pt,Bt,Lt,$t,Rt,Ot,Dt,Ct,Nt,zt=t[19].positionSummary.numPositions+"",Ut=t[19].positionSummary.numZeroLiquidityPositions+"",jt=t[9](t[19].positionSummary.numZeroLiquidityPositions,t[19].positionSummary.numPositions)+"",Yt=t[19].positionSummary.numFullRangePositions+"",Ft=t[9](t[19].positionSummary.numFullRangePositions,t[19].positionSummary.numPositions)+"",Wt=t[19].positionSummary.numStatusPriceIsInRangePositions+"",Ht=t[9](t[19].positionSummary.numStatusPriceIsInRangePositions,t[19].positionSummary.numPositions)+"",Kt=t[19].positionSummary.numStatusPriceIsAboveRangePositions+"",qt=t[9](t[19].positionSummary.numStatusPriceIsAboveRangePositions,t[19].positionSummary.numPositions)+"",Vt=t[19].positionSummary.numStatusPriceIsBelowRangePositions+"",Gt=t[9](t[19].positionSummary.numStatusPriceIsBelowRangePositions,t[19].positionSummary.numPositions)+"",Zt=t[7][t[4]]===t[3].TickIndex?"tickLowerIndex":"lowerPrice",Xt=t[7][t[4]]===t[3].TickIndex?"tickUpperIndex":"upperPrice",Jt=nc(t[19].whirlpool.derived.tokenInfoA)+"",Qt=nc(t[19].whirlpool.derived.tokenInfoB)+"";i=new Gn({props:{type:"whirlpool/whirlpool",address:t[19].whirlpool.meta.pubkey}});let te=t[19].positions,ee=[];for(let e=0;est(ee[t],1,1,(()=>{ee[t]=null}));return{c(){e=A("h4"),e.textContent="whirlpool",n=I(),r=A("div"),ht(i.$$.fragment),o=I(),s=A("h4"),s.textContent="summary",a=I(),u=A("table"),c=A("tr"),d=A("td"),d.textContent="all positions",l=A("td"),h=S(zt),f=A("td"),p=I(),m=A("tr"),g=A("td"),g.textContent="0 liquidity",y=A("td"),b=S(Ut),w=A("td"),x=S(jt),E=I(),T=A("tr"),L=A("td"),L.textContent="full range",R=A("td"),O=S(Yt),D=A("td"),C=S(Ft),N=I(),z=A("tr"),U=A("td"),U.textContent="status: In Range",j=A("td"),Y=S(Wt),F=A("td"),W=S(Ht),H=I(),K=A("tr"),q=A("td"),q.textContent="status: Price is Above",V=A("td"),G=S(Kt),Z=A("td"),X=S(qt),J=I(),Q=A("tr"),tt=A("td"),tt.textContent="status: Price is Below",et=A("td"),nt=S(Vt),at=A("td"),ut=S(Gt),ct=I(),dt=A("h4"),dt.textContent="positions",lt=I(),mt=A("table"),gt=A("thead"),yt=A("th"),yt.textContent="position",bt=I(),wt=A("th"),wt.textContent="status",_t=I(),vt=A("th"),vt.textContent="liquidity",kt=I(),Mt=A("th"),At=S(Zt),St=I(),It=A("th"),xt=S(Xt),Et=I(),Tt=A("th"),Pt=S("tokenA"),Bt=S(Jt),Lt=I(),$t=A("th"),Rt=S("tokenB"),Ot=S(Qt),Dt=I(),Ct=A("tbody");for(let t=0;tlt(y,"selected",F)));let K={group:"orderBy",values:t[6]};void 0!==t[2]&&(K.selected=t[2]),R=new Ii({props:K}),j.push((()=>lt(R,"selected",H)));let q={ctx:t,current:null,token:null,hasCatch:!0,pending:tc,then:Ju,catch:Xu,value:19,error:23,blocks:[,,,]};return at(N=t[5],q),{c(){e=A("h2"),e.textContent="🌀Whirlpool::listPositions",n=I(),r=A("div"),i=A("div"),s=A("input"),a=S(" hide 0 liquidity positions"),u=I(),c=A("div"),d=A("input"),l=S(" hide Out of Range positions"),h=I(),f=A("div"),p=A("div"),p.textContent="display with",m=I(),g=A("div"),ht(y.$$.fragment),w=I(),M=A("div"),T=A("div"),T.textContent="order by",B=I(),L=A("div"),ht(R.$$.fragment),D=I(),C=x(),q.block.c(),P(s,"type","checkbox"),P(d,"type","checkbox"),$(f,"margin-top","0.5em"),$(f,"margin-left","0.2em"),$(f,"display","flex"),$(f,"flex-direction","row"),$(M,"margin-top","0.5em"),$(M,"margin-left","0.2em"),$(M,"display","flex"),$(M,"flex-direction","row"),$(r,"margin-bottom","1em"),$(r,"font-size","smaller")},m(o,b){v(o,e,b),v(o,n,b),v(o,r,b),_(r,i),_(i,s),s.checked=t[0],_(i,a),_(r,u),_(r,c),_(c,d),d.checked=t[1],_(c,l),_(r,h),_(r,f),_(f,p),_(f,m),_(f,g),ft(y,g,null),_(r,w),_(r,M),_(M,T),_(M,B),_(M,L),ft(R,L,null),v(o,D,b),v(o,C,b),q.block.m(o,q.anchor=b),q.mount=()=>C.parentNode,q.anchor=C,z=!0,U||(Y=[E(s,"change",t[12]),E(d,"change",t[13])],U=!0)},p(e,[n]){t=e,1&n&&(s.checked=t[0]),2&n&&(d.checked=t[1]);const r={};!b&&16&n&&(b=!0,r.selected=t[4],G((()=>b=!1))),y.$set(r);const i={};!O&&4&n&&(O=!0,i.selected=t[2],G((()=>O=!1))),R.$set(i),q.ctx=t,32&n&&N!==(N=t[5])&&at(N,q)||ut(q,t,n)},i(t){z||(ot(y.$$.fragment,t),ot(R.$$.fragment,t),ot(q.block),z=!0)},o(t){st(y.$$.fragment,t),st(R.$$.fragment,t);for(let t=0;t<3;t+=1)st(q.blocks[t]);z=!1},d(t){t&&k(e),t&&k(n),t&&k(r),pt(y),pt(R),t&&k(D),t&&k(C),q.block.d(t),q.token=null,q=null,U=!1,o(Y)}}}function nc(t,e=!1){return void 0===t?"":e?t.symbol:`(${t.symbol})`}function rc(t,e,n){let r,i,{params:o}=e,s=!1,a=!1;var u;!function(t){t.LiquidityDesc="liquidity (desc)",t.TickLowerIndexAsc="tickLowerIndex (asc)",t.TickUpperIndexDesc="tickUpperIndex (desc)",t.TokenADesc="tokenA (desc)",t.TokenBDesc="tokenB (desc)"}(u||(u={}));const c=Object.values(u);let d=c.indexOf(u.TickLowerIndexAsc);var l;!function(t){t.TickIndex="tickIndex",t.Price="price"}(l||(l={}));const h=Object.values(l);let f=h.indexOf(l.TickIndex);return t.$$set=t=>{"params"in t&&n(10,o=t.params)},t.$$.update=()=>{1024&t.$$.dirty&&n(11,r=async function(t){var e,n,r,i,o,s;const a=bn.AddressUtil.toPubKey(t),u=It(),c=(0,jr.buildDefaultAccountFetcher)(u),{accountInfo:d,slotContext:l}=await Zn(u,a),h=jr.ParsableWhirlpool.parse(a,d),f=d.owner,p=[];p.push(h.tokenMintA),p.push(h.tokenMintB),p.push(h.rewardInfos[0].mint),p.push(h.rewardInfos[1].mint),p.push(h.rewardInfos[2].mint);const m=await c.getMintInfos(p,jr.IGNORE_CACHE),g=m.get(p[0].toBase58()).decimals,y=m.get(p[1].toBase58()).decimals,b=null===(e=m.get(p[2].toBase58()))||void 0===e?void 0:e.decimals,w=null===(n=m.get(p[3].toBase58()))||void 0===n?void 0:n.decimals,_=null===(r=m.get(p[4].toBase58()))||void 0===r?void 0:r.decimals,v=Zr(m.get(p[0].toBase58()).tokenProgram),k=Zr(m.get(p[1].toBase58()).tokenProgram),M=Zr(null===(i=m.get(p[2].toBase58()))||void 0===i?void 0:i.tokenProgram),A=Zr(null===(o=m.get(p[3].toBase58()))||void 0===o?void 0:o.tokenProgram),S=Zr(null===(s=m.get(p[4].toBase58()))||void 0===s?void 0:s.tokenProgram),I=await Rn(),x=I.getTokenInfoByMint(p[0]),E=I.getTokenInfoByMint(p[1]),T=I.getTokenInfoByMint(p[2]),P=I.getTokenInfoByMint(p[3]),B=I.getTokenInfoByMint(p[4]),L={meta:Xn(a,d,l),parsed:h,derived:{decimalsA:g,decimalsB:y,decimalsR0:b,decimalsR1:w,decimalsR2:_,tokenProgramA:v,tokenProgramB:k,tokenProgramR0:M,tokenProgramR1:A,tokenProgramR2:S,tokenInfoA:x,tokenInfoB:E,tokenInfoR0:T,tokenInfoR1:P,tokenInfoR2:B}},$=[{dataSize:(0,jr.getAccountSize)(jr.AccountName.Position)},{memcmp:{offset:8,bytes:a.toBase58()}}],R=await u.getProgramAccounts(f,{commitment:"confirmed",encoding:"base64",withContext:!0,filters:$}),O=R.context.slot,D=R.value.map((t=>{const e=jr.ParsablePosition.parse(t.pubkey,t.account),n=Yr.PositionUtil.getPositionStatus(h.tickCurrentIndex,e.tickLowerIndex,e.tickUpperIndex),r=Jn(jr.PriceMath.tickIndexToPrice(e.tickLowerIndex,g,y),y),i=Jn(jr.PriceMath.tickIndexToPrice(e.tickUpperIndex,g,y),y),o=Jn(new fn(1).div(jr.PriceMath.tickIndexToPrice(e.tickUpperIndex,g,y)),g),s=Jn(new fn(1).div(jr.PriceMath.tickIndexToPrice(e.tickLowerIndex,g,y)),g),u=jr.PoolUtil.getTokenAmountsFromLiquidity(e.liquidity,h.sqrtPrice,jr.PriceMath.tickIndexToSqrtPriceX64(e.tickLowerIndex),jr.PriceMath.tickIndexToSqrtPriceX64(e.tickUpperIndex),!1),c=!jr.PDAUtil.getPosition(d.owner,e.positionMint).publicKey.equals(a),l=Math.ceil(jr.MIN_TICK_INDEX/h.tickSpacing)*h.tickSpacing,f=Math.floor(jr.MAX_TICK_INDEX/h.tickSpacing)*h.tickSpacing,p=e.tickLowerIndex===l&&e.tickUpperIndex===f;return{meta:Xn(t.pubkey,t.account,O),parsed:e,derived:{priceLower:r,priceUpper:i,invertedPriceLower:o,invertedPriceUpper:s,amounts:u,amountA:bn.DecimalUtil.fromBN(u.tokenA,g),amountB:bn.DecimalUtil.fromBN(u.tokenB,y),status:n===Yr.PositionStatus.InRange?Xr.PriceIsInRange:n===Yr.PositionStatus.AboveRange?Xr.PriceIsAboveRange:Xr.PriceIsBelowRange,isBundledPosition:c,isFullRange:p}}}));D.sort(Qr);const C=D.length,N=D.filter((t=>t.parsed.liquidity.isZero())).length,z=D.filter((t=>t.derived.isFullRange)).length,U=D.filter((t=>t.derived.status===Xr.PriceIsInRange)).length,j=D.filter((t=>t.derived.status===Xr.PriceIsAboveRange)).length,Y=D.filter((t=>t.derived.status===Xr.PriceIsBelowRange)).length;return{whirlpool:L,positions:D,positionSummary:{numPositions:C,numZeroLiquidityPositions:N,numFullRangePositions:z,numStatusPriceIsInRangePositions:U,numStatusPriceIsAboveRangePositions:j,numStatusPriceIsBelowRangePositions:Y}}}(o.pubkey)),2055&t.$$.dirty&&n(5,i=async function(t,e,n,r){const i=await t,o=i.positions.filter((t=>!e||!t.parsed.liquidity.isZero())).filter((t=>!n||t.derived.status===Xr.PriceIsInRange)).sort(r);return Object.assign(Object.assign({},i),{positions:o})}(r,s,a,function(t){switch(c[t]){case u.LiquidityDesc:return(t,e)=>e.parsed.liquidity.cmp(t.parsed.liquidity);case u.TickLowerIndexAsc:return Qr;case u.TickUpperIndexDesc:return ti;case u.TokenADesc:return ei;case u.TokenBDesc:return ni;default:return(t,e)=>0}}(d)))},[s,a,d,l,f,i,c,h,function(t){switch(t){case Xr.PriceIsAboveRange:return"🔺 Price is Above";case Xr.PriceIsBelowRange:return"🔻 Price is Below";default:return"🟢 In Range"}},function(t,e){return 0===e?"":`${new fn(Math.round(t/e*100*100)).div(100).toFixed(2)} %`},o,r,function(){s=this.checked,n(0,s)},function(){a=this.checked,n(1,a)},function(t){f=t,n(4,f)},function(t){d=t,n(2,d)}]}const ic="https://public-api.solscan.io/token/holders?limit=10&offset=0&tokenAddress=";async function oc(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(await n.getParsedTokenAccountsByOwner(e,{programId:Hr},"confirmed")).value,i=[];for(const t of r)try{const n=t.pubkey,r=t.account.data.parsed.info,o=new Mt.PublicKey(r.mint),s=r.tokenAmount.decimals,a=new(_n())(r.tokenAmount.amount),u=bn.DecimalUtil.fromBN(a,s),c=(await kt.utils.token.associatedAddress({mint:o,owner:e})).equals(t.pubkey);i.push({address:n,amount:a,decimals:s,isATA:c,mint:o,uiAmount:u,extension:{}})}catch(t){}return await async function(t){const e=It(),n=(0,jr.buildDefaultAccountFetcher)(e),r=[];if(t.forEach(((t,e)=>{t.decimals>0||t.amount.eqn(1)&&r.push({index:e,position:jr.PDAUtil.getPosition(jr.ORCA_WHIRLPOOL_PROGRAM_ID,t.mint).publicKey,bundle:jr.PDAUtil.getPositionBundle(jr.ORCA_WHIRLPOOL_PROGRAM_ID,t.mint).publicKey})})),0===r.length)return;const i=await n.getPositions(r.map((t=>t.position)),jr.IGNORE_CACHE),o=await n.getPositionBundles(r.map((t=>t.bundle)),jr.IGNORE_CACHE);r.forEach((e=>{if(i.get(e.position.toBase58())){const n=t[e.index].extension;t[e.index].extension=Object.assign(Object.assign({},n),{whirlpool:{position:e.position}})}if(o.get(e.bundle.toBase58())){const n=t[e.index].extension;t[e.index].extension=Object.assign(Object.assign({},n),{whirlpool:{positionBundle:e.bundle}})}}))}(i),i}function sc(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function ac(t){let e,n,r,i;return e=new pr({props:{accountType:"token/account",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[vc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function uc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.owner}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.owner),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function cc(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.mint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.mint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function dc(t){let e,n=t[2].parsed.amount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.amount+"")&&B(e,n)},d(t){t&&k(e)}}}function lc(t){let e,n=t[2].parsed.isNative+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.isNative+"")&&B(e,n)},d(t){t&&k(e)}}}function hc(t){let e,n=t[2].parsed.isFrozen+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.isFrozen+"")&&B(e,n)},d(t){t&&k(e)}}}function fc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.delegate}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.delegate),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function pc(t){let e,n=t[2].parsed.delegatedAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.delegatedAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function mc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.closeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.closeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function gc(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g;return e=new vt({props:{name:"owner",type:"PublicKey",offset:"32",$$slots:{default:[uc]},$$scope:{ctx:t}}}),r=new vt({props:{name:"mint",type:"PublicKey",offset:"0",$$slots:{default:[cc]},$$scope:{ctx:t}}}),o=new vt({props:{name:"amount",type:"u64",offset:"64",$$slots:{default:[dc]},$$scope:{ctx:t}}}),a=new vt({props:{name:"isNative",type:"bool",$$slots:{default:[lc]},$$scope:{ctx:t}}}),c=new vt({props:{name:"isFrozen",type:"bool",$$slots:{default:[hc]},$$scope:{ctx:t}}}),l=new vt({props:{name:"delegate",type:"COption",offset:"COption(72)+PublicKey(76)",$$slots:{default:[fc]},$$scope:{ctx:t}}}),f=new vt({props:{name:"delegatedAmount",type:"u64",offset:"121",$$slots:{default:[pc]},$$scope:{ctx:t}}}),m=new vt({props:{name:"closeAuthority",type:"COption",offset:"COption(129)+PublicKey(133)",$$slots:{default:[mc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment)},m(t,y){ft(e,t,y),v(t,n,y),ft(r,t,y),v(t,i,y),ft(o,t,y),v(t,s,y),ft(a,t,y),v(t,u,y),ft(c,t,y),v(t,d,y),ft(l,t,y),v(t,h,y),ft(f,t,y),v(t,p,y),ft(m,t,y),g=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const y={};10&n&&(y.$$scope={dirty:n,ctx:t}),m.$set(y)},i(t){g||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),g=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),g=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t)}}}function yc(t){let e,n=t[2].derived.decimals+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.decimals+"")&&B(e,n)},d(t){t&&k(e)}}}function bc(t){let e,n=t[2].derived.amount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.amount+"")&&B(e,n)},d(t){t&&k(e)}}}function wc(t){let e,n=t[2].derived.isATA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isATA+"")&&B(e,n)},d(t){t&&k(e)}}}function _c(t){let e,n,r,i,o,s;return e=new vt({props:{name:"decimals",$$slots:{default:[yc]},$$scope:{ctx:t}}}),r=new vt({props:{name:"amount",$$slots:{default:[bc]},$$scope:{ctx:t}}}),o=new vt({props:{name:"isATA",$$slots:{default:[wc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function vc(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[gc]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[_c]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function kc(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Mc(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/state.rs#L86"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:kc,then:ac,catch:sc,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🪙Token::Account "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Ac(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=bn.ParsableTokenAccountInfo.parse(e,i),a=await r.getMintInfo(s.mint,jr.IGNORE_CACHE),u=(await kt.utils.token.associatedAddress({mint:s.mint,owner:s.owner})).equals(e);return{meta:Xn(e,i,o),parsed:s,derived:{decimals:a.decimals,amount:bn.DecimalUtil.fromBN(s.amount,a.decimals),isATA:u}}}(i.pubkey))},[i,r]}function Sc(e){let n,r,i,o,s,a,u,c;return{c(){n=A("div"),r=A("input"),i=I(),o=A("span"),s=S("🙆"),P(r,"type","text"),P(r,"placeholder",e[1]),P(r,"size",e[2]),r.value=e[3],P(o,"style",a=`margin-left: 5px; visibility: ${e[0]?"visible":"hidden"};`),$(n,"display","flex"),$(n,"flex-direction","row")},m(t,a){v(t,n,a),_(n,r),_(n,i),_(n,o),_(o,s),u||(c=E(r,"input",T(e[4])),u=!0)},p(t,[e]){2&e&&P(r,"placeholder",t[1]),4&e&&P(r,"size",t[2]),8&e&&r.value!==t[3]&&(r.value=t[3]),1&e&&a!==(a=`margin-left: 5px; visibility: ${t[0]?"visible":"hidden"};`)&&P(o,"style",a)},i:t,o:t,d(t){t&&k(n),u=!1,c()}}}function Ic(t,e,n){let{value:r}=e,{decimals:i}=e,{placeholder:o="token amount"}=e,{size:s=32}=e,a="";return t.$$set=t=>{"value"in t&&n(0,r=t.value),"decimals"in t&&n(5,i=t.decimals),"placeholder"in t&&n(1,o=t.placeholder),"size"in t&&n(2,s=t.size)},[r,o,s,a,function(t){const e=t.target;!function(t,e){return!(t.length>An)&&!((-1===(n=t).indexOf(".")?0:n&&n.split(".")[1].length||0)>e||!function(t){return Sn.test(t)}(t))&&In(t,e).lte(bn.U64_MAX);var n}(e.value,i)?e.value=a:(n(3,a=e.value),n(0,r=["","."].includes(a)?void 0:function(t,e){return In(t,e)}(a,i)))},i]}const xc=class extends gt{constructor(t){super(),mt(this,t,Ic,Sc,a,{value:0,decimals:5,placeholder:1,size:2})}};function Ec(e){let n,r,i,o,s,a,u,c;return{c(){n=A("div"),r=A("input"),i=I(),o=A("span"),s=S("🙆"),P(r,"type","text"),P(r,"placeholder",e[1]),P(r,"size",e[2]),r.value=e[3],P(o,"style",a=`margin-left: 5px; visibility: ${e[0]?"visible":"hidden"};`),$(n,"display","flex"),$(n,"flex-direction","row")},m(t,a){v(t,n,a),_(n,r),_(n,i),_(n,o),_(o,s),u||(c=E(r,"input",T(e[4])),u=!0)},p(t,[e]){2&e&&P(r,"placeholder",t[1]),4&e&&P(r,"size",t[2]),8&e&&r.value!==t[3]&&(r.value=t[3]),1&e&&a!==(a=`margin-left: 5px; visibility: ${t[0]?"visible":"hidden"};`)&&P(o,"style",a)},i:t,o:t,d(t){t&&k(n),u=!1,c()}}}function Tc(t,e,n){let{value:r}=e,{placeholder:i="address"}=e,{size:o=32}=e,s="";return t.$$set=t=>{"value"in t&&n(0,r=t.value),"placeholder"in t&&n(1,i=t.placeholder),"size"in t&&n(2,o=t.size)},[r,i,o,s,function(t){const e=t.target;n(3,s=e.value),n(0,r=function(t){if(Mn.test(t))try{return new Mt.PublicKey(t)}catch(t){return}}(e.value))}]}const Pc=class extends gt{constructor(t){super(),mt(this,t,Tc,Ec,a,{value:0,placeholder:1,size:2})}};var Bc=n(48764).Buffer;function Lc(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b;function w(e){t[5](e)}let M={};function S(e){t[6](e)}void 0!==t[1]&&(M.value=t[1]),s=new Pc({props:M}),j.push((()=>lt(s,"value",w)));let x={decimals:t[0].parsed.decimals};return void 0!==t[2]&&(x.value=t[2]),h=new xc({props:x}),j.push((()=>lt(h,"value",S))),y=new sr({props:{disabled:t[3],download:t[4]}}),{c(){e=A("div"),n=A("table"),r=A("tr"),i=A("th"),i.textContent="owner",o=A("td"),ht(s.$$.fragment),u=I(),c=A("tr"),d=A("th"),d.textContent="amount",l=A("td"),ht(h.$$.fragment),p=I(),m=A("tr"),g=A("td"),ht(y.$$.fragment),P(i,"class","svelte-1psl6r7"),P(o,"class","svelte-1psl6r7"),P(d,"class","svelte-1psl6r7"),P(l,"class","svelte-1psl6r7"),P(g,"colspan","2"),P(g,"class","svelte-1psl6r7"),$(n,"border-spacing","0")},m(t,a){v(t,e,a),_(e,n),_(n,r),_(r,i),_(r,o),ft(s,o,null),_(n,u),_(n,c),_(c,d),_(c,l),ft(h,l,null),_(n,p),_(n,m),_(m,g),ft(y,g,null),b=!0},p(t,[e]){const n={};!a&&2&e&&(a=!0,n.value=t[1],G((()=>a=!1))),s.$set(n);const r={};1&e&&(r.decimals=t[0].parsed.decimals),!f&&4&e&&(f=!0,r.value=t[2],G((()=>f=!1))),h.$set(r);const i={};8&e&&(i.disabled=t[3]),y.$set(i)},i(t){b||(ot(s.$$.fragment,t),ot(h.$$.fragment,t),ot(y.$$.fragment,t),b=!0)},o(t){st(s.$$.fragment,t),st(h.$$.fragment,t),st(y.$$.fragment,t),b=!1},d(t){t&&k(e),pt(s),pt(h),pt(y)}}}function $c(t,e,n){let r,i,o,{mintInfo:s}=e;return t.$$set=t=>{"mintInfo"in t&&n(0,s=t.mintInfo)},t.$$.update=()=>{6&t.$$.dirty&&n(3,r=!i||!o)},[s,i,o,r,async function(){const t=await async function(t,e,n){const r=await kt.utils.token.associatedAddress({mint:t,owner:e}),i=JSON.parse('{"account":{"data":["bSzl7WjOignQep8J48sLWXRN+yidilz09ipUuZGo1wAMjph4T4MwT0YUgNeGtHvaBFkU0iG0rHd0ApevtnFTNQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","base64"],"executable":false,"lamports":2039280,"owner":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","rentEpoch":0},"pubkey":"GbMB98t6YfVxn3Pbu54EyUkuLqdaERLANvyghtrzSf6e"}'),o=Bc.from(i.account.data[0],"base64");return o.set(t.toBuffer(),0),o.set(e.toBuffer(),32),o.set(n.toArrayLike(Bc,"le",8),64),{pubkey:r.toBase58(),account:{owner:i.account.owner,executable:i.account.executable,lamports:i.account.lamports,rentEpoch:i.account.rentEpoch,data:[o.toString("base64"),"base64"]}}}(s.meta.pubkey,i,o),e=`${t.pubkey}.json`;rr(nr(t),e)},function(t){i=t,n(1,i)},function(t){o=t,n(2,o)}]}const Rc=class extends gt{constructor(t){super(),mt(this,t,$c,Lc,a,{mintInfo:0})}};function Oc(t){let e,n,r,i,o,s,a,u,c,d,l,h;function f(e){t[4](e)}let p={};return void 0!==t[0]&&(p.value=t[0]),s=new Pc({props:p}),j.push((()=>lt(s,"value",f))),l=new sr({props:{disabled:t[1],download:t[2]}}),{c(){e=A("div"),n=A("table"),r=A("tr"),i=A("th"),i.textContent="newMintAuthority",o=A("td"),ht(s.$$.fragment),u=I(),c=A("tr"),d=A("td"),ht(l.$$.fragment),P(i,"class","svelte-1psl6r7"),P(o,"class","svelte-1psl6r7"),P(d,"colspan","2"),P(d,"class","svelte-1psl6r7"),$(n,"border-spacing","0")},m(t,a){v(t,e,a),_(e,n),_(n,r),_(r,i),_(r,o),ft(s,o,null),_(n,u),_(n,c),_(c,d),ft(l,d,null),h=!0},p(t,[e]){const n={};!a&&1&e&&(a=!0,n.value=t[0],G((()=>a=!1))),s.$set(n);const r={};2&e&&(r.disabled=t[1]),l.$set(r)},i(t){h||(ot(s.$$.fragment,t),ot(l.$$.fragment,t),h=!0)},o(t){st(s.$$.fragment,t),st(l.$$.fragment,t),h=!1},d(t){t&&k(e),pt(s),pt(l)}}}function Dc(t,e,n){let r,i,{mintInfo:o}=e;return t.$$set=t=>{"mintInfo"in t&&n(3,o=t.mintInfo)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=!i)},[i,r,async function(){const t=function(t,e){var n;const r=Bc.from(t.meta.data);return r.set(new(_n())(1).toArrayLike(Bc,"le",4),0),r.set(e.toBuffer(),4),{pubkey:t.meta.pubkey.toBase58(),account:{owner:t.meta.owner.toBase58(),executable:t.meta.executable,lamports:t.meta.lamports,rentEpoch:null!==(n=t.meta.rentEpoch)&&void 0!==n?n:0,data:[r.toString("base64"),"base64"]}}}(o,i),e=`${t.pubkey}.json`;rr(nr(t),e)},o,function(t){i=t,n(0,i)}]}const Cc=class extends gt{constructor(t){super(),mt(this,t,Dc,Oc,a,{mintInfo:3})}};function Nc(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function zc(t){let e,n,r,i;return e=new pr({props:{accountType:"token/mint",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[rd]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Uc(t){let e,n=t[2].parsed.decimals+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.decimals+"")&&B(e,n)},d(t){t&&k(e)}}}function jc(t){let e,n=t[2].parsed.supply+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.supply+"")&&B(e,n)},d(t){t&&k(e)}}}function Yc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.mintAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.mintAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Fc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.freezeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.freezeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Wc(t){let e,n,r,i,o,s,a,u;return e=new vt({props:{name:"decimals",type:"u8",offset:"44",$$slots:{default:[Uc]},$$scope:{ctx:t}}}),r=new vt({props:{name:"supply",type:"u64",offset:"36",$$slots:{default:[jc]},$$scope:{ctx:t}}}),o=new vt({props:{name:"mintAuthority",type:"COption",offset:"COption(0)+PublicKey(4)",$$slots:{default:[Yc]},$$scope:{ctx:t}}}),a=new vt({props:{name:"freezeAuthority",type:"COption",offset:"COption(46)+PublicKey(50)",$$slots:{default:[Fc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment)},m(t,c){ft(e,t,c),v(t,n,c),ft(r,t,c),v(t,i,c),ft(o,t,c),v(t,s,c),ft(a,t,c),u=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const c={};10&n&&(c.$$scope={dirty:n,ctx:t}),a.$set(c)},i(t){u||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),u=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),u=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t)}}}function Hc(t){let e,n=t[2].derived.supply+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supply+"")&&B(e,n)},d(t){t&&k(e)}}}function Kc(t){let e,n;return e=new Gn({props:{address:t[2].derived.metadata}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.metadata),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function qc(t){let e,n=(void 0!==t[2].derived.whirlpoolPosition)+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=(void 0!==t[2].derived.whirlpoolPosition)+"")&&B(e,n)},d(t){t&&k(e)}}}function Vc(t){let e,n;return e=new vt({props:{name:"whirlpool position",$$slots:{default:[Gc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Gc(t){let e,n;return e=new Gn({props:{type:"whirlpool/position",address:t[2].derived.whirlpoolPosition}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.whirlpoolPosition),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Zc(t){let e,n=(void 0!==t[2].derived.whirlpoolPositionBundle)+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=(void 0!==t[2].derived.whirlpoolPositionBundle)+"")&&B(e,n)},d(t){t&&k(e)}}}function Xc(t){let e,n;return e=new vt({props:{name:"whirlpool position bundle",$$slots:{default:[Jc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Jc(t){let e,n;return e=new Gn({props:{type:"whirlpool/positionbundle",address:t[2].derived.whirlpoolPositionBundle}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.whirlpoolPositionBundle),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Qc(t){let e,n,r,i,o,s,a,u,c,d,l;e=new vt({props:{name:"supply",$$slots:{default:[Hc]},$$scope:{ctx:t}}}),r=new vt({props:{name:"metadata",$$slots:{default:[Kc]},$$scope:{ctx:t}}}),o=new vt({props:{name:"is whirlpool position mint",$$slots:{default:[qc]},$$scope:{ctx:t}}});let h=void 0!==t[2].derived.whirlpoolPosition&&Vc(t);u=new vt({props:{name:"is whirlpool position bundle mint",$$slots:{default:[Zc]},$$scope:{ctx:t}}});let f=void 0!==t[2].derived.whirlpoolPositionBundle&&Xc(t);return{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),h&&h.c(),a=I(),ht(u.$$.fragment),c=I(),f&&f.c(),d=x()},m(t,p){ft(e,t,p),v(t,n,p),ft(r,t,p),v(t,i,p),ft(o,t,p),v(t,s,p),h&&h.m(t,p),v(t,a,p),ft(u,t,p),v(t,c,p),f&&f.m(t,p),v(t,d,p),l=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const c={};10&n&&(c.$$scope={dirty:n,ctx:t}),o.$set(c),void 0!==t[2].derived.whirlpoolPosition?h?(h.p(t,n),2&n&&ot(h,1)):(h=Vc(t),h.c(),ot(h,1),h.m(a.parentNode,a)):h&&(rt(),st(h,1,1,(()=>{h=null})),it());const l={};10&n&&(l.$$scope={dirty:n,ctx:t}),u.$set(l),void 0!==t[2].derived.whirlpoolPositionBundle?f?(f.p(t,n),2&n&&ot(f,1)):(f=Xc(t),f.c(),ot(f,1),f.m(d.parentNode,d)):f&&(rt(),st(f,1,1,(()=>{f=null})),it())},i(t){l||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(h),ot(u.$$.fragment,t),ot(f),l=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(h),st(u.$$.fragment,t),st(f),l=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),h&&h.d(t),t&&k(a),pt(u,t),t&&k(c),f&&f.d(t),t&&k(d)}}}function td(t){let e,n;return e=new Rc({props:{mintInfo:t[2]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.mintInfo=t[2]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ed(t){let e,n;return e=new Cc({props:{mintInfo:t[2]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.mintInfo=t[2]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function nd(t){let e,n,r,i;return e=new vt({props:{name:"create ATA account",$$slots:{default:[td]},$$scope:{ctx:t}}}),r=new vt({props:{name:"rewrite mintAuthority",$$slots:{default:[ed]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function rd(t){let e,n,r,i,o,s;return e=new yr({props:{$$slots:{default:[Wc]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Qc]},$$scope:{ctx:t}}}),o=new oi({props:{$$slots:{default:[nd]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function id(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function od(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/state.rs#L16"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:id,then:zc,catch:Nc,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🪙Token::Mint "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function sd(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=bn.ParsableMintInfo.parse(e,i),a=jr.PDAUtil.getPositionMetadata(e).publicKey,u=jr.PDAUtil.getPosition(jr.ORCA_WHIRLPOOL_PROGRAM_ID,e).publicKey,c=await r.getPosition(u,jr.IGNORE_CACHE),d=jr.PDAUtil.getPositionBundle(jr.ORCA_WHIRLPOOL_PROGRAM_ID,e).publicKey,l=await r.getPositionBundle(d,jr.IGNORE_CACHE),h=await async function(t){try{const e=ic+t.toBase58(),n=await(await mn()(e)).json(),r=[];return n.data.forEach((t=>{const e=new(_n())(t.amount),n=Number.parseInt(t.decimals),i=bn.DecimalUtil.fromBN(e,n);r.push({rank:Number.parseInt(t.rank),address:new Mt.PublicKey(t.address),amount:e,decimalAmount:i,decimals:n,owner:new Mt.PublicKey(t.owner)})})),r}catch(t){return[]}}(e);return{meta:Xn(e,i,o),parsed:s,derived:{supply:bn.DecimalUtil.fromBN(s.supply,s.decimals),metadata:a,largestHolders:h,whirlpoolPosition:null===c?void 0:u,whirlpoolPositionBundle:null===l?void 0:d}}}(i.pubkey))},[i,r]}function ad(t,e,n){const r=t.slice();return r[12]=e[n],r}function ud(t,e,n){const r=t.slice();return r[12]=e[n],r}function cd(e){let n,r=e[17].message+"";return{c(){n=S(r)},m(t,e){v(t,n,e)},p(t,e){4&e&&r!==(r=t[17].message+"")&&B(n,r)},i:t,o:t,d(t){t&&k(n)}}}function dd(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m=t[11].filter(t[7]),g=[];for(let e=0;est(g[t],1,1,(()=>{g[t]=null}));let b=t[11].filter(t[8]),w=[];for(let e=0;est(w[t],1,1,(()=>{w[t]=null}));return{c(){e=A("h4"),e.textContent="decimals > 0",n=I(),r=A("table"),i=A("thead"),i.innerHTML='address \n isATA \n mint \n amount',o=I(),s=A("tbody");for(let t=0;taddress \n isATA \n mint \n amount \n whirlpool position \n whirlpool position bundle',h=I(),f=A("tbody");for(let t=0;t{$=null})),it()),t[12].extension.whirlpool?.positionBundle?R?(R.p(t,e),6&e&&ot(R,1)):(R=gd(t),R.c(),ot(R,1),R.m(b,null)):R&&(rt(),st(R,1,1,(()=>{R=null})),it())},i(t){M||(ot(r.$$.fragment,t),ot(d.$$.fragment,t),ot($),ot(R),M=!0)},o(t){st(r.$$.fragment,t),st(d.$$.fragment,t),st($),st(R),M=!1},d(t){t&&k(e),pt(r),P&&P.d(),pt(d),L&&L.d(),$&&$.d(),R&&R.d()}}}function bd(e){let n;return{c(){n=S("loading...")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&k(n)}}}function wd(t){let e,n,r,i,s,a,u,c,d,l,h,f,p,m,g,y,b={ctx:t,current:null,token:null,hasCatch:!0,pending:bd,then:dd,catch:cd,value:11,error:17,blocks:[,,,]};return at(p=t[2],b),{c(){e=A("h2"),e.textContent="🪙Token::listTokenAccounts",n=I(),r=A("form"),i=A("input"),s=I(),a=A("input"),u=I(),c=A("div"),d=A("input"),l=S(" hide 0 amount accounts"),h=I(),f=x(),b.block.c(),$(i,"margin","0.5em 0em"),P(i,"type","text"),P(i,"size","64"),P(i,"placeholder","wallet address"),P(a,"type","submit"),a.value="List!",P(d,"type","checkbox"),$(c,"margin-top","0.5em"),$(c,"font-size","smaller"),$(r,"margin-bottom","1em")},m(o,p){v(o,e,p),v(o,n,p),v(o,r,p),_(r,i),L(i,t[0]),_(r,s),_(r,a),_(r,u),_(r,c),_(c,d),d.checked=t[1],_(c,l),v(o,h,p),v(o,f,p),b.block.m(o,b.anchor=p),b.mount=()=>f.parentNode,b.anchor=f,m=!0,g||(y=[E(i,"input",t[5]),E(d,"change",t[6]),E(r,"submit",T(t[3]))],g=!0)},p(e,[n]){t=e,1&n&&i.value!==t[0]&&L(i,t[0]),2&n&&(d.checked=t[1]),b.ctx=t,4&n&&p!==(p=t[2])&&at(p,b)||ut(b,t,n)},i(t){m||(ot(b.block),m=!0)},o(t){for(let t=0;t<3;t+=1)st(b.blocks[t]);m=!1},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(h),t&&k(f),b.block.d(t),b.token=null,b=null,g=!1,o(y)}}}function _d(t,e,n){var r;let{params:i}=e,o=null!==(r=i.pubkey)&&void 0!==r?r:"",s=!0,a=u()?oc((0,kt.translateAddress)(o)):new Promise((t=>t([])));function u(){try{return(0,kt.translateAddress)(o),!0}catch(t){return!1}}return t.$$set=t=>{"params"in t&&n(4,i=t.params)},[o,s,a,async function(){if(!u())return;const t=(0,kt.translateAddress)(o);n(2,a=oc(t))},i,function(){o=this.value,n(0,o)},function(){s=this.checked,n(1,s)},t=>t.decimals>0&&(!s||!t.amount.isZero()),t=>!(0!==t.decimals||s&&t.amount.isZero())]}function vd(t,e,n){const r=t.slice();return r[9]=e[n],r[10]=e,r[11]=n,r}function kd(t,e,n){const r=t.slice();return r[12]=e[n],r}function Md(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Ad(t){let e,n,r,i,s,a,u,c,d=t[2],l=[];for(let e=0;est(l[t],1,1,(()=>{l[t]=null}));return{c(){e=A("form"),n=A("input"),r=I(),i=A("input"),s=I();for(let t=0;t{h=null})),it())},i(t){s||(ot(h),s=!0)},o(t){st(h),s=!1},d(t){t&&k(e),M(d,t),h&&h.d(),a=!1,u()}}}function Ed(e){let n;return{c(){n=S("loading...")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&k(n)}}}function Td(t){let e,n,r,i,o,s={ctx:t,current:null,token:null,hasCatch:!1,pending:Ed,then:Ad,catch:Md,value:8,blocks:[,,,]};return at(i=t[3],s),{c(){e=A("h2"),e.textContent="🪙Token::deriveATA",n=I(),r=x(),s.block.c()},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i),s.block.m(t,s.anchor=i),s.mount=()=>r.parentNode,s.anchor=r,o=!0},p(e,[n]){t=e,s.ctx=t,8&n&&i!==(i=t[3])&&at(i,s)||ut(s,t,n)},i(t){o||(ot(s.block),o=!0)},o(t){for(let t=0;t<3;t+=1)st(s.blocks[t]);o=!1},d(t){t&&k(e),t&&k(n),t&&k(r),s.block.d(t),s.token=null,s=null}}}const Pd=t=>!t.poolToken;function Bd(t,e,n){let r,i;const o=["So11111111111111111111111111111111111111112","EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE","mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey","7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj","SLNDpmoWTVADgEdndyvWzroNL7zSi1dF9PC3xHGtPwp","7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU","DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX","SHDWyBxihqiCj6YekG2GUr7wqKLeLAMK1gHZck9pL6y","DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ"];let s,a=[...o.slice(0,8),...new Array(10).fill(void 0)].slice(0,10);return n(2,r=new Array(10).fill(void 0)),n(3,i=(async()=>{const t=(await Rn()).tokenList.slice(),e=[...o,...t.map((t=>t.mint.toBase58()))];return t.sort(((t,n)=>e.indexOf(t.mint.toBase58())-e.indexOf(n.mint.toBase58()))),t})()),[s,a,r,i,async function(){n(2,r=new Array(10).fill(void 0));for(let t=0;t<10;t++)try{n(2,r[t]=await kt.utils.token.associatedAddress({mint:(0,kt.translateAddress)(a[t]),owner:(0,kt.translateAddress)(s)}),r)}catch(t){}},function(){s=this.value,n(0,s)},function(t){a[t]=O(this),n(1,a),n(3,i)}]}var Ld=n(39386),$d=n(40475);const Rd=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var Od=n(48764).Buffer;const Dd=t=>e=>{const n=(0,Ld.blob)(t,e),{encode:r,decode:i}=Rd(n),o=n;return o.decode=(t,e)=>{const n=i(t,e);return(0,$d.toBigIntLE)(Od.from(n))},o.encode=(e,n,i)=>{const o=(0,$d.toBufferLE)(e,t);return r(o,n,i)},o},Cd=t=>e=>{const n=(0,Ld.blob)(t,e),{encode:r,decode:i}=Rd(n),o=n;return o.decode=(t,e)=>{const n=i(t,e);return(0,$d.toBigIntBE)(Od.from(n))},o.encode=(e,n,i)=>{const o=(0,$d.toBufferBE)(e,t);return r(o,n,i)},o},Nd=Dd(8);Cd(8),Dd(16),Cd(16),Dd(24),Cd(24),Dd(32),Cd(32);var zd=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ud=Math.ceil,jd=Math.floor,Yd="[BigNumber Error] ",Fd=Yd+"Number primitive has more than 15 significant digits: ",Wd=1e14,Hd=14,Kd=9007199254740991,qd=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Vd=1e7,Gd=1e9;function Zd(t){var e=0|t;return t>0||t===e?e:e-1}function Xd(t){for(var e,n,r=1,i=t.length,o=t[0]+"";rc^n?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;so[s]^n?1:-1;return u==c?0:u>c^n?1:-1}function Qd(t,e,n,r){if(tn||t!==jd(t))throw Error(Yd+(r||"Argument")+("number"==typeof t?tn?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function tl(t){var e=t.c.length-1;return Zd(t.e/Hd)==e&&t.c[e]%2!=0}function el(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function nl(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else ew?h.c=h.e=null:t.e=10;u/=10,a++);return void(a>w?h.c=h.e=null:(h.e=a,h.c=[t]))}l=String(t)}else{if(!zd.test(l=String(t)))return i(h,l,c);h.s=45==l.charCodeAt(0)?(l=l.slice(1),-1):1}(a=l.indexOf("."))>-1&&(l=l.replace(".","")),(u=l.search(/e/i))>0?(a<0&&(a=u),a+=+l.slice(u+1),l=l.substring(0,u)):a<0&&(a=l.length)}else{if(Qd(e,2,A.length,"Base"),10==e&&S)return P(h=new I(t),p+h.e+1,m);if(l=String(t),c="number"==typeof t){if(0*t!=0)return i(h,l,c,e);if(h.s=1/t<0?(l=l.slice(1),-1):1,I.DEBUG&&l.replace(/^0\.0*|\./,"").length>15)throw Error(Fd+t)}else h.s=45===l.charCodeAt(0)?(l=l.slice(1),-1):1;for(n=A.slice(0,e),a=u=0,d=l.length;ua){a=d;continue}}else if(!s&&(l==l.toUpperCase()&&(l=l.toLowerCase())||l==l.toLowerCase()&&(l=l.toUpperCase()))){s=!0,u=-1,a=0;continue}return i(h,String(t),c,e)}c=!1,(a=(l=r(l,e,10,h.s)).indexOf("."))>-1?l=l.replace(".",""):a=l.length}for(u=0;48===l.charCodeAt(u);u++);for(d=l.length;48===l.charCodeAt(--d););if(l=l.slice(u,++d)){if(d-=u,c&&I.DEBUG&&d>15&&(t>Kd||t!==jd(t)))throw Error(Fd+h.s*t);if((a=a-u-1)>w)h.c=h.e=null;else if(a=y)?el(u,s):nl(u,s,"0");else if(o=(t=P(new I(t),e,n)).e,a=(u=Xd(t.c)).length,1==r||2==r&&(e<=o||o<=g)){for(;aa){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-a)>0)for(o+1==a&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function E(t,e){for(var n,r,i=1,o=new I(t[0]);i=10;i/=10,r++);return(n=r+n*Hd-1)>w?t.c=t.e=null:n=10;a/=10,i++);if((o=e-i)<0)o+=Hd,s=e,u=l[c=0],d=jd(u/h[i-s-1]%10);else if((c=Ud((o+1)/Hd))>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));u=d=0,i=1,s=(o%=Hd)-Hd+1}else{for(u=a=l[c],i=1;a>=10;a/=10,i++);d=(s=(o%=Hd)-Hd+i)<0?0:jd(u/h[i-s-1]%10)}if(r=r||e<0||null!=l[c+1]||(s<0?u:u%h[i-s-1]),r=n<4?(d||r)&&(0==n||n==(t.s<0?3:2)):d>5||5==d&&(4==n||r||6==n&&(o>0?s>0?u/h[i-s]:0:l[c-1])%10&1||n==(t.s<0?8:7)),e<1||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=h[(Hd-e%Hd)%Hd],t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=c,a=1,c--):(l.length=c+1,a=h[Hd-o],l[c]=s>0?jd(u/h[i-s]%h[s])*a:0),r)for(;;){if(0==c){for(o=1,s=l[0];s>=10;s/=10,o++);for(s=l[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(t.e++,l[0]==Wd&&(l[0]=1));break}if(l[c]+=a,l[c]!=Wd)break;l[c--]=0,a=1}for(o=l.length;0===l[--o];l.pop());}t.e>w?t.c=t.e=null:t.e=y?el(e,n):nl(e,n,"0"),t.s<0?"-"+e:e)}return I.clone=t,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(Yd+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(Qd(n=t[e],0,Gd,e),p=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(Qd(n=t[e],0,8,e),m=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(Qd(n[0],-Gd,0,e),Qd(n[1],0,Gd,e),g=n[0],y=n[1]):(Qd(n,-Gd,Gd,e),g=-(y=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)Qd(n[0],-Gd,-1,e),Qd(n[1],1,Gd,e),b=n[0],w=n[1];else{if(Qd(n,-Gd,Gd,e),!n)throw Error(Yd+e+" cannot be zero: "+n);b=-(w=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(Yd+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw _=!n,Error(Yd+"crypto unavailable");_=n}else _=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(Qd(n=t[e],0,9,e),v=n),t.hasOwnProperty(e="POW_PRECISION")&&(Qd(n=t[e],0,Gd,e),k=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(Yd+e+" not an object: "+n);M=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(Yd+e+" invalid: "+n);S="0123456789"==n.slice(0,10),A=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:m,EXPONENTIAL_AT:[g,y],RANGE:[b,w],CRYPTO:_,MODULO_MODE:v,POW_PRECISION:k,FORMAT:M,ALPHABET:A}},I.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!I.DEBUG)return!0;var e,n,r=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-Gd&&i<=Gd&&i===jd(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%Hd)<1&&(e+=Hd),String(r[0]).length==e){for(e=0;e=Wd||n!==jd(n))break t;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(Yd+"Invalid BigNumber: "+t)},I.maximum=I.max=function(){return E(arguments,-1)},I.minimum=I.min=function(){return E(arguments,1)},I.random=(o=9007199254740992,s=Math.random()*o&2097151?function(){return jd(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,o,a=0,u=[],c=new I(f);if(null==t?t=p:Qd(t,0,Gd),i=Ud(t/Hd),_)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));a>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[a]=n[0],e[a+1]=n[1]):(u.push(o%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw _=!1,Error(Yd+"crypto unavailable");for(e=crypto.randomBytes(i*=7);a=9e15?crypto.randomBytes(7).copy(e,a):(u.push(o%1e14),a+=7);a=i/7}if(!_)for(;a=10;o/=10,a++);an-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var u,c,d,l,h,f,g,y,b=r.indexOf("."),w=p,_=m;for(b>=0&&(l=k,k=0,r=r.replace(".",""),f=(y=new I(i)).pow(r.length-b),k=l,y.c=e(nl(Xd(f.c),f.e,"0"),10,o,t),y.e=y.c.length),d=l=(g=e(r,i,o,a?(u=A,t):(u=t,A))).length;0==g[--l];g.pop());if(!g[0])return u.charAt(0);if(b<0?--d:(f.c=g,f.e=d,f.s=s,g=(f=n(f,y,w,_,o)).c,h=f.r,d=f.e),b=g[c=d+w+1],l=o/2,h=h||c<0||null!=g[c+1],h=_<4?(null!=b||h)&&(0==_||_==(f.s<0?3:2)):b>l||b==l&&(4==_||h||6==_&&1&g[c-1]||_==(f.s<0?8:7)),c<1||!g[0])r=h?nl(u.charAt(1),-w,u.charAt(0)):u.charAt(0);else{if(g.length=c,h)for(--o;++g[--c]>o;)g[c]=0,c||(++d,g=[1].concat(g));for(l=g.length;!g[--l];);for(b=0,r="";b<=l;r+=u.charAt(g[b++]));r=nl(r,d,u.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,u=t.length,c=e%Vd,d=e/Vd|0;for(t=t.slice();u--;)a=((i=c*(o=t[u]%Vd)+(r=d*o+(s=t[u]/Vd|0)*c)%Vd*Vd+a)/n|0)+(r/Vd|0)+d*s,t[u]=i%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.splice(0,1));}return function(r,i,o,s,a){var u,c,d,l,h,f,p,m,g,y,b,w,_,v,k,M,A,S=r.s==i.s?1:-1,x=r.c,E=i.c;if(!(x&&x[0]&&E&&E[0]))return new I(r.s&&i.s&&(x?!E||x[0]!=E[0]:E)?x&&0==x[0]||!E?0*S:S/0:NaN);for(g=(m=new I(S)).c=[],S=o+(c=r.e-i.e)+1,a||(a=Wd,c=Zd(r.e/Hd)-Zd(i.e/Hd),S=S/Hd|0),d=0;E[d]==(x[d]||0);d++);if(E[d]>(x[d]||0)&&c--,S<0)g.push(1),l=!0;else{for(v=x.length,M=E.length,d=0,S+=2,(h=jd(a/(E[0]+1)))>1&&(E=t(E,h,a),x=t(x,h,a),M=E.length,v=x.length),_=M,b=(y=x.slice(0,M)).length;b=a/2&&k++;do{if(h=0,(u=e(E,y,M,b))<0){if(w=y[0],M!=b&&(w=w*a+(y[1]||0)),(h=jd(w/k))>1)for(h>=a&&(h=a-1),p=(f=t(E,h,a)).length,b=y.length;1==e(f,y,p,b);)h--,n(f,M=10;S/=10,d++);P(m,o+(m.e=d+c*Hd-1)+1,s,l)}else m.e=c,m.r=+l;return m}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,c=/^\.([^.]+)$/,d=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(l,"");if(d.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(a,(function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e})),r&&(i=r,o=o.replace(u,"$1").replace(c,"0.$1")),e!=o))return new I(o,i);if(I.DEBUG)throw Error(Yd+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},h.absoluteValue=h.abs=function(){var t=new I(this);return t.s<0&&(t.s=1),t},h.comparedTo=function(t,e){return Jd(this,new I(t,e))},h.decimalPlaces=h.dp=function(t,e){var n,r,i,o=this;if(null!=t)return Qd(t,0,Gd),null==e?e=m:Qd(e,0,8),P(new I(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-Zd(this.e/Hd))*Hd,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},h.dividedBy=h.div=function(t,e){return n(this,new I(t,e),p,m)},h.dividedToIntegerBy=h.idiv=function(t,e){return n(this,new I(t,e),0,1)},h.exponentiatedBy=h.pow=function(t,e){var n,r,i,o,s,a,u,c,d=this;if((t=new I(t)).c&&!t.isInteger())throw Error(Yd+"Exponent not an integer: "+B(t));if(null!=e&&(e=new I(e)),s=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return c=new I(Math.pow(+B(d),s?t.s*(2-tl(t)):+B(t))),e?c.mod(e):c;if(a=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new I(NaN);(r=!a&&d.isInteger()&&e.isInteger())&&(d=d.mod(e))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||s&&d.c[1]>=24e7:d.c[0]<8e13||s&&d.c[0]<=9999975e7)))return o=d.s<0&&tl(t)?-0:0,d.e>-1&&(o=1/o),new I(a?1/o:o);k&&(o=Ud(k/Hd+2))}for(s?(n=new I(.5),a&&(t.s=1),u=tl(t)):u=(i=Math.abs(+B(t)))%2,c=new I(f);;){if(u){if(!(c=c.times(d)).c)break;o?c.c.length>o&&(c.c.length=o):r&&(c=c.mod(e))}if(i){if(0===(i=jd(i/2)))break;u=i%2}else if(P(t=t.times(n),t.e+1,1),t.e>14)u=tl(t);else{if(0==(i=+B(t)))break;u=i%2}d=d.times(d),o?d.c&&d.c.length>o&&(d.c.length=o):r&&(d=d.mod(e))}return r?c:(a&&(c=f.div(c)),e?c.mod(e):o?P(c,k,m,void 0):c)},h.integerValue=function(t){var e=new I(this);return null==t?t=m:Qd(t,0,8),P(e,e.e+1,t)},h.isEqualTo=h.eq=function(t,e){return 0===Jd(this,new I(t,e))},h.isFinite=function(){return!!this.c},h.isGreaterThan=h.gt=function(t,e){return Jd(this,new I(t,e))>0},h.isGreaterThanOrEqualTo=h.gte=function(t,e){return 1===(e=Jd(this,new I(t,e)))||0===e},h.isInteger=function(){return!!this.c&&Zd(this.e/Hd)>this.c.length-2},h.isLessThan=h.lt=function(t,e){return Jd(this,new I(t,e))<0},h.isLessThanOrEqualTo=h.lte=function(t,e){return-1===(e=Jd(this,new I(t,e)))||0===e},h.isNaN=function(){return!this.s},h.isNegative=function(){return this.s<0},h.isPositive=function(){return this.s>0},h.isZero=function(){return!!this.c&&0==this.c[0]},h.minus=function(t,e){var n,r,i,o,s=this,a=s.s;if(e=(t=new I(t,e)).s,!a||!e)return new I(NaN);if(a!=e)return t.s=-e,s.plus(t);var u=s.e/Hd,c=t.e/Hd,d=s.c,l=t.c;if(!u||!c){if(!d||!l)return d?(t.s=-e,t):new I(l?s:NaN);if(!d[0]||!l[0])return l[0]?(t.s=-e,t):new I(d[0]?s:3==m?-0:0)}if(u=Zd(u),c=Zd(c),d=d.slice(),a=u-c){for((o=a<0)?(a=-a,i=d):(c=u,i=l),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=d.length)<(e=l.length))?a:e,a=e=0;e0)for(;e--;d[n++]=0);for(e=99999999999999;r>a;){if(d[--r]=0;){for(n=0,h=w[i]%g,f=w[i]/g|0,o=i+(s=u);o>i;)n=((c=h*(c=b[--s]%g)+(a=f*c+(d=b[s]/g|0)*h)%g*g+p[o]+n)/m|0)+(a/g|0)+f*d,p[o--]=c%m;p[o]=n}return n?++r:p.splice(0,1),T(t,p,r)},h.negated=function(){var t=new I(this);return t.s=-t.s||null,t},h.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new I(t,e)).s,!i||!e)return new I(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/Hd,s=t.e/Hd,a=r.c,u=t.c;if(!o||!s){if(!a||!u)return new I(i/0);if(!a[0]||!u[0])return u[0]?t:new I(a[0]?r:0*i)}if(o=Zd(o),s=Zd(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(e=u.length)<0&&(n=u,u=a,a=n,e=i),i=0;e;)i=(a[--e]=a[e]+u[e]+i)/Wd|0,a[e]=Wd===a[e]?0:a[e]%Wd;return i&&(a=[i].concat(a),++s),T(t,a,s)},h.precision=h.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return Qd(t,1,Gd),null==e?e=m:Qd(e,0,8),P(new I(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*Hd+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},h.shiftedBy=function(t){return Qd(t,-9007199254740991,Kd),this.times("1e"+t)},h.squareRoot=h.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,u=s.s,c=s.e,d=p+4,l=new I("0.5");if(1!==u||!a||!a[0])return new I(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+B(s)))||u==1/0?(((e=Xd(a)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=Zd((c+1)/2)-(c<0||c%2),r=new I(e=u==1/0?"5e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):r=new I(u+""),r.c[0])for((u=(c=r.e)+d)<3&&(u=0);;)if(o=r,r=l.times(o.plus(n(s,o,d,1))),Xd(o.c).slice(0,u)===(e=Xd(r.c)).slice(0,u)){if(r.e0&&p>0){for(o=p%a||a,d=f.substr(0,o);o0&&(d+=c+f.slice(o)),h&&(d="-"+d)}r=l?d+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):l):d}return(n.prefix||"")+r+(n.suffix||"")},h.toFraction=function(t){var e,r,i,o,s,a,u,c,d,l,h,p,g=this,y=g.c;if(null!=t&&(!(u=new I(t)).isInteger()&&(u.c||1!==u.s)||u.lt(f)))throw Error(Yd+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+B(u));if(!y)return new I(g);for(e=new I(f),d=r=new I(f),i=c=new I(f),p=Xd(y),s=e.e=p.length-g.e-1,e.c[0]=qd[(a=s%Hd)<0?Hd+a:a],t=!t||u.comparedTo(e)>0?s>0?e:d:u,a=w,w=1/0,u=new I(p),c.c[0]=0;l=n(u,e,0,1),1!=(o=r.plus(l.times(i))).comparedTo(t);)r=i,i=o,d=c.plus(l.times(o=d)),c=o,e=u.minus(l.times(o=e)),u=o;return o=n(t.minus(r),i,0,1),c=c.plus(o.times(d)),r=r.plus(o.times(i)),c.s=d.s=g.s,h=n(d,i,s*=2,m).minus(g).abs().comparedTo(n(c,r,s,m).minus(g).abs())<1?[d,i]:[c,r],w=a,h},h.toNumber=function(){return+B(this)},h.toPrecision=function(t,e){return null!=t&&Qd(t,1,Gd),x(this,t,e,2)},h.toString=function(t){var e,n=this,i=n.s,o=n.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=g||o>=y?el(Xd(n.c),o):nl(Xd(n.c),o,"0"):10===t&&S?e=nl(Xd((n=P(new I(n),p+o+1,m)).c),n.e,"0"):(Qd(t,2,A.length,"Base"),e=r(nl(Xd(n.c),o,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},h.valueOf=h.toJSON=function(){return B(this)},h._isBigNumber=!0,h[Symbol.toStringTag]="BigNumber",h[Symbol.for("nodejs.util.inspect.custom")]=h.valueOf,null!=e&&I.set(e),I}();new rl("1e+18");const il=t=>{const e=(0,Ld.u8)(t),{encode:n,decode:r}=Rd(e),i=e;return i.decode=(t,e)=>!!r(t,e),i.encode=(t,e,r)=>{const i=Number(t);return n(i,e,r)},i};var ol=n(68716);const sl=t=>{const e=(0,Ld.blob)(32,t),{encode:n,decode:r}=Rd(e),i=e;return i.decode=(t,e)=>{const n=r(t,e);return new ol.PublicKey(n)},i.encode=(t,e,r)=>{const i=t.toBuffer();return n(i,e,r)},i};class al extends Error{constructor(t){super(t)}}class ul extends al{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class cl extends al{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}}class dl extends al{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class ll extends al{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class hl extends al{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}var fl;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(fl||(fl={}));const pl=1,ml=(0,Ld.struct)([(0,Ld.u8)("m"),(0,Ld.u8)("n"),il("isInitialized"),sl("signer1"),sl("signer2"),sl("signer3"),sl("signer4"),sl("signer5"),sl("signer6"),sl("signer7"),sl("signer8"),sl("signer9"),sl("signer10"),sl("signer11")]).span;var gl,yl=n(48764).Buffer;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(gl||(gl={}));const bl=(0,Ld.struct)([sl("mint"),sl("owner"),Nd("amount"),(0,Ld.u32)("delegateOption"),sl("delegate"),(0,Ld.u8)("state"),(0,Ld.u32)("isNativeOption"),Nd("isNative"),Nd("delegatedAmount"),(0,Ld.u32)("closeAuthorityOption"),sl("closeAuthority")]),wl=bl.span;var _l=n(48764).Buffer;const vl=(0,Ld.struct)([(0,Ld.u32)("mintAuthorityOption"),sl("mintAuthority"),Nd("supply"),(0,Ld.u8)("decimals"),il("isInitialized"),(0,Ld.u32)("freezeAuthorityOption"),sl("freezeAuthority")]),kl=vl.span;function Ml(t,e,n=Kr){if(!e)throw new ul;if(!e.owner.equals(n))throw new dl;if(e.data.lengthkl){if(e.data.length<=wl)throw new ll;if(e.data.length===ml)throw new ll;if(e.data[wl]!=fl.Mint)throw new hl;i=e.data.slice(wl+pl)}return{address:t,mintAuthority:r.mintAuthorityOption?r.mintAuthority:null,supply:r.supply,decimals:r.decimals,isInitialized:r.isInitialized,freezeAuthority:r.freezeAuthorityOption?r.freezeAuthority:null,tlvData:i}}var Al;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.TransferFeeConfig=1]="TransferFeeConfig",t[t.TransferFeeAmount=2]="TransferFeeAmount",t[t.MintCloseAuthority=3]="MintCloseAuthority",t[t.ConfidentialTransferMint=4]="ConfidentialTransferMint",t[t.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",t[t.DefaultAccountState=6]="DefaultAccountState",t[t.ImmutableOwner=7]="ImmutableOwner",t[t.MemoTransfer=8]="MemoTransfer",t[t.NonTransferable=9]="NonTransferable",t[t.InterestBearingConfig=10]="InterestBearingConfig",t[t.CpiGuard=11]="CpiGuard",t[t.PermanentDelegate=12]="PermanentDelegate",t[t.NonTransferableAccount=13]="NonTransferableAccount",t[t.TransferHook=14]="TransferHook",t[t.TransferHookAccount=15]="TransferHookAccount",t[t.MetadataPointer=18]="MetadataPointer",t[t.TokenMetadata=19]="TokenMetadata",t[t.GroupPointer=20]="GroupPointer",t[t.GroupMemberPointer=22]="GroupMemberPointer"}(Al||(Al={}));const Sl=2,Il=2;function xl(t){return t+Sl+Il}function El(t,e){let n=0;for(;xl(n)<=e.length;){const r=e.readUInt16LE(n),i=e.readUInt16LE(n+Sl),o=xl(n);if(r==t)return e.slice(o,o+i);n=o+i}return null}function Tl(t){const e=[];let n=0;for(;n((t,e)=>{if(t.length>=e)return t;const n=new Uint8Array(e).fill(0);return n.set(t),n})(t.length<=e?t:t.slice(0,e),e);function Gl(t,e){return"fixedSize"in e?e.fixedSize:e.getSizeFromValue(t)}function Zl(t){return Object.freeze({...t,encode:e=>{const n=new Uint8Array(Gl(e,t));return t.write(e,n,0),n}})}function Xl(t){return Object.freeze({...t,decode:(e,n=0)=>t.read(e,n)[0]})}function Jl(t){return"fixedSize"in t&&"number"==typeof t.fixedSize}function Ql(t,e){if(!Jl(t))throw new Error(e??"Expected a fixed-size codec, got a variable-size one.")}function th(t,e){if(Jl(t)!==Jl(e))throw new Error("Encoder and decoder must either both be fixed-size or variable-size.");if(Jl(t)&&Jl(e)&&t.fixedSize!==e.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${t.fixedSize}] and [${e.fixedSize}].`);if(!Jl(t)&&!Jl(e)&&t.maxSize!==e.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${t.maxSize}] and [${e.maxSize}].`);return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}}function eh(t,e){return Zl({fixedSize:e,write:(n,r,i)=>{const o=t.encode(n),s=o.length>e?o.slice(0,e):o;return r.set(s,i),i+e}})}function nh(t,e){return Xl({fixedSize:e,read:(n,r)=>{ql("fixCodec",e,n,r),(r>0||n.length>e)&&(n=n.slice(r,r+e)),Jl(t)&&(n=Vl(n,t.fixedSize));const[i]=t.read(n,0);return[i,r+e]}})}function rh(t){return 1!==t?.endian}function ih(t){return Zl({fixedSize:t.size,write(e,n,r){t.range&&function(t,e,n,r){if(rn)throw new Error(`Codec [${t}] expected number to be in the range [${e}, ${n}], got ${r}.`)}(t.name,t.range[0],t.range[1],e);const i=new ArrayBuffer(t.size);return t.set(new DataView(i),e,rh(t.config)),n.set(new Uint8Array(i),r),r+t.size}})}var oh=(t={})=>ih({config:t,name:"u32",range:[0,Number("0xffffffff")],set:(t,e,n)=>t.setUint32(0,e,n),size:4}),sh=(t={})=>{return Xl({fixedSize:(e={config:t,get:(t,e)=>t.getUint32(0,e),name:"u32",size:4}).size,read(t,n=0){Kl(e.name,t,n),ql(e.name,e.size,t,n);const r=new DataView(function(t,e,n){const r=t.byteOffset+(e??0),i=n??t.byteLength;return t.buffer.slice(r,r+i)}(t,n,e.size));return[e.get(r,rh(e.config)),n+e.size]}});var e};function ah(t,e,n){if(e!==n)throw new Error(`Expected [${t}] to have ${e} items, got ${n}.`)}function uh(t){return t.reduce(((t,e)=>null===t||null===e?null:t+e),0)}function ch(t){return Jl(t)?t.fixedSize:null}function dh(t){return Jl(t)?t.fixedSize:t.maxSize??null}function lh(t,e){return"number"!=typeof t?null:0===t?0:null===e?null:e*t}function hh(t={}){return th(function(t={}){const e=t.size??"variable",n=Zl({getSizeFromValue:t=>t.length,write:(t,e,n)=>(e.set(t,n),n+t.length)});return"variable"===e?n:"number"==typeof e?eh(n,e):Zl({getSizeFromValue:t=>Gl(t.length,e)+t.length,write:(t,r,i)=>(i=e.write(t.length,r,i),n.write(t,r,i))})}(t),function(t={}){const e=t.size??"variable",n=Xl({read:(t,e)=>{const n=t.slice(e);return[n,e+n.length]}});return"variable"===e?n:"number"==typeof e?nh(n,e):Xl({read:(t,r)=>{Kl("bytes",t,r);const[i,o]=e.read(t,r),s=Number(i);r=o;const a=t.slice(r,r+s);ql("bytes",s,a);const[u,c]=n.read(a,0);return[u,r+=c]}})}(t))}var fh=t=>t.replace(/\u0000/g,""),ph=globalThis.TextDecoder,mh=globalThis.TextEncoder;function gh(t={}){return th(function(t={}){const e=t.size??oh(),n=t.encoding??(()=>{let t;return Zl({getSizeFromValue:e=>(t||=new mh).encode(e).length,write:(e,n,r)=>{const i=(t||=new mh).encode(e);return n.set(i,r),r+i.length}})})();return"variable"===e?n:"number"==typeof e?eh(n,e):Zl({getSizeFromValue:t=>{const r=Gl(t,n);return Gl(r,e)+r},write:(t,r,i)=>{const o=Gl(t,n);return i=e.write(o,r,i),n.write(t,r,i)}})}(t),function(t={}){const e=t.size??sh(),n=t.encoding??(()=>{let t;return Xl({read(e,n){const r=(t||=new ph).decode(e.slice(n));return[fh(r),e.length]}})})();return"variable"===e?n:"number"==typeof e?nh(n,e):Xl({read:(t,r=0)=>{Kl("string",t,r);const[i,o]=e.read(t,r),s=Number(i);r=o;const a=t.slice(r,r+s);ql("string",s,a);const[u,c]=n.read(a,0);return[u,r+=c]}})}(t))}n(48764).Buffer.from([112,132,90,90,11,88,157,87]);const yh=(bh=[["updateAuthority",hh({size:32})],["mint",hh({size:32})],["name",gh()],["symbol",gh()],["uri",gh()],["additionalMetadata",function(t,e={}){return th(function(t,e={}){const n=e.size??oh();"remainder"===n&&Ql(t,'Codecs of "remainder" size must have fixed-size items.');const r=lh(n,ch(t)),i=lh(n,dh(t))??void 0;return Zl({...null!==r?{fixedSize:r}:{getSizeFromValue:e=>("object"==typeof n?Gl(e.length,n):0)+[...e].reduce(((e,n)=>e+Gl(n,t)),0),maxSize:i},write:(e,r,i)=>("number"==typeof n&&ah("array",n,e.length),"object"==typeof n&&(i=n.write(e.length,r,i)),e.forEach((e=>{i=t.write(e,r,i)})),i)})}(t,e),function(t,e={}){const n=e.size??sh();"remainder"===n&&Ql(t,'Codecs of "remainder" size must have fixed-size items.');const r=ch(t),i=lh(n,r),o=lh(n,dh(t))??void 0;return Xl({...null!==i?{fixedSize:i}:{maxSize:o},read:(e,i)=>{const o=[];if("object"==typeof n&&0===e.slice(i).length)return[o,i];const[s,a]=function(t,e,n,r){if("number"==typeof t)return[t,r];if("object"==typeof t)return t.read(n,r);if("remainder"===t){if(null===e)throw new Error('Codecs of "remainder" size must have fixed-size items.');const t=Math.max(0,n.length-r);if(t%e!=0)throw new Error(`The remainder of the byte array (${t} bytes) cannot be split into chunks of ${e} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${t} modulo ${e} should be equal to zero.`);return[t/e,r]}throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(t)}`)}(n,r,e,i);i=a;for(let n=0;nt.map(((t,n)=>Gl(e[n],t))).reduce(((t,e)=>t+e),0),maxSize:n}:{fixedSize:e},write:(e,n,r)=>(ah("tuple",t.length,e.length),t.forEach(((t,i)=>{r=t.write(e[i],n,r)})),r)})}(wh),function(t){const e=uh(t.map(ch)),n=uh(t.map(dh))??void 0;return Xl({...null===e?{maxSize:n}:{fixedSize:e},read:(e,n)=>{const r=[];return t.forEach((t=>{const[i,o]=t.read(e,n);r.push(i),n=o})),[r,n]}})}(wh))))]],th(function(t){const e=t.map((([,t])=>t)),n=uh(e.map(ch)),r=uh(e.map(dh))??void 0;return Zl({...null===n?{getSizeFromValue:e=>t.map((([t,n])=>Gl(e[t],n))).reduce(((t,e)=>t+e),0),maxSize:r}:{fixedSize:n},write:(e,n,r)=>(t.forEach((([t,i])=>{r=i.write(e[t],n,r)})),r)})}(bh),function(t){const e=t.map((([,t])=>t)),n=uh(e.map(ch)),r=uh(e.map(dh))??void 0;return Xl({...null===n?{maxSize:r}:{fixedSize:n},read:(e,n)=>{const r={};return t.forEach((([t,i])=>{const[o,s]=i.read(e,n);n=s,r[t]=o})),[r,n]}})}(bh)));var bh,wh;async function _h(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=function(t,e,n=Kr){if(!e)throw new ul;if(!e.owner.equals(n))throw new dl;if(e.data.lengthwl){if(e.data.length===ml)throw new ll;if(e.data[wl]!=fl.Account)throw new cl;i=e.data.slice(wl+pl)}return{address:t,mint:r.mint,owner:r.owner,amount:r.amount,delegate:r.delegateOption?r.delegate:null,delegatedAmount:r.delegatedAmount,isInitialized:r.state!==gl.Uninitialized,isFrozen:r.state===gl.Frozen,isNative:!!r.isNativeOption,rentExemptReserve:r.isNativeOption?r.isNative:null,closeAuthority:r.closeAuthorityOption?r.closeAuthority:null,tlvData:i}}(e,r,qr),{accountInfo:s}=await Zn(n,o.mint),a=Ml(o.mint,s,qr),u=function(t){const e=El(Al.TransferFeeAmount,t.tlvData);return null!==e?Ll.decode(e):null}(o),c=function(t){const e=El(Al.ImmutableOwner,t.tlvData);return null!==e?$l.decode(e):null}(o),d=function(t){const e=El(Al.MemoTransfer,t.tlvData);return null!==e?Rl.decode(e):null}(o),l=function(t){const e=El(Al.CpiGuard,t.tlvData);return null!==e?Ol.decode(e):null}(o),h=function(t){const e=El(Al.NonTransferableAccount,t.tlvData);return null!==e?Dl.decode(e):null}(o),f=function(t){const e=El(Al.TransferHookAccount,t.tlvData);return null!==e?Nl.decode(e):null}(o),p=Tl(o.tlvData).sort().filter((t=>{switch(t){case Al.TransferFeeAmount:case Al.ImmutableOwner:case Al.MemoTransfer:case Al.CpiGuard:case Al.NonTransferableAccount:case Al.TransferHookAccount:return!1;default:return!0}})),m=(await kt.utils.token.associatedAddress({mint:o.mint,owner:o.owner})).equals(e);return{meta:Xn(e,r,i),parsed:{base:o,extensions:{transferFeeAmount:u,immutableOwner:c,memoTransfer:d,cpiGuard:l,nonTransferableAccount:h,transferHookAccount:f},unknownExtensions:p},derived:{decimals:a.decimals,amount:bn.DecimalUtil.fromBN(new(_n())(o.amount.toString()),a.decimals),isATA:m}}}function vh(t){let e,n,r,i,o,s,a;o=new Ir({props:{href:t[2]}});const u=t[4].default,c=d(u,t,t[3],null);return{c(){e=A("dt"),n=A("b"),r=S(t[0]),i=I(),ht(o.$$.fragment),s=A("dd"),c&&c.c(),P(n,"title",t[1]),$(s,"margin-left","0px")},m(t,u){v(t,e,u),_(e,n),_(n,r),_(e,i),ft(o,e,null),v(t,s,u),c&&c.m(s,null),a=!0},p(t,[e]){(!a||1&e)&&B(r,t[0]),(!a||2&e)&&P(n,"title",t[1]);const i={};4&e&&(i.href=t[2]),o.$set(i),c&&c.p&&(!a||8&e)&&f(c,u,t,t[3],a?h(u,t[3],e,null):p(t[3]),null)},i(t){a||(ot(o.$$.fragment,t),ot(c,t),a=!0)},o(t){st(o.$$.fragment,t),st(c,t),a=!1},d(t){t&&k(e),pt(o),t&&k(s),c&&c.d(t)}}}function kh(t,e,n){let{$$slots:r={},$$scope:i}=e,{name:o}=e,{desc:s}=e,{href:a}=e;return t.$$set=t=>{"name"in t&&n(0,o=t.name),"desc"in t&&n(1,s=t.desc),"href"in t&&n(2,a=t.href),"$$scope"in t&&n(3,i=t.$$scope)},[o,s,a,i,r]}const Mh=class extends gt{constructor(t){super(),mt(this,t,kh,vh,a,{name:0,desc:1,href:2})}};function Ah(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Sh(t){let e,n,r,i;return e=new pr({props:{accountType:"token2022/account",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Vh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ih(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.owner}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.owner),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function xh(t){let e,n;return e=new Gn({props:{type:"token2022/mint",address:t[2].parsed.base.mint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.mint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Eh(t){let e,n=t[2].parsed.base.amount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.amount+"")&&B(e,n)},d(t){t&&k(e)}}}function Th(t){let e,n=t[2].parsed.base.isNative+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.isNative+"")&&B(e,n)},d(t){t&&k(e)}}}function Ph(t){let e,n=t[2].parsed.base.isFrozen+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.isFrozen+"")&&B(e,n)},d(t){t&&k(e)}}}function Bh(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.delegate}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.delegate),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Lh(t){let e,n=t[2].parsed.base.delegatedAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.delegatedAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function $h(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.closeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.closeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Rh(t){let e,n;return e=new Mh({props:{name:"Unknown ExtensionType🚨",href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/extension/mod.rs#L906",desc:"Please be careful. Account microscope detected unknown extensions.",$$slots:{default:[Oh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Oh(t){let e,n,r=JSON.stringify(t[2].parsed.unknownExtensions)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=JSON.stringify(t[2].parsed.unknownExtensions)+"")&&B(n,r)},d(t){t&&k(e)}}}function Dh(t){let e,n,r=xn(t[2].parsed.extensions.transferFeeAmount)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.transferFeeAmount)+"")&&B(n,r)},d(t){t&&k(e)}}}function Ch(t){let e,n,r=xn(t[2].parsed.extensions.immutableOwner)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.immutableOwner)+"")&&B(n,r)},d(t){t&&k(e)}}}function Nh(t){let e,n,r=xn(t[2].parsed.extensions.memoTransfer)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.memoTransfer)+"")&&B(n,r)},d(t){t&&k(e)}}}function zh(t){let e,n,r=xn(t[2].parsed.extensions.cpiGuard)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.cpiGuard)+"")&&B(n,r)},d(t){t&&k(e)}}}function Uh(t){let e,n,r=xn(t[2].parsed.extensions.nonTransferableAccount)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.nonTransferableAccount)+"")&&B(n,r)},d(t){t&&k(e)}}}function jh(t){let e,n,r=xn(t[2].parsed.extensions.transferHookAccount)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.transferHookAccount)+"")&&B(n,r)},d(t){t&&k(e)}}}function Yh(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p=t[2].parsed.unknownExtensions.length>0&&Rh(t);return n=new Mh({props:{name:"TransferFeeAmount(2)",href:"https://spl.solana.com/token-2022/extensions#transfer-fees",desc:"Includes withheld transfer fees",$$slots:{default:[Dh]},$$scope:{ctx:t}}}),i=new Mh({props:{name:"ImmutableOwner(7)",href:"https://spl.solana.com/token-2022/extensions#immutable-owner",desc:"Indicates that the Account owner authority cannot be changed",$$slots:{default:[Ch]},$$scope:{ctx:t}}}),s=new Mh({props:{name:"MemoTransfer(8)",href:"https://spl.solana.com/token-2022/extensions#required-memo-on-transfer",desc:"Require inbound transfers to have memo",$$slots:{default:[Nh]},$$scope:{ctx:t}}}),u=new Mh({props:{name:"CpiGuard(11)",href:"https://spl.solana.com/token-2022/extensions#cpi-guard",desc:"Locks privileged token operations from happening via CPI",$$slots:{default:[zh]},$$scope:{ctx:t}}}),d=new Mh({props:{name:"NonTransferableAccount(13)",href:"https://spl.solana.com/token-2022/extensions#non-transferable-tokens",desc:"Indicates that the tokens in this account belong to a non-transferable mint",$$slots:{default:[Uh]},$$scope:{ctx:t}}}),h=new Mh({props:{name:"TransferHookAccount(15)",href:"https://spl.solana.com/token-2022/extensions#transfer-hook",desc:"Indicates that the tokens in this account belong to a mint with a transfer hook",$$slots:{default:[jh]},$$scope:{ctx:t}}}),{c(){p&&p.c(),e=I(),ht(n.$$.fragment),r=I(),ht(i.$$.fragment),o=I(),ht(s.$$.fragment),a=I(),ht(u.$$.fragment),c=I(),ht(d.$$.fragment),l=I(),ht(h.$$.fragment)},m(t,m){p&&p.m(t,m),v(t,e,m),ft(n,t,m),v(t,r,m),ft(i,t,m),v(t,o,m),ft(s,t,m),v(t,a,m),ft(u,t,m),v(t,c,m),ft(d,t,m),v(t,l,m),ft(h,t,m),f=!0},p(t,r){t[2].parsed.unknownExtensions.length>0?p?(p.p(t,r),2&r&&ot(p,1)):(p=Rh(t),p.c(),ot(p,1),p.m(e.parentNode,e)):p&&(rt(),st(p,1,1,(()=>{p=null})),it());const o={};10&r&&(o.$$scope={dirty:r,ctx:t}),n.$set(o);const a={};10&r&&(a.$$scope={dirty:r,ctx:t}),i.$set(a);const c={};10&r&&(c.$$scope={dirty:r,ctx:t}),s.$set(c);const l={};10&r&&(l.$$scope={dirty:r,ctx:t}),u.$set(l);const f={};10&r&&(f.$$scope={dirty:r,ctx:t}),d.$set(f);const m={};10&r&&(m.$$scope={dirty:r,ctx:t}),h.$set(m)},i(t){f||(ot(p),ot(n.$$.fragment,t),ot(i.$$.fragment,t),ot(s.$$.fragment,t),ot(u.$$.fragment,t),ot(d.$$.fragment,t),ot(h.$$.fragment,t),f=!0)},o(t){st(p),st(n.$$.fragment,t),st(i.$$.fragment,t),st(s.$$.fragment,t),st(u.$$.fragment,t),st(d.$$.fragment,t),st(h.$$.fragment,t),f=!1},d(t){p&&p.d(t),t&&k(e),pt(n,t),t&&k(r),pt(i,t),t&&k(o),pt(s,t),t&&k(a),pt(u,t),t&&k(c),pt(d,t),t&&k(l),pt(h,t)}}}function Fh(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b;return e=new vt({props:{name:"owner",type:"PublicKey",offset:"32",$$slots:{default:[Ih]},$$scope:{ctx:t}}}),r=new vt({props:{name:"mint",type:"PublicKey",offset:"0",$$slots:{default:[xh]},$$scope:{ctx:t}}}),o=new vt({props:{name:"amount",type:"u64",offset:"64",$$slots:{default:[Eh]},$$scope:{ctx:t}}}),a=new vt({props:{name:"isNative",type:"bool",$$slots:{default:[Th]},$$scope:{ctx:t}}}),c=new vt({props:{name:"isFrozen",type:"bool",$$slots:{default:[Ph]},$$scope:{ctx:t}}}),l=new vt({props:{name:"delegate",type:"COption",offset:"COption(72)+PublicKey(76)",$$slots:{default:[Bh]},$$scope:{ctx:t}}}),f=new vt({props:{name:"delegatedAmount",type:"u64",offset:"121",$$slots:{default:[Lh]},$$scope:{ctx:t}}}),m=new vt({props:{name:"closeAuthority",type:"COption",offset:"COption(129)+PublicKey(133)",$$slots:{default:[$h]},$$scope:{ctx:t}}}),y=new vt({props:{name:"extensions",$$slots:{default:[Yh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment)},m(t,w){ft(e,t,w),v(t,n,w),ft(r,t,w),v(t,i,w),ft(o,t,w),v(t,s,w),ft(a,t,w),v(t,u,w),ft(c,t,w),v(t,d,w),ft(l,t,w),v(t,h,w),ft(f,t,w),v(t,p,w),ft(m,t,w),v(t,g,w),ft(y,t,w),b=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const w={};10&n&&(w.$$scope={dirty:n,ctx:t}),y.$set(w)},i(t){b||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),b=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),b=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t)}}}function Wh(t){let e,n=t[2].derived.decimals+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.decimals+"")&&B(e,n)},d(t){t&&k(e)}}}function Hh(t){let e,n=t[2].derived.amount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.amount+"")&&B(e,n)},d(t){t&&k(e)}}}function Kh(t){let e,n=t[2].derived.isATA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isATA+"")&&B(e,n)},d(t){t&&k(e)}}}function qh(t){let e,n,r,i,o,s;return e=new vt({props:{name:"decimals",$$slots:{default:[Wh]},$$scope:{ctx:t}}}),r=new vt({props:{name:"amount",$$slots:{default:[Hh]},$$scope:{ctx:t}}}),o=new vt({props:{name:"isATA",$$slots:{default:[Kh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function Vh(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Fh]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[qh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Gh(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Zh(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/state.rs#L93"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Gh,then:Sh,catch:Ah,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("💎Token2022::Account "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Xh(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=_h(i.pubkey))},[i,r]}function Jh(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Qh(t){let e,n,r,i;return e=new pr({props:{accountType:"token2022/mint",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[_f]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function tf(t){let e,n=t[2].parsed.base.decimals+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.decimals+"")&&B(e,n)},d(t){t&&k(e)}}}function ef(t){let e,n=t[2].parsed.base.supply+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.supply+"")&&B(e,n)},d(t){t&&k(e)}}}function nf(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.mintAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.mintAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function rf(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.freezeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.freezeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function of(t){let e,n;return e=new Mh({props:{name:"Unknown ExtensionType🚨",href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/extension/mod.rs#L906",desc:"Please be careful. Account microscope detected unknown extensions.",$$slots:{default:[sf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function sf(t){let e,n,r=JSON.stringify(t[2].parsed.unknownExtensions)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=JSON.stringify(t[2].parsed.unknownExtensions)+"")&&B(n,r)},d(t){t&&k(e)}}}function af(t){let e,n,r=xn(t[2].parsed.extensions.transferFeeConfig)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.transferFeeConfig)+"")&&B(n,r)},d(t){t&&k(e)}}}function uf(t){let e,n,r=xn(t[2].parsed.extensions.mintCloseAuthority)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.mintCloseAuthority)+"")&&B(n,r)},d(t){t&&k(e)}}}function cf(t){let e,n,r=xn(t[2].parsed.extensions.defaultAccountState)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.defaultAccountState)+"")&&B(n,r)},d(t){t&&k(e)}}}function df(t){let e,n,r=xn(t[2].parsed.extensions.nonTransferable)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.nonTransferable)+"")&&B(n,r)},d(t){t&&k(e)}}}function lf(t){let e,n,r=xn(t[2].parsed.extensions.interestBearingConfig)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.interestBearingConfig)+"")&&B(n,r)},d(t){t&&k(e)}}}function hf(t){let e,n,r=xn(t[2].parsed.extensions.permanentDelegate)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.permanentDelegate)+"")&&B(n,r)},d(t){t&&k(e)}}}function ff(t){let e,n,r=xn(t[2].parsed.extensions.transferHook)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.transferHook)+"")&&B(n,r)},d(t){t&&k(e)}}}function pf(t){let e,n,r=xn(t[2].parsed.extensions.metadataPointer)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.metadataPointer)+"")&&B(n,r)},d(t){t&&k(e)}}}function mf(t){let e,n,r=xn(t[2].parsed.extensions.tokenMetadata)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.tokenMetadata)+"")&&B(n,r)},d(t){t&&k(e)}}}function gf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_=t[2].parsed.unknownExtensions.length>0&&of(t);return n=new Mh({props:{name:"TransferFeeConfig(1)",href:"https://spl.solana.com/token-2022/extensions#transfer-fees",desc:"Includes transfer fee rate info and accompanying authorities to withdraw and set the fee",$$slots:{default:[af]},$$scope:{ctx:t}}}),i=new Mh({props:{name:"MintCloseAuthority(3)",href:"https://spl.solana.com/token-2022/extensions#mint-close-authority",desc:"Includes an optional mint close authority",$$slots:{default:[uf]},$$scope:{ctx:t}}}),s=new Mh({props:{name:"DefaultAccountState(6)",href:"https://spl.solana.com/token-2022/extensions#default-account-state",desc:"Specifies the default Account::state for new Accounts",$$slots:{default:[cf]},$$scope:{ctx:t}}}),u=new Mh({props:{name:"NonTransferable(9)",href:"https://spl.solana.com/token-2022/extensions#non-transferable-tokens",desc:"Indicates that the tokens from this mint can't be transfered",$$slots:{default:[df]},$$scope:{ctx:t}}}),d=new Mh({props:{name:"InterestBearingConfig(10)",href:"https://spl.solana.com/token-2022/extensions#interest-bearing-tokens",desc:"Tokens accrue interest over time",$$slots:{default:[lf]},$$scope:{ctx:t}}}),h=new Mh({props:{name:"PermanentDelegate(12)",href:"https://spl.solana.com/token-2022/extensions#permanent-delegate",desc:"Includes an optional permanent delegate",$$slots:{default:[hf]},$$scope:{ctx:t}}}),p=new Mh({props:{name:"TransferHook(14)",href:"https://spl.solana.com/token-2022/extensions#transfer-hook",desc:"Mint requires a CPI to a program implementing the 'transfer hook' interface",$$slots:{default:[ff]},$$scope:{ctx:t}}}),g=new Mh({props:{name:"MetadataPointer(18)",href:"https://spl.solana.com/token-2022/extensions#metadata-pointer",desc:"Mint contains a pointer to another account (or the same account) that holds metadata",$$slots:{default:[pf]},$$scope:{ctx:t}}}),b=new Mh({props:{name:"TokenMetadata(19)",href:"https://spl.solana.com/token-2022/extensions#metadata",desc:"Mint contains token-metadata",$$slots:{default:[mf]},$$scope:{ctx:t}}}),{c(){_&&_.c(),e=I(),ht(n.$$.fragment),r=I(),ht(i.$$.fragment),o=I(),ht(s.$$.fragment),a=I(),ht(u.$$.fragment),c=I(),ht(d.$$.fragment),l=I(),ht(h.$$.fragment),f=I(),ht(p.$$.fragment),m=I(),ht(g.$$.fragment),y=I(),ht(b.$$.fragment)},m(t,k){_&&_.m(t,k),v(t,e,k),ft(n,t,k),v(t,r,k),ft(i,t,k),v(t,o,k),ft(s,t,k),v(t,a,k),ft(u,t,k),v(t,c,k),ft(d,t,k),v(t,l,k),ft(h,t,k),v(t,f,k),ft(p,t,k),v(t,m,k),ft(g,t,k),v(t,y,k),ft(b,t,k),w=!0},p(t,r){t[2].parsed.unknownExtensions.length>0?_?(_.p(t,r),2&r&&ot(_,1)):(_=of(t),_.c(),ot(_,1),_.m(e.parentNode,e)):_&&(rt(),st(_,1,1,(()=>{_=null})),it());const o={};10&r&&(o.$$scope={dirty:r,ctx:t}),n.$set(o);const a={};10&r&&(a.$$scope={dirty:r,ctx:t}),i.$set(a);const c={};10&r&&(c.$$scope={dirty:r,ctx:t}),s.$set(c);const l={};10&r&&(l.$$scope={dirty:r,ctx:t}),u.$set(l);const f={};10&r&&(f.$$scope={dirty:r,ctx:t}),d.$set(f);const m={};10&r&&(m.$$scope={dirty:r,ctx:t}),h.$set(m);const y={};10&r&&(y.$$scope={dirty:r,ctx:t}),p.$set(y);const w={};10&r&&(w.$$scope={dirty:r,ctx:t}),g.$set(w);const v={};10&r&&(v.$$scope={dirty:r,ctx:t}),b.$set(v)},i(t){w||(ot(_),ot(n.$$.fragment,t),ot(i.$$.fragment,t),ot(s.$$.fragment,t),ot(u.$$.fragment,t),ot(d.$$.fragment,t),ot(h.$$.fragment,t),ot(p.$$.fragment,t),ot(g.$$.fragment,t),ot(b.$$.fragment,t),w=!0)},o(t){st(_),st(n.$$.fragment,t),st(i.$$.fragment,t),st(s.$$.fragment,t),st(u.$$.fragment,t),st(d.$$.fragment,t),st(h.$$.fragment,t),st(p.$$.fragment,t),st(g.$$.fragment,t),st(b.$$.fragment,t),w=!1},d(t){_&&_.d(t),t&&k(e),pt(n,t),t&&k(r),pt(i,t),t&&k(o),pt(s,t),t&&k(a),pt(u,t),t&&k(c),pt(d,t),t&&k(l),pt(h,t),t&&k(f),pt(p,t),t&&k(m),pt(g,t),t&&k(y),pt(b,t)}}}function yf(t){let e,n,r,i,o,s,a,u,c,d;return e=new vt({props:{name:"decimals",type:"u8",offset:"44",$$slots:{default:[tf]},$$scope:{ctx:t}}}),r=new vt({props:{name:"supply",type:"u64",offset:"36",$$slots:{default:[ef]},$$scope:{ctx:t}}}),o=new vt({props:{name:"mintAuthority",type:"COption",offset:"COption(0)+PublicKey(4)",$$slots:{default:[nf]},$$scope:{ctx:t}}}),a=new vt({props:{name:"freezeAuthority",type:"COption",offset:"COption(46)+PublicKey(50)",$$slots:{default:[rf]},$$scope:{ctx:t}}}),c=new vt({props:{name:"extensions",$$slots:{default:[gf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment)},m(t,l){ft(e,t,l),v(t,n,l),ft(r,t,l),v(t,i,l),ft(o,t,l),v(t,s,l),ft(a,t,l),v(t,u,l),ft(c,t,l),d=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const l={};10&n&&(l.$$scope={dirty:n,ctx:t}),c.$set(l)},i(t){d||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),d=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),d=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t)}}}function bf(t){let e,n=t[2].derived.supply+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supply+"")&&B(e,n)},d(t){t&&k(e)}}}function wf(t){let e,n;return e=new vt({props:{name:"supply",$$slots:{default:[bf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function _f(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[yf]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[wf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function vf(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function kf(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/state.rs#L22"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:vf,then:Qh,catch:Jh,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("💎Token2022::Mint "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Mf(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=Ml(e,r,qr),s=function(t){const e=El(Al.TransferFeeConfig,t.tlvData);return null!==e?Bl.decode(e):null}(o),a=function(t){const e=El(Al.MintCloseAuthority,t.tlvData);return null!==e?jl.decode(e):null}(o),u=function(t){const e=El(Al.DefaultAccountState,t.tlvData);return null!==e?Yl.decode(e):null}(o),c=function(t){const e=El(Al.NonTransferable,t.tlvData);return null!==e?Dl.decode(e):null}(o),d=function(t){const e=El(Al.InterestBearingConfig,t.tlvData);return null!==e?Fl.decode(e):null}(o),l=function(t){const e=El(Al.PermanentDelegate,t.tlvData);return null!==e?Wl.decode(e):null}(o),h=function(t){const e=El(Al.TransferHook,t.tlvData);return null!==e?Cl.decode(e):null}(o),f=function(t){const e=El(Al.MetadataPointer,t.tlvData);if(null!==e){const{authority:t,metadataAddress:n}=Hl.decode(e);return{authority:t.equals(Mt.PublicKey.default)?null:t,metadataAddress:n.equals(Mt.PublicKey.default)?null:n}}return null}(o),p=(()=>{const t=El(Al.TokenMetadata,o.tlvData);return null===t?null:function(t){const e=yh.decode(t);return function(t){for(let e=0;e{switch(t){case Al.TransferFeeConfig:case Al.MintCloseAuthority:case Al.DefaultAccountState:case Al.NonTransferable:case Al.InterestBearingConfig:case Al.PermanentDelegate:case Al.TransferHook:case Al.MetadataPointer:case Al.TokenMetadata:return!1;default:return!0}}));return{meta:Xn(e,r,i),parsed:{base:o,extensions:{transferFeeConfig:s,mintCloseAuthority:a,defaultAccountState:u,nonTransferable:c,interestBearingConfig:d,permanentDelegate:l,transferHook:h,metadataPointer:f,tokenMetadata:p},unknownExtensions:m},derived:{supply:bn.DecimalUtil.fromBN(new(_n())(o.supply.toString()),o.decimals)}}}(i.pubkey))},[i,r]}var Af=n(64188);function Sf(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function If(t){let e,n,r,i;return e=new pr({props:{accountType:"tokenswap/swapstate",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Gf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function xf(t){let e,n=t[2].parsed.bumpSeed+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.bumpSeed+"")&&B(e,n)},d(t){t&&k(e)}}}function Ef(t){let e,n;return e=new Gn({props:{address:t[2].parsed.tokenProgramId}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.tokenProgramId),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Tf(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.vaultA}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.vaultA),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Pf(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.vaultB}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.vaultB),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Bf(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.poolMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.poolMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Lf(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.mintA}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.mintA),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function $f(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.mintB}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.mintB),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Rf(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.poolFeeAccount}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.poolFeeAccount),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Of(t){let e,n,r,i=t[2].parsed.traderFee.numerator+"",o=t[2].parsed.traderFee.denominator+"";return{c(){e=S(i),n=S(" / "),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].parsed.traderFee.numerator+"")&&B(e,i),2&n&&o!==(o=t[2].parsed.traderFee.denominator+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Df(t){let e,n,r,i=t[2].parsed.ownerFee.numerator+"",o=t[2].parsed.ownerFee.denominator+"";return{c(){e=S(i),n=S(" / "),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].parsed.ownerFee.numerator+"")&&B(e,i),2&n&&o!==(o=t[2].parsed.ownerFee.denominator+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Cf(t){let e,n=t[2].parsed.curveType+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.curveType+"")&&B(e,n)},d(t){t&&k(e)}}}function Nf(t){let e,n;return e=new vt({props:{name:"amp",type:"u64",offset:"284",$$slots:{default:[zf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function zf(t){let e,n=t[2].parsed.amp+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.amp+"")&&B(e,n)},d(t){t&&k(e)}}}function Uf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,E;e=new vt({props:{name:"bumpSeed",type:"u8",offset:"2",$$slots:{default:[xf]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tokenProgram",type:"PublicKey",offset:"3",$$slots:{default:[Ef]},$$scope:{ctx:t}}}),o=new vt({props:{name:"vaultA",type:"PublicKey",offset:"35",$$slots:{default:[Tf]},$$scope:{ctx:t}}}),a=new vt({props:{name:"vaultB",type:"PublicKey",offset:"67",$$slots:{default:[Pf]},$$scope:{ctx:t}}}),c=new vt({props:{name:"poolMint",type:"PublicKey",offset:"99",$$slots:{default:[Bf]},$$scope:{ctx:t}}}),l=new vt({props:{name:"mintA",type:"PublicKey",offset:"131",$$slots:{default:[Lf]},$$scope:{ctx:t}}}),f=new vt({props:{name:"mintB",type:"PublicKey",offset:"163",$$slots:{default:[$f]},$$scope:{ctx:t}}}),m=new vt({props:{name:"poolFeeAccount",type:"PublicKey",offset:"195",$$slots:{default:[Rf]},$$scope:{ctx:t}}}),y=new vt({props:{name:"traderFee",type:"u64, u64",offset:"u64(227)+u64(235)",$$slots:{default:[Of]},$$scope:{ctx:t}}}),w=new vt({props:{name:"ownerFee",type:"u64, u64",offset:"u64(243)+u64(251)",$$slots:{default:[Df]},$$scope:{ctx:t}}}),M=new vt({props:{name:"curveType",type:"u8",offset:"283",$$slots:{default:[Cf]},$$scope:{ctx:t}}});let T="Stable"===t[2].parsed.curveType&&Nf(t);return{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment),A=I(),T&&T.c(),S=x()},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),v(t,A,k),T&&T.m(t,k),v(t,S,k),E=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};10&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k),"Stable"===t[2].parsed.curveType?T?(T.p(t,n),2&n&&ot(T,1)):(T=Nf(t),T.c(),ot(T,1),T.m(S.parentNode,S)):T&&(rt(),st(T,1,1,(()=>{T=null})),it())},i(t){E||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),ot(T),E=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),st(T),E=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t),t&&k(A),T&&T.d(t),t&&k(S)}}}function jf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w;return u=new Gn({props:{type:"tokenswap/swapstate",address:t[2].meta.pubkey}}),f=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].derived.aquaFarm}}),b=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].derived.doubleDip}}),{c(){e=A("table"),n=A("thead"),n.innerHTML='accountpubkey',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),s.textContent="pool",a=A("td"),ht(u.$$.fragment),c=I(),d=A("tr"),l=A("td"),l.textContent="aquafarm",h=A("td"),ht(f.$$.fragment),p=I(),m=A("tr"),g=A("td"),g.textContent="doubledip",y=A("td"),ht(b.$$.fragment),P(s,"class","svelte-1i4wn2p"),P(a,"class","svelte-1i4wn2p"),P(l,"class","svelte-1i4wn2p"),P(h,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(y,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(o,a),ft(u,a,null),_(i,c),_(i,d),_(d,l),_(d,h),ft(f,h,null),_(i,p),_(i,m),_(m,g),_(m,y),ft(b,y,null),w=!0},p(t,e){const n={};2&e&&(n.address=t[2].meta.pubkey),u.$set(n);const r={};2&e&&(r.address=t[2].derived.aquaFarm),f.$set(r);const i={};2&e&&(i.address=t[2].derived.doubleDip),b.$set(i)},i(t){w||(ot(u.$$.fragment,t),ot(f.$$.fragment,t),ot(b.$$.fragment,t),w=!0)},o(t){st(u.$$.fragment,t),st(f.$$.fragment,t),st(b.$$.fragment,t),w=!1},d(t){t&&k(e),pt(u),pt(f),pt(b)}}}function Yf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T=Jf(t[2].derived.tokenInfoA)+"",L=t[2].derived.decimalsA+"",R=Jf(t[2].derived.tokenInfoB)+"",O=t[2].derived.decimalsB+"",D=t[2].derived.decimalsLP+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokendecimals',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("A"),u=S(T),c=A("td"),d=S(L),l=I(),h=A("tr"),f=A("td"),p=S("B"),m=S(R),g=A("td"),y=S(O),b=I(),w=A("tr"),M=A("td"),M.textContent="LP",x=A("td"),E=S(D),P(s,"class","svelte-1i4wn2p"),P(c,"class","svelte-1i4wn2p"),P(f,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(M,"class","svelte-1i4wn2p"),P(x,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y),_(i,b),_(i,w),_(w,M),_(w,x),_(x,E)},p(t,e){2&e&&T!==(T=Jf(t[2].derived.tokenInfoA)+"")&&B(u,T),2&e&&L!==(L=t[2].derived.decimalsA+"")&&B(d,L),2&e&&R!==(R=Jf(t[2].derived.tokenInfoB)+"")&&B(m,R),2&e&&O!==(O=t[2].derived.decimalsB+"")&&B(y,O),2&e&&D!==(D=t[2].derived.decimalsLP+"")&&B(E,D)},d(t){t&&k(e)}}}function Ff(t){let e,n=t[2].derived.supplyLP+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supplyLP+"")&&B(e,n)},d(t){t&&k(e)}}}function Wf(t){let e,n,r,i=t[2].derived.price+"",o=Qf(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.price+"")&&B(e,i),2&n&&o!==(o=Qf(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Hf(t){let e,n,r=t[2].derived.feeRate+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.feeRate+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function Kf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b=Jf(t[2].derived.tokenInfoA)+"",w=t[2].derived.tokenVaultAAmount+"",M=Jf(t[2].derived.tokenInfoB)+"",x=t[2].derived.tokenVaultBAmount+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokenamount',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("A"),u=S(b),c=A("td"),d=S(w),l=I(),h=A("tr"),f=A("td"),p=S("B"),m=S(M),g=A("td"),y=S(x),P(s,"class","svelte-1i4wn2p"),P(c,"class","svelte-1i4wn2p"),P(f,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,b){v(t,e,b),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y)},p(t,e){2&e&&b!==(b=Jf(t[2].derived.tokenInfoA)+"")&&B(u,b),2&e&&w!==(w=t[2].derived.tokenVaultAAmount+"")&&B(d,w),2&e&&M!==(M=Jf(t[2].derived.tokenInfoB)+"")&&B(m,M),2&e&&x!==(x=t[2].derived.tokenVaultBAmount+"")&&B(y,x)},d(t){t&&k(e)}}}function qf(t){let e,n=t[2].derived.poolFeeAccountAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.poolFeeAccountAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function Vf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p;return e=new vt({props:{name:"pool / aquafarm / doubledip",$$slots:{default:[jf]},$$scope:{ctx:t}}}),r=new vt({props:{name:"decimals",$$slots:{default:[Yf]},$$scope:{ctx:t}}}),o=new vt({props:{name:"LP token supply",$$slots:{default:[Ff]},$$scope:{ctx:t}}}),a=new vt({props:{name:"price",$$slots:{default:[Wf]},$$scope:{ctx:t}}}),c=new vt({props:{name:"fee rate",$$slots:{default:[Hf]},$$scope:{ctx:t}}}),l=new vt({props:{name:"token vault amount",$$slots:{default:[Kf]},$$scope:{ctx:t}}}),f=new vt({props:{name:"pool fee account amount",$$slots:{default:[qf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment)},m(t,m){ft(e,t,m),v(t,n,m),ft(r,t,m),v(t,i,m),ft(o,t,m),v(t,s,m),ft(a,t,m),v(t,u,m),ft(c,t,m),v(t,d,m),ft(l,t,m),v(t,h,m),ft(f,t,m),p=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const m={};10&n&&(m.$$scope={dirty:n,ctx:t}),f.$set(m)},i(t){p||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),p=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),p=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t)}}}function Gf(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Uf]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Vf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Zf(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Xf(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token-swap/program/src/state.rs#L104"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Zf,then:If,catch:Sf,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("⚖️TokenSwap::SwapState "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Jf(t,e=!1){return void 0===t?"":e?t.symbol:`(${t.symbol})`}function Qf(t,e){return void 0===t||void 0===e?"":`${e.symbol}/${t.symbol}`}function tp(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){var e,n;const r=bn.AddressUtil.toPubKey(t),i=It(),o=(0,jr.buildDefaultAccountFetcher)(i),{accountInfo:s,slotContext:a}=await Zn(i,r),u=function(t){if(324!==t.length)return null;const e=new DataView(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength));let n=2;const r=e.getUint8(n);n+=1;const i=new Mt.PublicKey(t.slice(n,n+32));n+=32;const o=new Mt.PublicKey(t.slice(n,n+32));n+=32;const s=new Mt.PublicKey(t.slice(n,n+32));n+=32;const a=new Mt.PublicKey(t.slice(n,n+32));n+=32;const u=new Mt.PublicKey(t.slice(n,n+32));n+=32;const c=new Mt.PublicKey(t.slice(n,n+32));n+=32;const d=new Mt.PublicKey(t.slice(n,n+32));n+=32;const l=Number(e.getBigUint64(n,!0));n+=8;const h=Number(e.getBigUint64(n,!0));n+=8;const f=Number(e.getBigUint64(n,!0));n+=8;const p=Number(e.getBigUint64(n,!0));n+=8,n+=32;const m=e.getUint8(n);n+=1;const g=Number(e.getBigUint64(n,!0));return n+=8,{bumpSeed:r,tokenProgramId:i,vaultA:o,vaultB:s,poolMint:a,mintA:u,mintB:c,poolFeeAccount:d,traderFee:bn.Percentage.fromFraction(l,h),ownerFee:bn.Percentage.fromFraction(f,p),curveType:0===m?"ConstantProduct":"Stable",amp:0===m?void 0:g}}(s.data),c=Array.from((await o.getMintInfos([u.mintA,u.mintB,u.poolMint],jr.IGNORE_CACHE)).values()),d=await Rn(),l=d.getTokenInfoByMint(u.mintA),h=d.getTokenInfoByMint(u.mintB),f=Array.from((await o.getTokenInfos([u.vaultA,u.vaultB,u.poolFeeAccount],jr.IGNORE_CACHE)).values()),p=bn.DecimalUtil.fromBN(f[0].amount,c[0].decimals),m=bn.DecimalUtil.fromBN(f[1].amount,c[1].decimals),g=c[0].decimals,y=c[1].decimals;let b=new fn(0);"ConstantProduct"!==u.curveType||p.isZero()||(b=Jn(m.div(p),y)),"Stable"===u.curveType&&(b=bn.DecimalUtil.fromBN((0,Af.Ek)(new kt.BN(1*10**g),f[0].amount,f[1].amount,new kt.BN(u.amp)),y));let w=u.traderFee;u.ownerFee.denominator.isZero()||(w=w.add(u.ownerFee));const _=await Nn(),v=_.getAquaFarmByAddress(u.poolMint),k=_.getDoubleDipByAddress(null==v?void 0:v.farmTokenMint),M=null==v?void 0:v.account,A=null==k?void 0:k.account;return{meta:Xn(r,s,a),parsed:u,derived:{decimalsA:c[0].decimals,decimalsB:c[1].decimals,decimalsLP:c[2].decimals,tokenInfoA:l,tokenInfoB:h,supplyLP:bn.DecimalUtil.fromBN(c[2].supply,c[2].decimals),tokenVaultAAmount:bn.DecimalUtil.fromBN(f[0].amount,c[0].decimals),tokenVaultBAmount:bn.DecimalUtil.fromBN(f[1].amount,c[1].decimals),poolFeeAccountAmount:bn.DecimalUtil.fromBN(null!==(n=null===(e=f[2])||void 0===e?void 0:e.amount)&&void 0!==n?n:new kt.BN(0),c[2].decimals),feeRate:w.toDecimal().mul(100),price:b,aquaFarm:M,doubleDip:A}}}(i.pubkey))},[i,r]}function ep(t,e,n){const r=t.slice();return r[7]=e[n],r}function np(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function rp(t){let e,n,r,i,o,s=t[6],a=[];for(let e=0;est(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='namedeprecatedaquafarmdoubledipdoubledip reward',r=I(),i=A("tbody");for(let t=0;t{x=null})),it()),t[7].doubledip?E?(E.p(t,e),2&e&&ot(E,1)):(E=sp(t),E.c(),ot(E,1),E.m(f,null)):E&&(rt(),st(E,1,1,(()=>{E=null})),it()),t[7].doubledip?T?(T.p(t,e),2&e&&ot(T,1)):(T=ap(t),T.c(),ot(T,1),T.m(m,null)):T&&(rt(),st(T,1,1,(()=>{T=null})),it())},i(t){y||(ot(x),ot(E),ot(T),y=!0)},o(t){st(x),st(E),st(T),y=!1},d(t){t&&k(e),M&&M.d(),x&&x.d(),E&&E.d(),T&&T.d()}}}function cp(e){let n;return{c(){n=S("loading...")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&k(n)}}}function dp(t){let e,n,r,i,s,a,u,c,d,l,h,f,p={ctx:t,current:null,token:null,hasCatch:!1,pending:cp,then:rp,catch:np,value:6,blocks:[,,,]};return at(d=t[1],p),{c(){e=A("h2"),e.textContent="⚖️TokenSwap::list",n=I(),r=A("form"),i=A("input"),s=I(),a=A("input"),u=I(),c=x(),p.block.c(),$(i,"margin","0.5em 0em"),P(i,"type","text"),P(i,"size","64"),P(i,"placeholder","SOL/USDC"),P(a,"type","submit"),a.value="Set Filter!",$(r,"margin-bottom","1em")},m(o,d){v(o,e,d),v(o,n,d),v(o,r,d),_(r,i),L(i,t[0]),_(r,s),_(r,a),v(o,u,d),v(o,c,d),p.block.m(o,p.anchor=d),p.mount=()=>c.parentNode,p.anchor=c,l=!0,h||(f=[E(i,"input",t[4]),E(r,"submit",T(t[2]))],h=!0)},p(e,[n]){t=e,1&n&&i.value!==t[0]&&L(i,t[0]),p.ctx=t,2&n&&d!==(d=t[1])&&at(d,p)||ut(p,t,n)},i(t){l||(ot(p.block),l=!0)},o(t){for(let t=0;t<3;t+=1)st(p.blocks[t]);l=!1},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(u),t&&k(c),p.block.d(t),p.token=null,p=null,h=!1,o(f)}}}function lp(t,e,n){let r,i,o;return t.$$.update=()=>{8&t.$$.dirty&&n(1,i=async function(t){return(await Nn()).tuples.filter((e=>0==t.length||-1!=e.pool.name.toUpperCase().indexOf(t.toUpperCase())))}(r))},n(3,r=""),[o,i,function(){n(3,r=o)},r,function(){o=this.value,n(0,o)}]}var hp=n(71794),fp=n(20880),pp=n(61401);async function mp(t){var e;const n=bn.AddressUtil.toPubKey(t),r=It(),i=(0,jr.buildDefaultAccountFetcher)(r),{accountInfo:o,slotContext:s}=await Zn(r,n),a=(0,pp.decodeGlobalFarmBuffer)(o),u=Array.from((await i.getTokenInfos([a.baseTokenVault,a.rewardTokenVault],jr.IGNORE_CACHE)).values()),c=u[1].mint,d=Array.from((await i.getMintInfos([a.baseTokenMint,a.farmTokenMint,c],jr.IGNORE_CACHE)).values()),l=d[0].decimals,h=d[1].decimals,f=d[2].decimals,p=bn.DecimalUtil.fromBN(d[0].supply,l),m=bn.DecimalUtil.fromBN(d[1].supply,h),g=bn.DecimalUtil.fromBN(u[1].amount,f),y=(await(0,fp.getAuthorityAndNonce)(n,o.owner))[0];let b=new fn(0);if(!a.emissionsPerSecondDenominator.isZero()){const t=604800,e=new fn(a.emissionsPerSecondNumerator.toString()),n=new fn(a.emissionsPerSecondDenominator.toString());b=Jn(bn.DecimalUtil.adjustDecimals(e.mul(t).div(n),f),f)}const w=await Nn();let _,v,k,M;const A=void 0!==w.getAquaFarmByAddress(n);if(A){const t=w.getAquaFarmByAddress(n);_=w.getPoolByAddress(t.baseTokenMint).account,k=t.account,M=null===(e=w.getDoubleDipByAddress(t.farmTokenMint))||void 0===e?void 0:e.account,v=w.getPoolByAddress(t.baseTokenMint).name}const S=void 0!==w.getDoubleDipByAddress(n);if(S){const t=w.getDoubleDipByAddress(n),e=w.getAquaFarmByAddress(t.baseTokenMint);M=t.account,k=e.account,_=w.getPoolByAddress(e.baseTokenMint).account,v=w.getPoolByAddress(e.baseTokenMint).name}return{meta:Xn(n,o,s),parsed:a,derived:{authority:y,rewardMint:c,decimalsBase:l,decimalsFarm:h,decimalsReward:f,supplyBase:p,supplyFarm:m,rewardVaultAmount:g,lastUpdatedTimestamp:yn().unix(a.lastUpdatedTimestamp.toNumber()),rewardWeeklyEmission:b,isAquaFarm:A,isDoubleDip:S,pool:_,aquaFarm:k,doubleDip:M,poolName:v}}}function gp(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function yp(t){let e,n,r,i;return e=new pr({props:{accountType:"aquafarm/globalfarm",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Fp]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function bp(t){let e,n=t[2].parsed.nonce+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.nonce+"")&&B(e,n)},d(t){t&&k(e)}}}function wp(t){let e,n;return e=new Gn({props:{address:t[2].parsed.tokenProgramId}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.tokenProgramId),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function _p(t){let e,n;return e=new Gn({props:{address:t[2].parsed.emissionsAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.emissionsAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function vp(t){let e,n;return e=new Gn({props:{address:t[2].parsed.removeRewardsAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.removeRewardsAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function kp(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.baseTokenMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.baseTokenMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Mp(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.baseTokenVault}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.baseTokenVault),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ap(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.rewardTokenVault}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.rewardTokenVault),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Sp(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.farmTokenMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.farmTokenMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ip(t){let e,n,r,i=t[2].parsed.emissionsPerSecondNumerator+"",o=t[2].parsed.emissionsPerSecondDenominator+"";return{c(){e=S(i),n=S(" / "),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].parsed.emissionsPerSecondNumerator+"")&&B(e,i),2&n&&o!==(o=t[2].parsed.emissionsPerSecondDenominator+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function xp(t){let e,n=t[2].parsed.lastUpdatedTimestamp+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.lastUpdatedTimestamp+"")&&B(e,n)},d(t){t&&k(e)}}}function Ep(t){let e,n=t[2].parsed.cumulativeEmissionsPerFarmToken+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.cumulativeEmissionsPerFarmToken+"")&&B(e,n)},d(t){t&&k(e)}}}function Tp(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A;return e=new vt({props:{name:"nonce",type:"u8",offset:"2",$$slots:{default:[bp]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tokenProgramId",type:"PublicKey",offset:"3",$$slots:{default:[wp]},$$scope:{ctx:t}}}),o=new vt({props:{name:"emissionsAuthority",type:"PublicKey",offset:"35",$$slots:{default:[_p]},$$scope:{ctx:t}}}),a=new vt({props:{name:"removeRewardsAuthority",type:"PublicKey",offset:"67",$$slots:{default:[vp]},$$scope:{ctx:t}}}),c=new vt({props:{name:"baseTokenMint",type:"PublicKey",offset:"99",$$slots:{default:[kp]},$$scope:{ctx:t}}}),l=new vt({props:{name:"baseTokenVault",type:"PublicKey",offset:"131",$$slots:{default:[Mp]},$$scope:{ctx:t}}}),f=new vt({props:{name:"rewardTokenVault",type:"PublicKey",offset:"163",$$slots:{default:[Ap]},$$scope:{ctx:t}}}),m=new vt({props:{name:"farmTokenMint",type:"PublicKey",offset:"195",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),y=new vt({props:{name:"emissionsPerSecondNumerator/Denominator",type:"u64, u64",offset:"u64(227)+u64(235)",$$slots:{default:[Ip]},$$scope:{ctx:t}}}),w=new vt({props:{name:"lastUpdatedTimestamp",type:"u64",offset:"243",$$slots:{default:[xp]},$$scope:{ctx:t}}}),M=new vt({props:{name:"cumulativeEmissionsPerFarmToken",type:"u256",offset:"251",$$slots:{default:[Ep]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),A=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};10&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k)},i(t){A||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),A=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),A=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t)}}}function Pp(t){let e,n=t[2].derived.isAquaFarm+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isAquaFarm+"")&&B(e,n)},d(t){t&&k(e)}}}function Bp(t){let e,n=t[2].derived.isDoubleDip+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isDoubleDip+"")&&B(e,n)},d(t){t&&k(e)}}}function Lp(t){let e,n=t[2].derived.poolName+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.poolName+"")&&B(e,n)},d(t){t&&k(e)}}}function $p(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w;return u=new Gn({props:{type:"tokenswap/swapstate",address:t[2].derived.pool}}),f=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].derived.aquaFarm}}),b=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].derived.doubleDip}}),{c(){e=A("table"),n=A("thead"),n.innerHTML='accountpubkey',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),s.textContent="pool",a=A("td"),ht(u.$$.fragment),c=I(),d=A("tr"),l=A("td"),l.textContent="aquafarm",h=A("td"),ht(f.$$.fragment),p=I(),m=A("tr"),g=A("td"),g.textContent="doubledip",y=A("td"),ht(b.$$.fragment),P(s,"class","svelte-1i4wn2p"),P(a,"class","svelte-1i4wn2p"),P(l,"class","svelte-1i4wn2p"),P(h,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(y,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(o,a),ft(u,a,null),_(i,c),_(i,d),_(d,l),_(d,h),ft(f,h,null),_(i,p),_(i,m),_(m,g),_(m,y),ft(b,y,null),w=!0},p(t,e){const n={};2&e&&(n.address=t[2].derived.pool),u.$set(n);const r={};2&e&&(r.address=t[2].derived.aquaFarm),f.$set(r);const i={};2&e&&(i.address=t[2].derived.doubleDip),b.$set(i)},i(t){w||(ot(u.$$.fragment,t),ot(f.$$.fragment,t),ot(b.$$.fragment,t),w=!0)},o(t){st(u.$$.fragment,t),st(f.$$.fragment,t),st(b.$$.fragment,t),w=!1},d(t){t&&k(e),pt(u),pt(f),pt(b)}}}function Rp(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w=t[2].derived.decimalsBase+"",M=t[2].derived.decimalsFarm+"",x=t[2].derived.decimalsReward+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokendecimals',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),s.textContent="Base",a=A("td"),u=S(w),c=I(),d=A("tr"),l=A("td"),l.textContent="Farm",h=A("td"),f=S(M),p=I(),m=A("tr"),g=A("td"),g.textContent="Reward",y=A("td"),b=S(x),P(s,"class","svelte-1i4wn2p"),P(a,"class","svelte-1i4wn2p"),P(l,"class","svelte-1i4wn2p"),P(h,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(y,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,w){v(t,e,w),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(o,a),_(a,u),_(i,c),_(i,d),_(d,l),_(d,h),_(h,f),_(i,p),_(i,m),_(m,g),_(m,y),_(y,b)},p(t,e){2&e&&w!==(w=t[2].derived.decimalsBase+"")&&B(u,w),2&e&&M!==(M=t[2].derived.decimalsFarm+"")&&B(f,M),2&e&&x!==(x=t[2].derived.decimalsReward+"")&&B(b,x)},d(t){t&&k(e)}}}function Op(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].derived.rewardMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.rewardMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Dp(t){let e,n;return e=new Gn({props:{address:t[2].derived.authority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.authority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Cp(t){let e,n=t[2].derived.supplyBase+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supplyBase+"")&&B(e,n)},d(t){t&&k(e)}}}function Np(t){let e,n=t[2].derived.supplyFarm+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supplyFarm+"")&&B(e,n)},d(t){t&&k(e)}}}function zp(t){let e,n=t[2].derived.rewardVaultAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.rewardVaultAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function Up(t){let e,n=t[2].derived.rewardWeeklyEmission+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.rewardWeeklyEmission+"")&&B(e,n)},d(t){t&&k(e)}}}function jp(t){let e,n=t[2].derived.lastUpdatedTimestamp.format("YYYY/MM/DD HH:mm:ss UTCZZ")+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.lastUpdatedTimestamp.format("YYYY/MM/DD HH:mm:ss UTCZZ")+"")&&B(e,n)},d(t){t&&k(e)}}}function Yp(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,x;return e=new vt({props:{name:"is aquafarm",$$slots:{default:[Pp]},$$scope:{ctx:t}}}),r=new vt({props:{name:"is doubledip",$$slots:{default:[Bp]},$$scope:{ctx:t}}}),o=new vt({props:{name:"pool",$$slots:{default:[Lp]},$$scope:{ctx:t}}}),a=new vt({props:{name:"pool / aquafarm / doubledip",$$slots:{default:[$p]},$$scope:{ctx:t}}}),c=new vt({props:{name:"decimals",$$slots:{default:[Rp]},$$scope:{ctx:t}}}),l=new vt({props:{name:"rewardMint",$$slots:{default:[Op]},$$scope:{ctx:t}}}),f=new vt({props:{name:"authority",$$slots:{default:[Dp]},$$scope:{ctx:t}}}),m=new vt({props:{name:"base token supply",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),y=new vt({props:{name:"farm token supply",$$slots:{default:[Np]},$$scope:{ctx:t}}}),w=new vt({props:{name:"reward vault amount",$$slots:{default:[zp]},$$scope:{ctx:t}}}),M=new vt({props:{name:"reward weekly emission",$$slots:{default:[Up]},$$scope:{ctx:t}}}),S=new vt({props:{name:"reward last updated timestamp",$$slots:{default:[jp]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment),A=I(),ht(S.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),v(t,A,k),ft(S,t,k),x=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};10&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k);const A={};10&n&&(A.$$scope={dirty:n,ctx:t}),S.$set(A)},i(t){x||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),ot(S.$$.fragment,t),x=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),st(S.$$.fragment,t),x=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t),t&&k(A),pt(S,t)}}}function Fp(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Tp]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Yp]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Wp(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Hp(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/aquafarm-sdk/blob/main/src/utils/layout.ts#L102"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Wp,then:yp,catch:gp,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🐋AquaFarm::GlobalFarm "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Kp(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=mp(i.pubkey))},[i,r]}function qp(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Vp(t){let e,n,r,i;return e=new pr({props:{accountType:"aquafarm/userfarm",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[um]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Gp(t){let e,n;return e=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].parsed.globalFarm}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.globalFarm),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Zp(t){let e,n;return e=new Gn({props:{address:t[2].parsed.owner}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.owner),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Xp(t){let e,n=t[2].parsed.baseTokensConverted+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.baseTokensConverted+"")&&B(e,n)},d(t){t&&k(e)}}}function Jp(t){let e,n=t[2].parsed.cumulativeEmissionsCheckpoint+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.cumulativeEmissionsCheckpoint+"")&&B(e,n)},d(t){t&&k(e)}}}function Qp(t){let e,n,r,i,o,s,a,u;return e=new vt({props:{name:"globalFarm",type:"PublicKey",offset:"2",$$slots:{default:[Gp]},$$scope:{ctx:t}}}),r=new vt({props:{name:"owner",type:"PublicKey",offset:"34",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),o=new vt({props:{name:"baseTokensConverted",type:"u64",offset:"42",$$slots:{default:[Xp]},$$scope:{ctx:t}}}),a=new vt({props:{name:"cumulativeEmissionsCheckpoint",type:"u256",offset:"50",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment)},m(t,c){ft(e,t,c),v(t,n,c),ft(r,t,c),v(t,i,c),ft(o,t,c),v(t,s,c),ft(a,t,c),u=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const c={};10&n&&(c.$$scope={dirty:n,ctx:t}),a.$set(c)},i(t){u||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),u=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),u=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t)}}}function tm(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w=t[2].derived.decimalsBase+"",M=t[2].derived.decimalsFarm+"",x=t[2].derived.decimalsReward+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokendecimals',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),s.textContent="Base",a=A("td"),u=S(w),c=I(),d=A("tr"),l=A("td"),l.textContent="Farm",h=A("td"),f=S(M),p=I(),m=A("tr"),g=A("td"),g.textContent="Reward",y=A("td"),b=S(x),P(s,"class","svelte-1i4wn2p"),P(a,"class","svelte-1i4wn2p"),P(l,"class","svelte-1i4wn2p"),P(h,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(y,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,w){v(t,e,w),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(o,a),_(a,u),_(i,c),_(i,d),_(d,l),_(d,h),_(h,f),_(i,p),_(i,m),_(m,g),_(m,y),_(y,b)},p(t,e){2&e&&w!==(w=t[2].derived.decimalsBase+"")&&B(u,w),2&e&&M!==(M=t[2].derived.decimalsFarm+"")&&B(f,M),2&e&&x!==(x=t[2].derived.decimalsReward+"")&&B(b,x)},d(t){t&&k(e)}}}function em(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].derived.rewardMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.rewardMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function nm(t){let e,n=t[2].derived.harvestableAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.harvestableAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function rm(t){let e,n=t[2].derived.currentHarvestableAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.currentHarvestableAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function im(t){let e,n=t[2].derived.rewardWeeklyEmission+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.rewardWeeklyEmission+"")&&B(e,n)},d(t){t&&k(e)}}}function om(t){let e,n,r=t[2].derived.sharePercentOfFarm+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.sharePercentOfFarm+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function sm(t){let e,n=t[2].derived.rewardWeeklyAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.rewardWeeklyAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function am(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p;return e=new vt({props:{name:"decimals",$$slots:{default:[tm]},$$scope:{ctx:t}}}),r=new vt({props:{name:"rewardMint",$$slots:{default:[em]},$$scope:{ctx:t}}}),o=new vt({props:{name:"harvestable reward amount",$$slots:{default:[nm]},$$scope:{ctx:t}}}),a=new vt({props:{name:"harvestable reward amount (estimate)",$$slots:{default:[rm]},$$scope:{ctx:t}}}),c=new vt({props:{name:"farm reward weekly emission",$$slots:{default:[im]},$$scope:{ctx:t}}}),l=new vt({props:{name:"share of farm",$$slots:{default:[om]},$$scope:{ctx:t}}}),f=new vt({props:{name:"reward weekly earned",$$slots:{default:[sm]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment)},m(t,m){ft(e,t,m),v(t,n,m),ft(r,t,m),v(t,i,m),ft(o,t,m),v(t,s,m),ft(a,t,m),v(t,u,m),ft(c,t,m),v(t,d,m),ft(l,t,m),v(t,h,m),ft(f,t,m),p=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const m={};10&n&&(m.$$scope={dirty:n,ctx:t}),f.$set(m)},i(t){p||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),p=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),p=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t)}}}function um(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Qp]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[am]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function cm(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function dm(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/aquafarm-sdk/blob/main/src/utils/layout.ts#L163"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:cm,then:Vp,catch:qp,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🐋AquaFarm::UserFarm "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function lm(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=(0,pp.decodeUserFarmBuffer)(r),s=await mp(o.globalFarm),a=s.derived.decimalsReward,u=bn.DecimalUtil.fromBN(o.baseTokensConverted,s.derived.decimalsBase),[c,d]=function(t,e,n){const r=new hp.Aquafarm(new hp.GlobalFarm(Object.assign(Object.assign({},e.parsed),{publicKey:e.meta.pubkey,authority:e.derived.authority})),e.meta.owner,new hp.UserFarm(Object.assign(Object.assign({},n),{publicKey:t}))),i=bn.DecimalUtil.toBN(e.derived.supplyFarm,e.derived.decimalsFarm);return[r.getCurrentHarvestableAmount(i),r.getHarvestableAmount()]}(e,s,o);let l,h;void 0!==c&&(l=bn.DecimalUtil.fromBN(c,a)),void 0!==d&&(h=bn.DecimalUtil.fromBN(d,a));let f=new fn(0);s.derived.supplyFarm.isZero()||(f=Jn(u.mul(100).div(s.derived.supplyFarm),9));const p=Jn(s.derived.rewardWeeklyEmission.mul(f.div(100)),a);return{meta:Xn(e,r,i),parsed:o,derived:{rewardMint:s.derived.rewardMint,decimalsBase:s.derived.decimalsBase,decimalsFarm:s.derived.decimalsFarm,decimalsReward:s.derived.decimalsReward,baseTokensConverted:u,sharePercentOfFarm:f,rewardWeeklyAmount:p,currentHarvestableAmount:l,harvestableAmount:h,rewardWeeklyEmission:s.derived.rewardWeeklyEmission}}}(i.pubkey))},[i,r]}function hm(t,e,n){const r=t.slice();return r[13]=e[n],r[15]=n,r}function fm(t,e,n){const r=t.slice();return r[13]=e[n],r[15]=n,r}function pm(t,e,n){const r=t.slice();return r[13]=e[n],r[18]=n,r}function mm(t,e,n){const r=t.slice();return r[13]=e[n],r[20]=n,r}function gm(t,e,n){const r=t.slice();return r[13]=e[n],r[15]=n,r}function ym(e){let n,r,i,o=(16*e[15]).toString(16).padStart(4,"0")+"";return{c(){n=A("div"),r=S(o),i=S(":")},m(t,e){v(t,n,e),_(n,r),_(n,i)},p:t,d(t){t&&k(n)}}}function bm(t){let e,n,r,i,s,a=t[4].data.toString("hex",16*t[15]+4*t[18]+t[20],16*t[15]+4*t[18]+t[20]+1)+"";function u(){return t[10](t[15],t[18],t[20])}function c(){return t[11](t[15],t[18],t[20])}return{c(){e=A("div"),n=S(a),P(e,"class",r=m(Sm(t[2],16*t[15]+4*t[18]+t[20]))+" svelte-13rs43s")},m(t,r){v(t,e,r),_(e,n),i||(s=[E(e,"click",u),E(e,"mouseenter",c),E(e,"mouseleave",Dm)],i=!0)},p(n,i){t=n,4&i&&r!==(r=m(Sm(t[2],16*t[15]+4*t[18]+t[20]))+" svelte-13rs43s")&&P(e,"class",r)},d(t){t&&k(e),i=!1,o(s)}}}function wm(t){let e,n=new Array(4),r=[];for(let e=0;e ',O=I(),D=A("thead"),D.innerHTML='typevalue',C=I(),N=A("tbody"),z=A("tr"),U=A("td"),U.textContent="pubkey",j=A("td"),W.c(),H=I(),K=A("tr"),q=A("td"),q.textContent="u8",V=A("td"),G=S(se),Z=I(),X=A("tr"),J=A("td"),J.textContent="i8",Q=A("td"),tt=S(ae),et=I(),nt=A("tr"),at=A("td"),at.textContent="u16",ut=A("td"),ct=S(ue),dt=I(),lt=A("tr"),ht=A("td"),ht.textContent="i16",ft=A("td"),pt=S(ce),mt=I(),gt=A("tr"),yt=A("td"),yt.textContent="u32",bt=A("td"),wt=S(de),_t=I(),vt=A("tr"),kt=A("td"),kt.textContent="i32",Mt=A("td"),At=S(le),St=I(),It=A("tr"),xt=A("td"),xt.textContent="u64",Et=A("td"),Tt=S(he),Pt=I(),Bt=A("tr"),Lt=A("td"),Lt.textContent="i64",$t=A("td"),Rt=S(fe),Ot=I(),Dt=A("tr"),Ct=A("td"),Ct.textContent="u128",Nt=A("td"),zt=S(pe),Ut=I(),jt=A("tr"),Yt=A("td"),Yt.textContent="datetime",Ft=A("td"),Wt=S(me),Ht=I(),Kt=A("tr"),qt=A("td"),qt.textContent="string",Vt=A("td"),Gt=S(ge),Zt=I(),Xt=A("tr"),Jt=A("td"),Qt=A("div"),te=A("input"),ee=S(" LittleEndian"),$(r,"display","flex"),$(r,"flex-direction","column"),$(r,"row-gap","2px"),$(o,"display","flex"),$(o,"flex-direction","column"),$(o,"row-gap","0px"),$(u,"display","flex"),$(u,"flex-direction","column"),$(u,"row-gap","2px"),P(p,"class","svelte-13rs43s"),P(m,"class","svelte-13rs43s"),P(w,"class","svelte-13rs43s"),P(x,"class","svelte-13rs43s"),P(U,"class","svelte-13rs43s"),P(j,"class","svelte-13rs43s"),P(q,"class","svelte-13rs43s"),P(V,"class","svelte-13rs43s"),P(J,"class","svelte-13rs43s"),P(Q,"class","svelte-13rs43s"),P(at,"class","svelte-13rs43s"),P(ut,"class","svelte-13rs43s"),P(ht,"class","svelte-13rs43s"),P(ft,"class","svelte-13rs43s"),P(yt,"class","svelte-13rs43s"),P(bt,"class","svelte-13rs43s"),P(kt,"class","svelte-13rs43s"),P(Mt,"class","svelte-13rs43s"),P(xt,"class","svelte-13rs43s"),P(Et,"class","svelte-13rs43s"),P(Lt,"class","svelte-13rs43s"),P($t,"class","svelte-13rs43s"),P(Ct,"class","svelte-13rs43s"),P(Nt,"class","svelte-13rs43s"),P(Yt,"class","svelte-13rs43s"),P(Ft,"class","svelte-13rs43s"),P(qt,"class","svelte-13rs43s"),P(Vt,"class","svelte-13rs43s"),P(te,"type","checkbox"),$(te,"background-color","green"),$(Qt,"display","flex"),$(Qt,"flex-direction","row"),$(Qt,"align-items","center"),P(Jt,"colspan","2"),P(Jt,"class","svelte-13rs43s"),$(h,"border-spacing","0"),$(l,"border-left","5px solid black"),$(l,"position","fixed"),$(l,"padding","2px 0px"),$(n,"display","flex"),$(n,"flex-direction","row"),$(n,"column-gap","12px"),$(n,"font-family","Consolas, ui-monospace, SFMono-Regular, Menlo, Monaco, 'Liberation Mono', 'Courier New', monospace")},m(t,k){v(t,n,k),_(n,r);for(let t=0;t{Se[n]=null})),it(),W=Se[F],W?W.p(t,e):(W=Se[F]=Ae[F](t),W.c()),ot(W,1),W.m(j,null)),(!ne||6&e)&&se!==(se=xm(t[4].data,t[2],t[1])+"")&&B(G,se),(!ne||6&e)&&ae!==(ae=Em(t[4].data,t[2],t[1])+"")&&B(tt,ae),(!ne||6&e)&&ue!==(ue=Tm(t[4].data,t[2],t[1])+"")&&B(ct,ue),(!ne||6&e)&&ce!==(ce=Pm(t[4].data,t[2],t[1])+"")&&B(pt,ce),(!ne||6&e)&&de!==(de=Bm(t[4].data,t[2],t[1])+"")&&B(wt,de),(!ne||6&e)&&le!==(le=Lm(t[4].data,t[2],t[1])+"")&&B(At,le),(!ne||6&e)&&he!==(he=$m(t[4].data,t[2],t[1])+"")&&B(Tt,he),(!ne||6&e)&&fe!==(fe=Rm(t[4].data,t[2],t[1])+"")&&B(Rt,fe),(!ne||6&e)&&pe!==(pe=t[6](t[4].data,t[2],t[1])+"")&&B(zt,pe),(!ne||6&e)&&me!==(me=t[7](t[4].data,t[2],t[1])+"")&&B(Wt,me),(!ne||6&e)&&ge!==(ge=Om(t[4].data,t[2],t[1])+"")&&B(Gt,ge),2&e&&(te.checked=t[1])},i(t){ne||(ot(W),ne=!0)},o(t){st(W),ne=!1},d(t){t&&k(n),M(be,t),M(_e,t),ve&&ve.d(),M(Me,t),Se[F].d(),re=!1,ie()}}}function Sm(t,e){return e{e.push(t<32||t>126?".":String.fromCharCode(t))})),e.join("")}function xm(t,e,n=!0){if(void 0!==e&&!(e+1>t.length))return t.readUInt8(e).toString()}function Em(t,e,n=!0){if(void 0!==e&&!(e+1>t.length))return t.readInt8(e).toString()}function Tm(t,e,n=!0){if(void 0!==e&&!(e+2>t.length))return n?t.readUInt16LE(e).toString():t.readUInt16BE(e).toString()}function Pm(t,e,n=!0){if(void 0!==e&&!(e+2>t.length))return n?t.readInt16LE(e).toString():t.readInt16BE(e).toString()}function Bm(t,e,n=!0){if(void 0!==e&&!(e+4>t.length))return n?t.readUInt32LE(e).toString():t.readUInt32BE(e).toString()}function Lm(t,e,n=!0){if(void 0!==e&&!(e+4>t.length))return n?t.readInt32LE(e).toString():t.readInt32BE(e).toString()}function $m(t,e,n=!0){if(void 0!==e&&!(e+8>t.length))return n?t.readBigUInt64LE(e).toString():t.readBigUInt64BE(e).toString()}function Rm(t,e,n=!0){if(void 0!==e&&!(e+8>t.length))return n?t.readBigInt64LE(e).toString():t.readBigInt64BE(e).toString()}function Om(t,e,n=!0){if(void 0!==e&&!(e+1>t.length))return t.readUInt8(e),Im(t.slice(e,e+32))}const Dm=()=>{};function Cm(t,e,n){const r=10240;let{accountInfo:i}=e;const o=Object.assign(Object.assign({},i),{data:i.meta.data.slice(0,r),overflow:i.meta.data.length>r});let s,a,u=!0;function c(t){n(2,a=t)}return t.$$set=t=>{"accountInfo"in t&&n(9,i=t.accountInfo)},[s,u,a,r,o,c,function(t,e,n=!0){if(void 0===e)return;if(e+16>t.length)return;const r=n?t.readBigUInt64LE(e+8):t.readBigUInt64BE(e),i=n?t.readBigUInt64LE(e):t.readBigUInt64BE(e+8);return new(_n())(i.toString()).add(new(_n())(r.toString()).shln(64)).toString()},function(t,e,n=!0){if(void 0===e)return;if(e+8>t.length)return;const r=n?t.readBigInt64LE(e):t.readBigInt64BE(e);if(!(r<0||r>253402300799))try{return yn().unix(Number.parseInt(r.toString())).format("YYYY/MM/DD HH:mm:ss UTCZZ")}catch(t){return}},function(t,e,n=!0){if(void 0!==e&&!(e+32>t.length))try{return new Mt.PublicKey(t.slice(e,e+32))}catch(t){return}},i,(t,e,n)=>c(16*t+4*e+n),(t,e,r)=>{n(0,s=16*t+4*e+r)},function(){u=this.checked,n(1,u)}]}const Nm=class extends gt{constructor(t){super(),mt(this,t,Cm,Am,a,{accountInfo:9})}};function zm(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Um(t){let e,n,r,i;e=new pr({props:{accountType:"generic",meta:t[2].meta}});let o=t[2].meta.data.length>0&&jm(t);return{c(){ht(e.$$.fragment),n=I(),o&&o.c(),r=x()},m(t,s){ft(e,t,s),v(t,n,s),o&&o.m(t,s),v(t,r,s),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i),t[2].meta.data.length>0?o?(o.p(t,n),2&n&&ot(o,1)):(o=jm(t),o.c(),ot(o,1),o.m(r.parentNode,r)):o&&(rt(),st(o,1,1,(()=>{o=null})),it())},i(t){i||(ot(e.$$.fragment,t),ot(o),i=!0)},o(t){st(e.$$.fragment,t),st(o),i=!1},d(t){pt(e,t),t&&k(n),o&&o.d(t),t&&k(r)}}}function jm(t){let e,n;return e=new oi({props:{$$slots:{default:[Ym]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ym(t){let e,n;return e=new Nm({props:{accountInfo:t[2]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.accountInfo=t[2]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Fm(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Wm(t){let e,n,r,i,o,s={ctx:t,current:null,token:null,hasCatch:!1,pending:Fm,then:Um,catch:zm,value:2,blocks:[,,,]};return at(i=t[1],s),{c(){e=A("h2"),e.textContent="📘Generic",n=I(),r=x(),s.block.c()},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i),s.block.m(t,s.anchor=i),s.mount=()=>r.parentNode,s.anchor=r,o=!0},p(e,[n]){t=e,s.ctx=t,2&n&&i!==(i=t[1])&&at(i,s)||ut(s,t,n)},i(t){o||(ot(s.block),o=!0)},o(t){for(let t=0;t<3;t+=1)st(s.blocks[t]);o=!1},d(t){t&&k(e),t&&k(n),t&&k(r),s.block.d(t),s.token=null,s=null}}}function Hm(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e);return{meta:Xn(e,r,i),parsed:{},derived:{}}}(i.pubkey))},[i,r]}const Km={"/":class extends gt{constructor(t){super(),mt(this,t,null,yt,a,{})}},"/whirlpool/list":class extends gt{constructor(t){super(),mt(this,t,Gu,Vu,a,{})}},"/whirlpool/listPositions/:pubkey":class extends gt{constructor(t){super(),mt(this,t,rc,ec,a,{params:10})}},"/whirlpool/config/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Ma,ka,a,{params:0})}},"/whirlpool/configextension/:pubkey":class extends gt{constructor(t){super(),mt(this,t,$a,La,a,{params:0})}},"/whirlpool/tokenbadge/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Ya,ja,a,{params:0})}},"/whirlpool/feetier/:pubkey":class extends gt{constructor(t){super(),mt(this,t,tu,Qa,a,{params:0})}},"/whirlpool/whirlpool/:pubkey":class extends gt{constructor(t){super(),mt(this,t,os,ns,a,{params:0})}},"/whirlpool/tickarray/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Mu,ku,a,{params:0})}},"/whirlpool/position/:pubkey":class extends gt{constructor(t){super(),mt(this,t,sa,ra,a,{params:0})}},"/whirlpool/positionbundle/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Yu,ju,a,{params:0})}},"/token/account/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Ac,Mc,a,{params:0})}},"/token/mint/:pubkey":class extends gt{constructor(t){super(),mt(this,t,sd,od,a,{params:0})}},"/token/listTokenAccounts/:pubkey?":class extends gt{constructor(t){super(),mt(this,t,_d,wd,a,{params:4})}},"/token/deriveAta":class extends gt{constructor(t){super(),mt(this,t,Bd,Td,a,{})}},"/token2022/account/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Xh,Zh,a,{params:0})}},"/token2022/mint/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Mf,kf,a,{params:0})}},"/tokenswap/list":class extends gt{constructor(t){super(),mt(this,t,lp,dp,a,{})}},"/tokenswap/swapstate/:pubkey":class extends gt{constructor(t){super(),mt(this,t,tp,Xf,a,{params:0})}},"/aquafarm/globalfarm/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Kp,Hp,a,{params:0})}},"/aquafarm/userfarm/:pubkey":class extends gt{constructor(t){super(),mt(this,t,lm,dm,a,{params:0})}},"/generic/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Hm,Wm,a,{params:0})}}};function qm(t,e,n){const r=t.slice();return r[6]=e[n],r}function Vm(e){let n,r,i,o,s,a,u=e[6].name+"",c=e[6].url+"";return{c(){n=A("option"),r=S(u),i=S(" ("),o=S(c),s=S(")"),n.__value=a=e[6].id,n.value=n.__value},m(t,e){v(t,n,e),_(n,r),_(n,i),_(n,o),_(n,s)},p:t,d(t){t&&k(n)}}}function Gm(e){let n,r,i,s,a,u,c,d,l=e[1],h=[];for(let t=0;te[3].call(i)))},m(t,o){v(t,n,o),_(n,r),_(r,i);for(let t=0;tn(4,r=t),t.$$.on_destroy.push(c(i,o));const s=xt,a=new Map;let u;return s.forEach((t=>a.set(t.id,t))),St(s[0].url),[u,s,function(){let t="";if("custom"===u)t=window.prompt("Input your RPC Server");else{const e=a.get(u);console.log(e),t=e.url}St(t),async function(t){if(!t||t.length<1||"/"!=t.charAt(0)&&0!==t.indexOf("#/"))throw Error("Invalid parameter location");await q();const e=("#"==t.charAt(0)?"":"#")+t;try{const t={...history.state};delete t.__svelte_spa_router_scrollX,delete t.__svelte_spa_router_scrollY,window.history.replaceState(t,void 0,e)}catch(t){console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}(r)},function(){u=O(this),n(0,u),n(1,s)}]}const Xm=class extends gt{constructor(t){super(),mt(this,t,Zm,Gm,a,{})}},Jm=new Mt.PublicKey("DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1"),Qm=new Mt.PublicKey("9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP"),tg=new Mt.PublicKey("3xQ8SWv2GaFXXpHZNqkXsdxq5DZciHBz6ZFoPPfbFd7U"),eg=new Mt.PublicKey("82yxjeMsvaURa4MbZZ7WZZHfobirZYkH1zF8fmeGtyaQ");function ng(t){let e,n,r,i,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,S,x,B,R,O,D,C,N,z,U;return r=new Xm({}),C=new Ur({props:{routes:Km}}),{c(){e=A("main"),n=A("div"),ht(r.$$.fragment),i=I(),s=A("h1"),s.textContent="🔬Account microscope",a=I(),u=A("div"),u.innerHTML='Account microscope is open source. \n If you are interested in how they are derived, please check the code 👍',c=I(),d=A("form"),l=A("input"),h=I(),f=A("input"),p=I(),m=A("input"),g=I(),y=A("a"),y.textContent="🪧 whirlpool/list",b=I(),w=A("a"),w.textContent="🪧 tokenswap/list",M=I(),S=A("a"),S.textContent="🪧 token/listTokenAccounts",x=I(),B=A("a"),B.textContent="🪧 token/deriveAta",R=I(),O=A("hr"),D=I(),ht(C.$$.fragment),$(n,"text-align","right"),$(s,"margin","0em"),$(u,"font-size","small"),$(u,"margin-bottom","10px"),$(l,"margin","0.5em 0em"),P(l,"type","text"),P(l,"size","64"),P(l,"placeholder","HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ"),P(f,"type","submit"),f.value="Check!",P(m,"type","button"),m.value="HexDump!",P(y,"href","#/whirlpool/list"),$(y,"font-size","smaller"),$(y,"text-decoration","none"),P(w,"href","#/tokenswap/list"),$(w,"font-size","smaller"),$(w,"text-decoration","none"),P(S,"href","#/token/listTokenAccounts"),$(S,"font-size","smaller"),$(S,"text-decoration","none"),P(B,"href","#/token/deriveAta"),$(B,"font-size","smaller"),$(B,"text-decoration","none"),P(e,"class","svelte-dgluc6")},m(o,k){v(o,e,k),_(e,n),ft(r,n,null),_(e,i),_(e,s),_(e,a),_(e,u),_(e,c),_(e,d),_(d,l),L(l,t[0]),_(d,h),_(d,f),_(d,p),_(d,m),_(e,g),_(e,y),_(e,b),_(e,w),_(e,M),_(e,S),_(e,x),_(e,B),_(e,R),_(e,O),_(e,D),ft(C,e,null),N=!0,z||(U=[E(l,"input",t[3]),E(m,"click",t[2]),E(d,"submit",T(t[1]))],z=!0)},p(t,[e]){1&e&&l.value!==t[0]&&L(l,t[0])},i(t){N||(ot(r.$$.fragment,t),ot(C.$$.fragment,t),N=!0)},o(t){st(r.$$.fragment,t),st(C.$$.fragment,t),N=!1},d(t){t&&k(e),pt(r),pt(C),z=!1,o(U)}}}function rg(t,e,n){let r;function i(t){const e=`${t.path}/${t.pubkey}`;console.log(e),Nr(e)}return[r,function(){console.log(r),async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=await n.getAccountInfo(e);if(r.owner.equals(jr.ORCA_WHIRLPOOL_PROGRAM_ID))switch(r.data.length){case 9988:return{pubkey:e,path:"/whirlpool/tickarray"};case 653:return{pubkey:e,path:"/whirlpool/whirlpool"};case 616:return{pubkey:e,path:"/whirlpool/configextension"};case 216:return{pubkey:e,path:"/whirlpool/position"};case 200:return{pubkey:e,path:"/whirlpool/tokenbadge"};case 136:return{pubkey:e,path:"/whirlpool/positionbundle"};case 108:return{pubkey:e,path:"/whirlpool/config"};case 44:return{pubkey:e,path:"/whirlpool/feetier"}}if(r.owner.equals(Hr))switch(r.data.length){case 165:return{pubkey:e,path:"/token/account"};case 82:return{pubkey:e,path:"/token/mint"}}if(r.owner.equals(qr))switch(r.data.length){case 165:return{pubkey:e,path:"/token2022/account"};case 82:return{pubkey:e,path:"/token2022/mint"};default:if(r.data.length>=166){if(1===r.data[165])return{pubkey:e,path:"/token2022/mint"};if(2===r.data[165])return{pubkey:e,path:"/token2022/account"}}}if((r.owner.equals(Jm)||r.owner.equals(Qm)||r.owner.equals(tg))&&324===r.data.length)return{pubkey:e,path:"/tokenswap/swapstate"};if(r.owner.equals(eg))switch(r.data.length){case 283:return{pubkey:e,path:"/aquafarm/globalfarm"};case 106:return{pubkey:e,path:"/aquafarm/userfarm"}}return{pubkey:e,path:"/generic"}}(r).then(i)},function(){const t=`/generic/${r}`;console.log(t),Nr(t)},function(){r=this.value,n(0,r)}]}BigInt.prototype.toJSON=function(){return this.toString()},new class extends gt{constructor(t){super(),mt(this,t,rg,ng,a,{})}}({target:document.body,props:{name:"world"}})})()})(); \ No newline at end of file +(()=>{var t={78845:(t,e,n)=>{"use strict";n.r(e),n.d(e,{AccountClient:()=>ro,AnchorError:()=>Er,AnchorProvider:()=>mr,BN:()=>s(),BorshAccountsCoder:()=>Vr,BorshCoder:()=>Jr,BorshEventCoder:()=>Gr,BorshInstructionCoder:()=>jr,DISCRIMINATOR_SIZE:()=>Kr,EventManager:()=>so,EventParser:()=>ao,IdlError:()=>Ir,LangErrorCode:()=>Br,LangErrorMessage:()=>Lr,MethodsBuilderFactory:()=>vo,Native:()=>Po,Program:()=>xo,ProgramError:()=>Tr,ProgramErrorStack:()=>xr,SystemCoder:()=>Di,eventDiscriminator:()=>Zr,getProvider:()=>_r,parseIdlErrors:()=>Dn,setProvider:()=>wr,splitArgsAndCtx:()=>Ji,toInstruction:()=>Cn,translateAddress:()=>zn,translateError:()=>Pr,utils:()=>Gi,validateAccounts:()=>Nn,web3:()=>i});var r=n(48764),i=n(33957),o=n(13550),s=n.n(o),a=n(77191),u=n.n(a),c=n(23204),d=n.n(c),l=n(61275),h=n(17748);function f(t){let e=t.length;for(;--e>=0;)t[e]=0}const p=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),m=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),g=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),y=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),b=new Array(576);f(b);const w=new Array(60);f(w);const _=new Array(512);f(_);const v=new Array(256);f(v);const k=new Array(29);f(k);const M=new Array(30);function A(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}let S,I,x;function E(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}f(M);const T=t=>t<256?_[t]:_[256+(t>>>7)],P=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},B=(t,e,n)=>{t.bi_valid>16-n?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<{B(t,n[2*e],n[2*e+1])},$=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},R=(t,e,n)=>{const r=new Array(16);let i,o,s=0;for(i=1;i<=15;i++)s=s+n[i-1]<<1,r[i]=s;for(o=0;o<=e;o++){let e=t[2*o+1];0!==e&&(t[2*o]=$(r[e]++,e))}},O=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},D=t=>{t.bi_valid>8?P(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},C=(t,e,n,r)=>{const i=2*e,o=2*n;return t[i]{const r=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i{let r,i,o,s,a=0;if(0!==t.sym_next)do{r=255&t.pending_buf[t.sym_buf+a++],r+=(255&t.pending_buf[t.sym_buf+a++])<<8,i=t.pending_buf[t.sym_buf+a++],0===r?L(t,i,e):(o=v[i],L(t,o+256+1,e),s=p[o],0!==s&&(i-=k[o],B(t,i,s)),r--,o=T(r),L(t,o,n),s=m[o],0!==s&&(r-=M[o],B(t,r,s)))}while(a{const n=e.dyn_tree,r=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.elems;let s,a,u,c=-1;for(t.heap_len=0,t.heap_max=573,s=0;s>1;s>=1;s--)N(t,n,s);u=o;do{s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],N(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=a,n[2*u]=n[2*s]+n[2*a],t.depth[u]=(t.depth[s]>=t.depth[a]?t.depth[s]:t.depth[a])+1,n[2*s+1]=n[2*a+1]=u,t.heap[1]=u++,N(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,u=e.stat_desc.max_length;let c,d,l,h,f,p,m=0;for(h=0;h<=15;h++)t.bl_count[h]=0;for(n[2*t.heap[t.heap_max]+1]=0,c=t.heap_max+1;c<573;c++)d=t.heap[c],h=n[2*n[2*d+1]+1]+1,h>u&&(h=u,m++),n[2*d+1]=h,d>r||(t.bl_count[h]++,f=0,d>=a&&(f=s[d-a]),p=n[2*d],t.opt_len+=p*(h+f),o&&(t.static_len+=p*(i[2*d+1]+f)));if(0!==m){do{for(h=u-1;0===t.bl_count[h];)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[u]--,m-=2}while(m>0);for(h=u;0!==h;h--)for(d=t.bl_count[h];0!==d;)l=t.heap[--c],l>r||(n[2*l+1]!==h&&(t.opt_len+=(h-n[2*l+1])*n[2*l],n[2*l+1]=h),d--)}})(t,e),R(n,c,t.bl_count)},j=(t,e,n)=>{let r,i,o=-1,s=e[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=s,s=e[2*(r+1)+1],++a{let r,i,o=-1,s=e[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),r=0;r<=n;r++)if(i=s,s=e[2*(r+1)+1],!(++a{B(t,0+(r?1:0),3),D(t),P(t,n),P(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var H={_tr_init:t=>{F||((()=>{let t,e,n,r,i;const o=new Array(16);for(n=0,r=0;r<28;r++)for(k[r]=n,t=0;t<1<>=7;r<30;r++)for(M[r]=i<<7,t=0;t<1<{let i,o,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),U(t,t.l_desc),U(t,t.d_desc),s=(t=>{let e;for(j(t,t.dyn_ltree,t.l_desc.max_code),j(t,t.dyn_dtree,t.d_desc.max_code),U(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*y[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?W(t,e,n,r):4===t.strategy||o===i?(B(t,2+(r?1:0),3),z(t,b,w)):(B(t,4+(r?1:0),3),((t,e,n,r)=>{let i;for(B(t,e-257,5),B(t,n-1,5),B(t,r-4,4),i=0;i(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(v[n]+256+1)]++,t.dyn_dtree[2*T(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{B(t,2,3),L(t,256,b),(t=>{16===t.bi_valid?(P(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}},K=(t,e,n,r)=>{let i=65535&t|0,o=t>>>16&65535|0,s=0;for(;0!==n;){s=n>2e3?2e3:n,n-=s;do{i=i+e[r++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0};const q=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var V=(t,e,n,r)=>{const i=q,o=r+n;t^=-1;for(let n=r;n>>8^i[255&(t^e[n])];return-1^t},G={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Z={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:X,_tr_stored_block:J,_tr_flush_block:Q,_tr_tally:tt,_tr_align:et}=H,{Z_NO_FLUSH:nt,Z_PARTIAL_FLUSH:rt,Z_FULL_FLUSH:it,Z_FINISH:ot,Z_BLOCK:st,Z_OK:at,Z_STREAM_END:ut,Z_STREAM_ERROR:ct,Z_DATA_ERROR:dt,Z_BUF_ERROR:lt,Z_DEFAULT_COMPRESSION:ht,Z_FILTERED:ft,Z_HUFFMAN_ONLY:pt,Z_RLE:mt,Z_FIXED:gt,Z_DEFAULT_STRATEGY:yt,Z_UNKNOWN:bt,Z_DEFLATED:wt}=Z,_t=258,vt=262,kt=42,Mt=113,At=666,St=(t,e)=>(t.msg=G[e],e),It=t=>2*t-(t>4?9:0),xt=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Et=t=>{let e,n,r,i=t.w_size;e=t.hash_size,r=e;do{n=t.head[--r],t.head[r]=n>=i?n-i:0}while(--e);e=i,r=e;do{n=t.prev[--r],t.prev[r]=n>=i?n-i:0}while(--e)};let Tt=(t,e,n)=>(e<{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))},Bt=(t,e)=>{Q(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Pt(t.strm)},Lt=(t,e)=>{t.pending_buf[t.pending++]=e},$t=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Rt=(t,e,n,r)=>{let i=t.avail_in;return i>r&&(i=r),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),n),1===t.state.wrap?t.adler=K(t.adler,e,i,n):2===t.state.wrap&&(t.adler=V(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},Ot=(t,e)=>{let n,r,i=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match;const u=t.strstart>t.w_size-vt?t.strstart-(t.w_size-vt):0,c=t.window,d=t.w_mask,l=t.prev,h=t.strstart+_t;let f=c[o+s-1],p=c[o+s];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(n=e,c[n+s]===p&&c[n+s-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&os){if(t.match_start=e,s=r,r>=a)break;f=c[o+s-1],p=c[o+s]}}}while((e=l[e&d])>u&&0!=--i);return s<=t.lookahead?s:t.lookahead},Dt=t=>{const e=t.w_size;let n,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-vt)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Et(t),r+=e),0===t.strm.avail_in)break;if(n=Rt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=n,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Tt(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Tt(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let n,r,i,o=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,s=0,a=t.strm.avail_in;do{if(n=65535,i=t.bi_valid+42>>3,t.strm.avail_outr+t.strm.avail_in&&(n=r+t.strm.avail_in),n>i&&(n=i),n>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Pt(t.strm),r&&(r>n&&(r=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+r),t.strm.next_out),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r,t.block_start+=r,n-=r),n&&(Rt(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}while(0===s);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_wateri&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&(Rt(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,o=i>t.w_size?t.w_size:i,r=t.strstart-t.block_start,(r>=o||(r||e===ot)&&e!==nt&&0===t.strm.avail_in&&r<=i)&&(n=r>i?i:r,s=e===ot&&0===t.strm.avail_in&&n===r?1:0,J(t,t.block_start,n,s),t.block_start+=n,Pt(t.strm)),s?3:1)},Nt=(t,e)=>{let n,r;for(;;){if(t.lookahead=3&&(t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-vt&&(t.match_length=Ot(t,n)),t.match_length>=3)if(r=tt(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+1]);else r=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Bt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===ot?(Bt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bt(t,!1),0===t.strm.avail_out)?1:2},zt=(t,e)=>{let n,r,i;for(;;){if(t.lookahead=3&&(t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,r=tt(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=Tt(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(Bt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(r=tt(t,0,t.window[t.strstart-1]),r&&Bt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=tt(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===ot?(Bt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bt(t,!1),0===t.strm.avail_out)?1:2};function Ut(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}const jt=[new Ut(0,0,0,0,Ct),new Ut(4,4,8,4,Nt),new Ut(4,5,16,8,Nt),new Ut(4,6,32,32,Nt),new Ut(4,4,16,16,zt),new Ut(8,16,32,32,zt),new Ut(8,16,128,128,zt),new Ut(8,32,128,256,zt),new Ut(32,128,258,1024,zt),new Ut(32,258,258,4096,zt)];function Yt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=wt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),xt(this.dyn_ltree),xt(this.dyn_dtree),xt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),xt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),xt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ft=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==kt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Mt&&e.status!==At?1:0},Wt=t=>{if(Ft(t))return St(t,ct);t.total_in=t.total_out=0,t.data_type=bt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?kt:Mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,X(e),at},Ht=t=>{const e=Wt(t);var n;return e===at&&((n=t.state).window_size=2*n.w_size,xt(n.head),n.max_lazy_match=jt[n.level].max_lazy,n.good_match=jt[n.level].good_length,n.nice_match=jt[n.level].nice_length,n.max_chain_length=jt[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),e},Kt=(t,e,n,r,i,o)=>{if(!t)return ct;let s=1;if(e===ht&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>9||n!==wt||r<8||r>15||e<0||e>9||o<0||o>gt||8===r&&1!==s)return St(t,ct);8===r&&(r=9);const a=new Yt;return t.state=a,a.strm=t,a.status=kt,a.wrap=s,a.gzhead=null,a.w_bits=r,a.w_size=1<Kt(t,e,wt,15,8,yt),deflateInit2:Kt,deflateReset:Ht,deflateResetKeep:Wt,deflateSetHeader:(t,e)=>Ft(t)||2!==t.state.wrap?ct:(t.state.gzhead=e,at),deflate:(t,e)=>{if(Ft(t)||e>st||e<0)return t?St(t,ct):ct;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===At&&e!==ot)return St(t,0===t.avail_out?lt:ct);const r=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Pt(t),0===t.avail_out)return n.last_flush=-1,at}else if(0===t.avail_in&&It(e)<=It(r)&&e!==ot)return St(t,lt);if(n.status===At&&0!==t.avail_in)return St(t,lt);if(n.status===kt&&0===n.wrap&&(n.status=Mt),n.status===kt){let e=wt+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=pt||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=r<<6,0!==n.strstart&&(e|=32),e+=31-e%31,$t(n,e),0!==n.strstart&&($t(n,t.adler>>>16),$t(n,65535&t.adler)),t.adler=1,n.status=Mt,Pt(t),0!==n.pending)return n.last_flush=-1,at}if(57===n.status)if(t.adler=0,Lt(n,31),Lt(n,139),Lt(n,8),n.gzhead)Lt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Lt(n,255&n.gzhead.time),Lt(n,n.gzhead.time>>8&255),Lt(n,n.gzhead.time>>16&255),Lt(n,n.gzhead.time>>24&255),Lt(n,9===n.level?2:n.strategy>=pt||n.level<2?4:0),Lt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Lt(n,255&n.gzhead.extra.length),Lt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=V(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Lt(n,0),Lt(n,0),Lt(n,0),Lt(n,0),Lt(n,0),Lt(n,9===n.level?2:n.strategy>=pt||n.level<2?4:0),Lt(n,3),n.status=Mt,Pt(t),0!==n.pending)return n.last_flush=-1,at;if(69===n.status){if(n.gzhead.extra){let e=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=V(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=i,Pt(t),0!==n.pending)return n.last_flush=-1,at;e=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>e&&(t.adler=V(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let e,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(t.adler=V(t.adler,n.pending_buf,n.pending-r,r)),Pt(t),0!==n.pending)return n.last_flush=-1,at;r=0}e=n.gzindexr&&(t.adler=V(t.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(t.adler=V(t.adler,n.pending_buf,n.pending-r,r)),Pt(t),0!==n.pending)return n.last_flush=-1,at;r=0}e=n.gzindexr&&(t.adler=V(t.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Pt(t),0!==n.pending))return n.last_flush=-1,at;Lt(n,255&t.adler),Lt(n,t.adler>>8&255),t.adler=0}if(n.status=Mt,Pt(t),0!==n.pending)return n.last_flush=-1,at}if(0!==t.avail_in||0!==n.lookahead||e!==nt&&n.status!==At){let r=0===n.level?Ct(n,e):n.strategy===pt?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Dt(t),0===t.lookahead)){if(e===nt)return 1;break}if(t.match_length=0,n=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Bt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ot?(Bt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bt(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===mt?((t,e)=>{let n,r,i,o;const s=t.window;for(;;){if(t.lookahead<=_t){if(Dt(t),t.lookahead<=_t&&e===nt)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){o=t.strstart+_t;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=tt(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Bt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ot?(Bt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bt(t,!1),0===t.strm.avail_out)?1:2})(n,e):jt[n.level].func(n,e);if(3!==r&&4!==r||(n.status=At),1===r||3===r)return 0===t.avail_out&&(n.last_flush=-1),at;if(2===r&&(e===rt?et(n):e!==st&&(J(n,0,0,!1),e===it&&(xt(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Pt(t),0===t.avail_out))return n.last_flush=-1,at}return e!==ot?at:n.wrap<=0?ut:(2===n.wrap?(Lt(n,255&t.adler),Lt(n,t.adler>>8&255),Lt(n,t.adler>>16&255),Lt(n,t.adler>>24&255),Lt(n,255&t.total_in),Lt(n,t.total_in>>8&255),Lt(n,t.total_in>>16&255),Lt(n,t.total_in>>24&255)):($t(n,t.adler>>>16),$t(n,65535&t.adler)),Pt(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?at:ut)},deflateEnd:t=>{if(Ft(t))return ct;const e=t.state.status;return t.state=null,e===Mt?St(t,dt):at},deflateSetDictionary:(t,e)=>{let n=e.length;if(Ft(t))return ct;const r=t.state,i=r.wrap;if(2===i||1===i&&r.status!==kt||r.lookahead)return ct;if(1===i&&(t.adler=K(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){0===i&&(xt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let t=new Uint8Array(r.w_size);t.set(e.subarray(n-r.w_size,n),0),e=t,n=r.w_size}const o=t.avail_in,s=t.next_in,a=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Dt(r);r.lookahead>=3;){let t=r.strstart,e=r.lookahead-2;do{r.ins_h=Tt(r,r.ins_h,r.window[t+3-1]),r.prev[t&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=t,t++}while(--e);r.strstart=t,r.lookahead=2,Dt(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=s,t.input=a,t.avail_in=o,r.wrap=i,at},deflateInfo:"pako deflate (from Nodeca project)"};const Vt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Gt={assign:function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const e in n)Vt(n,e)&&(t[e]=n[e])}}return t},flattenChunks:t=>{let e=0;for(let n=0,r=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Xt[254]=Xt[254]=1;var Jt={string2buf:t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,r,i,o,s=t.length,a=0;for(i=0;i>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e},buf2string:(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let r,i;const o=new Array(2*n);for(i=0,r=0;r4)o[i++]=65533,r+=s-1;else{for(e&=2===s?31:3===s?15:7;s>1&&r1?o[i++]=65533:e<65536?o[i++]=e:(e-=65536,o[i++]=55296|e>>10&1023,o[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Zt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let r=0;r{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+Xt[t[n]]>e?n:e}},Qt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const te=Object.prototype.toString,{Z_NO_FLUSH:ee,Z_SYNC_FLUSH:ne,Z_FULL_FLUSH:re,Z_FINISH:ie,Z_OK:oe,Z_STREAM_END:se,Z_DEFAULT_COMPRESSION:ae,Z_DEFAULT_STRATEGY:ue,Z_DEFLATED:ce}=Z;function de(t){this.options=Gt.assign({level:ae,method:ce,chunkSize:16384,windowBits:15,memLevel:8,strategy:ue},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;let n=qt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==oe)throw new Error(G[n]);if(e.header&&qt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?Jt.string2buf(e.dictionary):"[object ArrayBuffer]"===te.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=qt.deflateSetDictionary(this.strm,t),n!==oe)throw new Error(G[n]);this._dict_set=!0}}function le(t,e){const n=new de(e);if(n.push(t,!0),n.err)throw n.msg||G[n.err];return n.result}de.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?ie:ee,"string"==typeof t?n.input=Jt.string2buf(t):"[object ArrayBuffer]"===te.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===ne||o===re)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=qt.deflate(n,o),i===se)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===oe;if(0!==n.avail_out){if(o>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},de.prototype.onData=function(t){this.chunks.push(t)},de.prototype.onEnd=function(t){t===oe&&(this.result=Gt.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var he={Deflate:de,deflate:le,deflateRaw:function(t,e){return(e=e||{}).raw=!0,le(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,le(t,e)},constants:Z};const fe=16209;var pe=function(t,e){let n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,v,k,M,A,S;const I=t.state;n=t.next_in,A=t.input,r=n+(t.avail_in-5),i=t.next_out,S=t.output,o=i-(e-t.avail_out),s=i+(t.avail_out-257),a=I.dmax,u=I.wsize,c=I.whave,d=I.wnext,l=I.window,h=I.hold,f=I.bits,p=I.lencode,m=I.distcode,g=(1<>>24,h>>>=w,f-=w,w=b>>>16&255,0===w)S[i++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(h&(1<>>=w,f-=w),f<15&&(h+=A[n++]<>>24,h>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=m[(65535&b)+(h&(1<a){t.msg="invalid distance too far back",I.mode=fe;break t}if(h>>>=w,f-=w,w=i-o,v>w){if(w=v-w,w>c&&I.sane){t.msg="invalid distance too far back",I.mode=fe;break t}if(k=0,M=l,0===d){if(k+=u-w,w<_){_-=w;do{S[i++]=l[k++]}while(--w);k=i-v,M=S}}else if(d2;)S[i++]=M[k++],S[i++]=M[k++],S[i++]=M[k++],_-=3;_&&(S[i++]=M[k++],_>1&&(S[i++]=M[k++]))}else{k=i-v;do{S[i++]=S[k++],S[i++]=S[k++],S[i++]=S[k++],_-=3}while(_>2);_&&(S[i++]=S[k++],_>1&&(S[i++]=S[k++]))}break}}break}}while(n>3,n-=_,f-=_<<3,h&=(1<{const u=a.bits;let c,d,l,h,f,p,m=0,g=0,y=0,b=0,w=0,_=0,v=0,k=0,M=0,A=0,S=null;const I=new Uint16Array(16),x=new Uint16Array(16);let E,T,P,B=null;for(m=0;m<=15;m++)I[m]=0;for(g=0;g=1&&0===I[b];b--);if(w>b&&(w=b),0===b)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(y=1;y0&&(0===t||1!==b))return-1;for(x[1]=0,m=1;m<15;m++)x[m+1]=x[m]+I[m];for(g=0;g852||2===t&&M>592)return 1;for(;;){E=m-v,s[g]+1=p?(T=B[s[g]-p],P=S[s[g]-p]):(T=96,P=0),c=1<>v)+d]=E<<24|T<<16|P|0}while(0!==d);for(c=1<>=1;if(0!==c?(A&=c-1,A+=c):A=0,g++,0==--I[m]){if(m===b)break;m=e[n+s[g]]}if(m>w&&(A&h)!==l){for(0===v&&(v=w),f+=y,_=m-v,k=1<<_;_+v852||2===t&&M>592)return 1;l=A&h,i[l]=w<<24|_<<16|f-o|0}}return 0!==A&&(i[f+A]=m-v<<24|64<<16|0),a.bits=w,0};const{Z_FINISH:_e,Z_BLOCK:ve,Z_TREES:ke,Z_OK:Me,Z_STREAM_END:Ae,Z_NEED_DICT:Se,Z_STREAM_ERROR:Ie,Z_DATA_ERROR:xe,Z_MEM_ERROR:Ee,Z_BUF_ERROR:Te,Z_DEFLATED:Pe}=Z,Be=16180,Le=16190,$e=16191,Re=16192,Oe=16194,De=16199,Ce=16200,Ne=16206,ze=16209,Ue=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function je(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ye=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},Fe=t=>{if(Ye(t))return Ie;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Be,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Me},We=t=>{if(Ye(t))return Ie;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Fe(t)},He=(t,e)=>{let n;if(Ye(t))return Ie;const r=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Ie:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,We(t))},Ke=(t,e)=>{if(!t)return Ie;const n=new je;t.state=n,n.strm=t,n.window=null,n.mode=Be;const r=He(t,e);return r!==Me&&(t.state=null),r};let qe,Ve,Ge=!0;const Ze=t=>{if(Ge){qe=new Int32Array(512),Ve=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(we(1,t.lens,0,288,qe,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;we(2,t.lens,0,32,Ve,0,t.work,{bits:5}),Ge=!1}t.lencode=qe,t.lenbits=9,t.distcode=Ve,t.distbits=5},Xe=(t,e,n,r)=>{let i;const o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(e.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(e.subarray(n-r,n-r+i),o.wnext),(r-=i)?(o.window.set(e.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whaveKe(t,15),inflateInit2:Ke,inflate:(t,e)=>{let n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,v,k,M,A=0;const S=new Uint8Array(4);let I,x;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ye(t)||!t.output||!t.input&&0!==t.avail_in)return Ie;n=t.state,n.mode===$e&&(n.mode=Re),s=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,r=t.input,a=t.avail_in,c=n.hold,d=n.bits,l=a,h=u,M=Me;t:for(;;)switch(n.mode){case Be:if(0===n.wrap){n.mode=Re;break}for(;d<16;){if(0===a)break t;a--,c+=r[o++]<>>8&255,n.check=V(n.check,S,2,0),c=0,d=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=ze;break}if((15&c)!==Pe){t.msg="unknown compression method",n.mode=ze;break}if(c>>>=4,d-=4,k=8+(15&c),0===n.wbits&&(n.wbits=k),k>15||k>n.wbits){t.msg="invalid window size",n.mode=ze;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=V(n.check,S,2,0)),c=0,d=0,n.mode=16182;case 16182:for(;d<32;){if(0===a)break t;a--,c+=r[o++]<>>8&255,S[2]=c>>>16&255,S[3]=c>>>24&255,n.check=V(n.check,S,4,0)),c=0,d=0,n.mode=16183;case 16183:for(;d<16;){if(0===a)break t;a--,c+=r[o++]<>8),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=V(n.check,S,2,0)),c=0,d=0,n.mode=16184;case 16184:if(1024&n.flags){for(;d<16;){if(0===a)break t;a--,c+=r[o++]<>>8&255,n.check=V(n.check,S,2,0)),c=0,d=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(f=n.length,f>a&&(f=a),f&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+f),k)),512&n.flags&&4&n.wrap&&(n.check=V(n.check,r,f,o)),a-=f,o+=f,n.length-=f),n.length))break t;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===a)break t;f=0;do{k=r[o+f++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k))}while(k&&f>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=$e;break;case 16189:for(;d<32;){if(0===a)break t;a--,c+=r[o++]<>>=7&d,d-=7&d,n.mode=Ne;break}for(;d<3;){if(0===a)break t;a--,c+=r[o++]<>>=1,d-=1,3&c){case 0:n.mode=16193;break;case 1:if(Ze(n),n.mode=De,e===ke){c>>>=2,d-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=ze}c>>>=2,d-=2;break;case 16193:for(c>>>=7&d,d-=7&d;d<32;){if(0===a)break t;a--,c+=r[o++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=ze;break}if(n.length=65535&c,c=0,d=0,n.mode=Oe,e===ke)break t;case Oe:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>u&&(f=u),0===f)break t;i.set(r.subarray(o,o+f),s),a-=f,o+=f,u-=f,s+=f,n.length-=f;break}n.mode=$e;break;case 16196:for(;d<14;){if(0===a)break t;a--,c+=r[o++]<>>=5,d-=5,n.ndist=1+(31&c),c>>>=5,d-=5,n.ncode=4+(15&c),c>>>=4,d-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=ze;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,d-=3}for(;n.have<19;)n.lens[E[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,I={bits:n.lenbits},M=we(0,n.lens,0,19,n.lencode,0,n.work,I),n.lenbits=I.bits,M){t.msg="invalid code lengths set",n.mode=ze;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,y=A>>>16&255,b=65535&A,!(g<=d);){if(0===a)break t;a--,c+=r[o++]<>>=g,d-=g,n.lens[n.have++]=b;else{if(16===b){for(x=g+2;d>>=g,d-=g,0===n.have){t.msg="invalid bit length repeat",n.mode=ze;break}k=n.lens[n.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===b){for(x=g+3;d>>=g,d-=g,k=0,f=3+(7&c),c>>>=3,d-=3}else{for(x=g+7;d>>=g,d-=g,k=0,f=11+(127&c),c>>>=7,d-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=ze;break}for(;f--;)n.lens[n.have++]=k}}if(n.mode===ze)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=ze;break}if(n.lenbits=9,I={bits:n.lenbits},M=we(1,n.lens,0,n.nlen,n.lencode,0,n.work,I),n.lenbits=I.bits,M){t.msg="invalid literal/lengths set",n.mode=ze;break}if(n.distbits=6,n.distcode=n.distdyn,I={bits:n.distbits},M=we(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,I),n.distbits=I.bits,M){t.msg="invalid distances set",n.mode=ze;break}if(n.mode=De,e===ke)break t;case De:n.mode=Ce;case Ce:if(a>=6&&u>=258){t.next_out=s,t.avail_out=u,t.next_in=o,t.avail_in=a,n.hold=c,n.bits=d,pe(t,h),s=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,r=t.input,a=t.avail_in,c=n.hold,d=n.bits,n.mode===$e&&(n.back=-1);break}for(n.back=0;A=n.lencode[c&(1<>>24,y=A>>>16&255,b=65535&A,!(g<=d);){if(0===a)break t;a--,c+=r[o++]<>w)],g=A>>>24,y=A>>>16&255,b=65535&A,!(w+g<=d);){if(0===a)break t;a--,c+=r[o++]<>>=w,d-=w,n.back+=w}if(c>>>=g,d-=g,n.back+=g,n.length=b,0===y){n.mode=16205;break}if(32&y){n.back=-1,n.mode=$e;break}if(64&y){t.msg="invalid literal/length code",n.mode=ze;break}n.extra=15&y,n.mode=16201;case 16201:if(n.extra){for(x=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;A=n.distcode[c&(1<>>24,y=A>>>16&255,b=65535&A,!(g<=d);){if(0===a)break t;a--,c+=r[o++]<>w)],g=A>>>24,y=A>>>16&255,b=65535&A,!(w+g<=d);){if(0===a)break t;a--,c+=r[o++]<>>=w,d-=w,n.back+=w}if(c>>>=g,d-=g,n.back+=g,64&y){t.msg="invalid distance code",n.mode=ze;break}n.offset=b,n.extra=15&y,n.mode=16203;case 16203:if(n.extra){for(x=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=ze;break}n.mode=16204;case 16204:if(0===u)break t;if(f=h-u,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=ze;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),m=n.window}else m=i,p=s-n.offset,f=n.length;f>u&&(f=u),u-=f,n.length-=f;do{i[s++]=m[p++]}while(--f);0===n.length&&(n.mode=Ce);break;case 16205:if(0===u)break t;i[s++]=n.length,u--,n.mode=Ce;break;case Ne:if(n.wrap){for(;d<32;){if(0===a)break t;a--,c|=r[o++]<{if(Ye(t))return Ie;let e=t.state;return e.window&&(e.window=null),t.state=null,Me},inflateGetHeader:(t,e)=>{if(Ye(t))return Ie;const n=t.state;return 0==(2&n.wrap)?Ie:(n.head=e,e.done=!1,Me)},inflateSetDictionary:(t,e)=>{const n=e.length;let r,i,o;return Ye(t)?Ie:(r=t.state,0!==r.wrap&&r.mode!==Le?Ie:r.mode===Le&&(i=1,i=K(i,e,n,0),i!==r.check)?xe:(o=Xe(t,e,n,n),o?(r.mode=16210,Ee):(r.havedict=1,Me)))},inflateInfo:"pako inflate (from Nodeca project)"},Qe=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const tn=Object.prototype.toString,{Z_NO_FLUSH:en,Z_FINISH:nn,Z_OK:rn,Z_STREAM_END:on,Z_NEED_DICT:sn,Z_STREAM_ERROR:an,Z_DATA_ERROR:un,Z_MEM_ERROR:cn}=Z;function dn(t){this.options=Gt.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;let n=Je.inflateInit2(this.strm,e.windowBits);if(n!==rn)throw new Error(G[n]);if(this.header=new Qe,Je.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Jt.string2buf(e.dictionary):"[object ArrayBuffer]"===tn.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=Je.inflateSetDictionary(this.strm,e.dictionary),n!==rn)))throw new Error(G[n])}function ln(t,e){const n=new dn(e);if(n.push(t),n.err)throw n.msg||G[n.err];return n.result}dn.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=e===~~e?e:!0===e?nn:en,"[object ArrayBuffer]"===tn.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=Je.inflate(n,s),o===sn&&i&&(o=Je.inflateSetDictionary(n,i),o===rn?o=Je.inflate(n,s):o===un&&(o=sn));n.avail_in>0&&o===on&&n.state.wrap>0&&0!==t[n.next_in];)Je.inflateReset(n),o=Je.inflate(n,s);switch(o){case an:case un:case sn:case cn:return this.onEnd(o),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||o===on))if("string"===this.options.to){let t=Jt.utf8border(n.output,n.next_out),e=n.next_out-t,i=Jt.buf2string(n.output,t);n.next_out=e,n.avail_out=r-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(o!==rn||0!==a){if(o===on)return o=Je.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},dn.prototype.onData=function(t){this.chunks.push(t)},dn.prototype.onEnd=function(t){t===rn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Gt.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var hn={Inflate:dn,inflate:ln,inflateRaw:function(t,e){return(e=e||{}).raw=!0,ln(t,e)},ungzip:ln,constants:Z};const{Deflate:fn,deflate:pn,deflateRaw:mn,gzip:gn}=he,{Inflate:yn,inflate:bn,inflateRaw:wn,ungzip:_n}=hn;var vn=bn,kn=n(26729),Mn=n.n(kn),An=n(48764).Buffer;const Sn=t=>"version"in t;var In=Object.freeze({__proto__:null,encode:function(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"0x")},decode:function(t){0===t.indexOf("0x")&&(t=t.substr(2)),t.length%2==1&&(t="0"+t);let e=t.match(/.{2}/g);return null===e?r.Buffer.from([]):r.Buffer.from(e.map((t=>parseInt(t,16))))}});function xn(t){return new TextDecoder("utf-8").decode(t)}function En(t){return(new TextEncoder).encode(t)}var Tn=Object.freeze({__proto__:null,decode:xn,encode:En});function Pn(t){return u().encode(t)}var Bn=Object.freeze({__proto__:null,encode:Pn,decode:function(t){return u().decode(t)}});function Ln(t){return t.toString("base64")}function $n(t){return r.Buffer.from(t,"base64")}var Rn=Object.freeze({__proto__:null,encode:Ln,decode:$n}),On=Object.freeze({__proto__:null,hex:In,utf8:Tn,bs58:Bn,base64:Rn});function Dn(t){const e=new Map;return t.errors&&t.errors.forEach((t=>{var n;let r=null!==(n=t.msg)&&void 0!==n?n:t.name;e.set(t.code,r)})),e}function Cn(t,...e){if(t.args.length!=e.length)throw new Error("Invalid argument length");const n={};let r=0;return t.args.forEach((t=>{n[t.name]=e[r],r+=1})),n}function Nn(t,e={}){t.forEach((t=>{if("accounts"in t)Nn(t.accounts,e[t.name]);else if(void 0===e[t.name])throw new Error(`Invalid arguments: ${t.name} not provided.`)}))}function zn(t){return t instanceof i.PublicKey?t:new i.PublicKey(t)}class Un extends TypeError{constructor(t,e){let n;const{message:r,...i}=t,{path:o}=t;super(0===o.length?r:"At path: "+o.join(".")+" -- "+r),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[t,...e()]}}}function jn(t){return"object"==typeof t&&null!=t}function Yn(t){return"string"==typeof t?JSON.stringify(t):""+t}function Fn(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:o}=e,{type:s}=n,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+Yn(r)+"`"}=t;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:u}}function*Wn(t,e,n,r){var i;jn(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]);for(const i of t){const t=Fn(i,e,n,r);t&&(yield t)}}function*Hn(t,e,n){void 0===n&&(n={});const{path:r=[],branch:i=[t],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(t=e.coercer(t,a),s&&"type"!==e.type&&jn(e.schema)&&jn(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let u=!0;for(const n of e.validator(t,a))u=!1,yield[n,void 0];for(let[n,c,d]of e.entries(t,a)){const e=Hn(c,d,{path:void 0===n?r:[...r,n],branch:void 0===n?i:[...i,c],coerce:o,mask:s});for(const r of e)r[0]?(u=!1,yield[r[0],void 0]):o&&(c=r[1],void 0===n?t=c:t instanceof Map?t.set(n,c):t instanceof Set?t.add(c):jn(t)&&(t[n]=c))}if(u)for(const n of e.refiner(t,a))u=!1,yield[n,void 0];u&&(yield[void 0,t])}class Kn{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:n,validator:r,refiner:i,coercer:o=(t=>t),entries:s=function*(){}}=t;this.type=e,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(t,e)=>Wn(r(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>Wn(i(t,e),e,this,t):()=>[]}assert(t){return function(t,e){const n=Gn(t,e);if(n[0])throw n[0]}(t,this)}create(t){return qn(t,this)}is(t){return Vn(t,this)}mask(t){return function(t,e){const n=Gn(t,e,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(t,this)}validate(t,e){return void 0===e&&(e={}),Gn(t,this,e)}}function qn(t,e){const n=Gn(t,e,{coerce:!0});if(n[0])throw n[0];return n[1]}function Vn(t,e){return!Gn(t,e)[0]}function Gn(t,e,n){void 0===n&&(n={});const r=Hn(t,e,n),i=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(r);return i[0]?[new Un(i[0],(function*(){for(const t of r)t[0]&&(yield t[0])})),void 0]:[void 0,i[1]]}function Zn(t,e){return new Kn({type:t,schema:null,validator:e})}function Xn(t){return new Kn({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+Yn(t)})}function Jn(t){const e=Yn(t),n=typeof t;return new Kn({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||"Expected the literal `"+e+"`, but received: "+Yn(n)})}function Qn(t){return new Kn({...t,validator:(e,n)=>null===e||t.validator(e,n),refiner:(e,n)=>null===e||t.refiner(e,n)})}function tr(){return Zn("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+Yn(t)))}function er(t){return new Kn({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function nr(){return Zn("string",(t=>"string"==typeof t||"Expected a string, but received: "+Yn(t)))}function rr(t){const e=Object.keys(t);return new Kn({type:"type",schema:t,*entries(n){if(jn(n))for(const r of e)yield[r,n[r],t[r]]},validator:t=>jn(t)||"Expected an object, but received: "+Yn(t)})}function ir(t){const e=t.map((t=>t.type)).join(" | ");return new Kn({type:"union",schema:null,coercer:(e,n)=>(t.find((t=>{const[n]=t.validate(e,{coerce:!0});return!n}))||or()).coercer(e,n),validator(n,r){const i=[];for(const e of t){const[...t]=Hn(n,e,r),[o]=t;if(!o[0])return[];for(const[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+Yn(n),...i]}})}function or(){return Zn("unknown",(()=>!0))}async function sr(t,e,n){if(e.length<=99)return await ar(t,e,n);{const r=function(t,e){return Array.apply(0,new Array(Math.ceil(t.length/99))).map(((e,n)=>t.slice(99*n,99*(n+1))))}(e);return(await Promise.all(r.map((e=>ar(t,e,n))))).flat()}}async function ar(t,e,n){const r=null!=n?n:t.commitment,{value:i,context:o}=await t.getMultipleAccountsInfoAndContext(e,r);return i.map(((t,n)=>null===t?null:{publicKey:e[n],account:t,context:o}))}async function ur(t,e,n,r,o){var s;n&&n.length>0&&e.sign(...n);const a=e._compile(),u=a.serialize(),c=e._serialize(u).toString("base64"),d={encoding:"base64",commitment:null!=r?r:t.commitment};if(o){const t=(Array.isArray(o)?o:a.nonProgramIds()).map((t=>t.toBase58()));d.accounts={encoding:"base64",addresses:t}}n&&(d.sigVerify=!0);const l=[c,d],h=qn(await t._rpcRequest("simulateTransaction",l),lr);if("error"in h){let t;if("data"in h.error&&(t=null===(s=h.error.data)||void 0===s?void 0:s.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(h.error.message,n)}throw new i.SendTransactionError("failed to simulate transaction: "+h.error.message,t)}return h.result}const cr=dr(or());function dr(t){return ir([rr({jsonrpc:Jn("2.0"),id:nr(),result:t}),rr({jsonrpc:Jn("2.0"),id:nr(),error:rr({code:or(),message:nr(),data:er(Zn("any",(()=>!0)))})})])}const lr=(fr=rr({err:Qn(ir([rr({}),nr()])),logs:Qn(Xn(nr())),accounts:er(Qn(Xn(Qn(rr({executable:Zn("boolean",(t=>"boolean"==typeof t)),owner:nr(),lamports:tr(),data:Xn(nr()),rentEpoch:er(tr())}))))),unitsConsumed:er(tr())}),function(t,e,n){return new Kn({...t,coercer:(n,r)=>Vn(n,e)?t.coercer((t=>"error"in t?t:{...t,result:qn(t.result,hr)})(n),r):t.coercer(n,r)})}(dr(hr=rr({context:rr({slot:tr()}),value:fr})),cr));var hr,fr,pr=Object.freeze({__proto__:null,invoke:async function(t,e,n,r){t=zn(t),r||(r=_r());const o=new i.Transaction;if(o.add(new i.TransactionInstruction({programId:t,keys:null!=e?e:[],data:n})),void 0===r.sendAndConfirm)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await r.sendAndConfirm(o,[])},getMultipleAccounts:async function(t,e,n){return(await sr(t,e,n)).map((t=>t?{publicKey:t.publicKey,account:t.account}:null))},getMultipleAccountsAndContext:sr,simulateTransaction:ur});class mr{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=null==e?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var r,o,s,a;if(void 0===n&&(n=this.opts),Sn(t))e&&t.sign(e);else if(t.feePayer=null!==(r=t.feePayer)&&void 0!==r?r:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const n of e)t.partialSign(n);const u=(t=await this.wallet.signTransaction(t)).serialize();try{return await yr(this.connection,u,n)}catch(e){if(e instanceof br){const n=Pn(Sn(t)?(null===(o=t.signatures)||void 0===o?void 0:o[0])||new Uint8Array:null!==(s=t.signature)&&void 0!==s?s:new Uint8Array),r=await this.connection.getTransaction(n,{commitment:"confirmed"});if(r){const t=null===(a=r.meta)||void 0===a?void 0:a.logMessages;throw t?new i.SendTransactionError(e.message,t):e}throw e}throw e}}async sendAll(t,e){var n,r,o;void 0===e&&(e=this.opts);const s=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let a=t.map((t=>{var e,n;if(Sn(t.tx)){let e=t.tx;return t.signers&&e.sign(t.signers),e}{let r=t.tx,i=null!==(e=t.signers)&&void 0!==e?e:[];return r.feePayer=null!==(n=r.feePayer)&&void 0!==n?n:this.wallet.publicKey,r.recentBlockhash=s,i.forEach((t=>{r.partialSign(t)})),r}}));const u=await this.wallet.signAllTransactions(a),c=[];for(let t=0;tt.startsWith("Program log: AnchorError")));if(-1===e)return null;const n=t[e],r=[n];let o;if(e+11)return null;r=t[0].match(/([0-9]+)/g)[0]}try{i=parseInt(r)}catch(t){return null}let o=e.get(i);return void 0!==o?new Tr(i,o,t.logs):(o=Lr.get(i),void 0!==o?new Tr(i,o,t.logs):null)}get program(){var t;return null===(t=this._programErrorStack)||void 0===t?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return null===(t=this._programErrorStack)||void 0===t?void 0:t.stack}toString(){return this.msg}}function Pr(t,e){Ar("debug-logs")&&console.log("Translating error:",t);const n=Er.parse(t.logs);if(n)return n;const r=Tr.parse(t,e);if(r)return r;if(t.logs){const e={get:function(e,n){return"programErrorStack"===n?e.programErrorStack.stack:"program"===n?e.programErrorStack.stack[t.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return t.programErrorStack=xr.parse(t.logs),new Proxy(t,e)}return t}const Br={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},Lr=new Map([[Br.InstructionMissing,"8 byte instruction identifier not provided"],[Br.InstructionFallbackNotFound,"Fallback functions are not supported"],[Br.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[Br.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[Br.IdlInstructionStub,"The program was compiled without idl instructions"],[Br.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[Br.ConstraintMut,"A mut constraint was violated"],[Br.ConstraintHasOne,"A has one constraint was violated"],[Br.ConstraintSigner,"A signer constraint was violated"],[Br.ConstraintRaw,"A raw constraint was violated"],[Br.ConstraintOwner,"An owner constraint was violated"],[Br.ConstraintRentExempt,"A rent exemption constraint was violated"],[Br.ConstraintSeeds,"A seeds constraint was violated"],[Br.ConstraintExecutable,"An executable constraint was violated"],[Br.ConstraintState,"Deprecated Error, feel free to replace with something else"],[Br.ConstraintAssociated,"An associated constraint was violated"],[Br.ConstraintAssociatedInit,"An associated init constraint was violated"],[Br.ConstraintClose,"A close constraint was violated"],[Br.ConstraintAddress,"An address constraint was violated"],[Br.ConstraintZero,"Expected zero account discriminant"],[Br.ConstraintTokenMint,"A token mint constraint was violated"],[Br.ConstraintTokenOwner,"A token owner constraint was violated"],[Br.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[Br.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[Br.ConstraintMintDecimals,"A mint decimals constraint was violated"],[Br.ConstraintSpace,"A space constraint was violated"],[Br.ConstraintAccountIsNone,"A required account for the constraint is None"],[Br.RequireViolated,"A require expression was violated"],[Br.RequireEqViolated,"A require_eq expression was violated"],[Br.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[Br.RequireNeqViolated,"A require_neq expression was violated"],[Br.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[Br.RequireGtViolated,"A require_gt expression was violated"],[Br.RequireGteViolated,"A require_gte expression was violated"],[Br.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[Br.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[Br.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[Br.AccountDidNotDeserialize,"Failed to deserialize the account"],[Br.AccountDidNotSerialize,"Failed to serialize the account"],[Br.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[Br.AccountNotMutable,"The given account is not mutable"],[Br.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[Br.InvalidProgramId,"Program ID was not as expected"],[Br.InvalidProgramExecutable,"Program account is not executable"],[Br.AccountNotSigner,"The given account did not sign"],[Br.AccountNotSystemOwned,"The given account is not owned by the system program"],[Br.AccountNotInitialized,"The program expected this account to be already initialized"],[Br.AccountNotProgramData,"The given account is not a program data account"],[Br.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[Br.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[Br.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[Br.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[Br.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[Br.Deprecated,"The API being used is deprecated and should no longer be used"]]);var $r=function(){return $r=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.name===r));if(1!==i.length)throw new Ir(`Type not found: ${JSON.stringify(t)}`);return zr.typeDefLayout(i[0],e,n)}if("array"in t.type){let r=t.type.array[0],i=t.type.array[1],o=zr.fieldLayout({name:void 0,type:r},e);return l.array(o,i,n)}throw new Error(`Not yet implemented: ${t}`)}}static typeDefLayout(t,e=[],n){switch(t.type.kind){case"struct":{const r=t.type.fields.map((t=>zr.fieldLayout(t,e)));return l.struct(r,n)}case"enum":{let r=t.type.variants.map((t=>{const n=d()(t.name);if(!t.fields)return l.struct([],n);const r=t.fields.map(((t,n)=>(null==t?void 0:t.name)?zr.fieldLayout(t,e):zr.fieldLayout({type:t,name:n.toString()},e)));return l.struct(r,n)}));return void 0!==n?l.rustEnum(r).replicate(n):l.rustEnum(r,n)}case"alias":return zr.fieldLayout({type:t.type.value,name:t.name},e)}}}const Ur="global";class jr{constructor(t){this.idl=t,this.ixLayout=jr.parseIxLayout(t);const e=new Map;t.instructions.forEach((t=>{const n=Fr(Ur,t.name);e.set(u().encode(n),{layout:this.ixLayout.get(t.name),name:t.name})})),this.sighashLayouts=e}encode(t,e){return this._encode(Ur,t,e)}_encode(t,e,n){const i=r.Buffer.alloc(1e3),o=d()(e),s=this.ixLayout.get(o);if(!s)throw new Error(`Unknown method: ${o}`);const a=s.encode(n,i),u=i.slice(0,a);return r.Buffer.concat([Fr(t,e),u])}static parseIxLayout(t){const e=t.instructions.map((e=>{let n=e.args.map((e=>{var n,r;return zr.fieldLayout(e,Array.from([...null!==(n=t.accounts)&&void 0!==n?n:[],...null!==(r=t.types)&&void 0!==r?r:[]]))}));const r=d()(e.name);return[r,l.struct(n,r)]}));return new Map(e)}decode(t,e="hex"){"string"==typeof t&&(t="hex"===e?r.Buffer.from(t,"hex"):u().decode(t));let n=u().encode(t.slice(0,8)),i=t.slice(8);const o=this.sighashLayouts.get(n);return o?{data:o.layout.decode(i),name:o.name}:null}format(t,e){return Yr.format(t,e,this.idl)}}class Yr{static format(t,e,n){const r=n.instructions.filter((e=>t.name===e.name))[0];if(void 0===r)return console.error("Invalid instruction given"),null;const i=r.args.map((e=>({name:e.name,type:Yr.formatIdlType(e.type),data:Yr.formatIdlData(e,t.data[e.name],n.types)}))),o=Yr.flattenIdlAccounts(r.accounts);return{args:i,accounts:e.map(((t,e)=>e`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if("string"==typeof t.type)return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map((e=>this.formatIdlData({name:"",type:t.type.vec},e))).join(", ")+"]";if(t.type.hasOwnProperty("option"))return null===e?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(void 0===n)throw new Error("User defined types not provided");const r=n.filter((e=>e.name===t.type.defined));if(1!==r.length)throw new Error(`Type not found: ${t.type.defined}`);return Yr.formatIdlDataDefined(r[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){switch(t.type.kind){case"struct":{const r=t.type;return"{ "+Object.keys(e).map((t=>{const i=r.fields.find((e=>e.name===t));if(!i)throw new Error("Unable to find type");return t+": "+Yr.formatIdlData(i,e[t],n)})).join(", ")+" }"}case"enum":if(0===t.type.variants.length)return"{}";if(t.type.variants[0].name){const r=t.type.variants,i=Object.keys(e)[0],o=e[i],s=Object.keys(o).map((t=>{var e;const s=o[t],a=null===(e=r[i])||void 0===e?void 0:e.find((e=>e.name===t));if(!a)throw new Error("Unable to find variant");return t+": "+Yr.formatIdlData(a,s,n)})).join(", "),a=d()(i,{pascalCase:!0});return 0===s.length?a:`${a} { ${s} }`}return"Tuple formatting not yet implemented";case"alias":return Yr.formatIdlType(t.type.value)}}static flattenIdlAccounts(t,e){return t.map((t=>{const n=function(t){const e=t.replace(/([A-Z])/g," $1");return e.charAt(0).toUpperCase()+e.slice(1)}(t.name);if(t.hasOwnProperty("accounts")){const r=e?`${e} > ${n}`:n;return Yr.flattenIdlAccounts(t.accounts,r)}return{...t,name:e?`${e} > ${n}`:n}})).flat()}}function Fr(t,e){var n;let i=`${t}:${void 0===n&&(n={}),function(t,e){return void 0===e&&(e={}),function(t,e){void 0===e&&(e={});for(var n=e.splitRegexp,r=void 0===n?Dr:n,i=e.stripRegexp,o=void 0===i?Cr:i,s=e.transform,a=void 0===s?Or:s,u=e.delimiter,c=void 0===u?" ":u,d=Nr(Nr(t,r,"$1\0$2"),o,"\0"),l=0,h=d.length;"\0"===d.charAt(l);)l++;for(;"\0"===d.charAt(h-1);)h--;return d.slice(l,h).split("\0").map(a).join(c)}(t,Rr({delimiter:"."},e))}(e,$r({delimiter:"_"},n))}`;return r.Buffer.from((0,h.J)(i).slice(0,8))}function Wr(t,e){switch(e.type.kind){case"struct":return e.type.fields.map((e=>Hr(t,e.type))).reduce(((t,e)=>t+e),0);case"enum":{const n=e.type.variants.map((e=>e.fields?e.fields.map((e=>Hr(t,"object"==typeof e&&"name"in e?e.type:e))).reduce(((t,e)=>t+e),0):0));return Math.max(...n)+1}case"alias":return Hr(t,e.type.value)}}function Hr(t,e){var n,r;switch(e){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"publicKey":return 32;default:if("vec"in e)return 1;if("option"in e)return 1+Hr(t,e.option);if("coption"in e)return 4+Hr(t,e.coption);if("defined"in e){const i=null!==(r=null===(n=t.types)||void 0===n?void 0:n.filter((t=>t.name===e.defined)))&&void 0!==r?r:[];if(1!==i.length)throw new Ir(`Type not found: ${JSON.stringify(e)}`);return Wr(t,i[0])}if("array"in e){let n=e.array[0],r=e.array[1];return Hr(t,n)*r}throw new Error(`Invalid type ${JSON.stringify(e)}`)}}const Kr=8;function qr(t){return An.from((0,h.J)(t).slice(0,Kr))}class Vr{constructor(t){if(void 0===t.accounts)return void(this.accountLayouts=new Map);const e=t.accounts.map((e=>[e.name,zr.typeDefLayout(e,t.types)]));this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=r.Buffer.alloc(1e3),i=this.accountLayouts.get(t);if(!i)throw new Error(`Unknown account: ${t}`);const o=i.encode(e,n);let s=n.slice(0,o),a=Vr.accountDiscriminator(t);return r.Buffer.concat([a,s])}decode(t,e){if(Vr.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find((t=>Vr.accountDiscriminator(t).equals(e)));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(Kr),r=this.accountLayouts.get(t);if(!r)throw new Error(`Unknown account: ${t}`);return r.decode(n)}memcmp(t,e){const n=Vr.accountDiscriminator(t);return{offset:0,bytes:u().encode(e?r.Buffer.concat([n,e]):n)}}size(t){var e;return Kr+(null!==(e=Wr(this.idl,t))&&void 0!==e?e:0)}static accountDiscriminator(t){return qr(`account:${d()(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`)}}class Gr{constructor(t){if(void 0===t.events)return void(this.layouts=new Map);const e=t.events.map((e=>{let n={name:e.name,type:{kind:"struct",fields:e.fields.map((t=>({name:t.name,type:t.type})))}};return[e.name,zr.typeDefLayout(n,t.types)]}));this.layouts=new Map(e),this.discriminators=new Map(void 0===t.events?[]:t.events.map((t=>[Ln(Zr(t.name)),t.name])))}decode(t){let e;try{e=$n(t)}catch(t){return null}const n=Ln(e.slice(0,8)),r=this.discriminators.get(n);if(void 0===r)return null;const i=this.layouts.get(r);if(!i)throw new Error(`Unknown event: ${r}`);return{data:i.decode(e.slice(8)),name:r}}}function Zr(t){return qr(`event:${t}`)}class Xr{constructor(t){if(void 0===t.types)return void(this.typeLayouts=new Map);const e=t.types.map((e=>[e.name,zr.typeDefLayout(e,t.types)]));this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=r.Buffer.alloc(1e3),i=this.typeLayouts.get(t);if(!i)throw new Error(`Unknown type: ${t}`);const o=i.encode(e,n);return n.slice(0,o)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class Jr{constructor(t){this.instruction=new jr(t),this.accounts=new Vr(t),this.events=new Gr(t),this.types=new Xr(t)}}var Qr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function ti(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}class ei{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var ni=ei;class ri extends ei{isCount(){throw new Error("ExternalLayout is abstract")}}class ii extends ri{constructor(t,e,n){if(!(t instanceof ei))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof oi||this.layout instanceof si}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class oi extends ei{constructor(t,e){if(super(t,e),6t&&e instanceof ei),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class hi{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class fi extends hi{constructor(t,e){if(!(t instanceof ri&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class pi extends ei{constructor(t,e,n){const r=t instanceof oi||t instanceof si;if(r)t=new fi(new ii(t));else if(t instanceof ri&&t.isCount())t=new fi(t);else if(!(t instanceof hi))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof ei))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new mi(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return An.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class mi extends ei{constructor(t,e,n,r){if(!(t instanceof pi))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof ei))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class gi extends ei{constructor(t,e){if(!(t instanceof ri&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof ri||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof ri&&(r=t.length),!An.isBuffer(t)||r!==t.length)throw new TypeError((i="Blob.encode",(this.property?i+"["+this.property+"]":i)+" requires (length "+r+") Buffer as src"));var i;if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof ri&&this.length.encode(r,e,n),r}}var yi=(t,e,n)=>new ii(t,e,n),bi=t=>new oi(4,t),wi=t=>new di(t),_i=(t,e,n)=>new li(t,e,n),vi=(t,e,n)=>new pi(t,e,n),ki=(t,e)=>new gi(t,e);class Mi{constructor(t){}encode(t,e){switch(d()(t)){case"createAccount":return function({lamports:t,space:e,owner:n}){return Ei({createAccount:{lamports:t,space:e,owner:n.toBuffer()}})}(e);case"assign":return function({owner:t}){return Ei({assign:{owner:t.toBuffer()}})}(e);case"transfer":return function({lamports:t}){return Ei({transfer:{lamports:t}})}(e);case"createAccountWithSeed":return function({base:t,seed:e,lamports:n,space:r,owner:i}){return Ei({createAccountWithSeed:{base:t.toBuffer(),seed:e,lamports:n,space:r,owner:i.toBuffer()}},xi.getVariant(3).span+e.length)}(e);case"advanceNonceAccount":return function({authorized:t}){return Ei({advanceNonceAccount:{authorized:t.toBuffer()}})}(e);case"withdrawNonceAccount":return function({lamports:t}){return Ei({withdrawNonceAccount:{lamports:t}})}(e);case"initializeNonceAccount":return function({authorized:t}){return Ei({initializeNonceAccount:{authorized:t.toBuffer()}})}(e);case"authorizeNonceAccount":return function({authorized:t}){return Ei({authorizeNonceAccount:{authorized:t.toBuffer()}})}(e);case"allocate":return function({space:t}){return Ei({allocate:{space:t}})}(e);case"allocateWithSeed":return function({base:t,seed:e,space:n,owner:r}){return Ei({allocateWithSeed:{base:t.toBuffer(),seed:e,space:n,owner:r.toBuffer()}},xi.getVariant(9).span+e.length)}(e);case"assignWithSeed":return function({base:t,seed:e,owner:n}){return Ei({assignWithSeed:{base:t.toBuffer(),seed:e,owner:n.toBuffer()}},xi.getVariant(10).span+e.length)}(e);case"transferWithSeed":return function({lamports:t,seed:e,owner:n}){return Ei({transferWithSeed:{lamports:t,seed:e,owner:n.toBuffer()}},xi.getVariant(11).span+e.length)}(e);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,e){throw new Error("System does not have state")}}class Ai extends ni{constructor(t){super(-1,t),this.property=t,this.layout=_i([bi("length"),bi("lengthPadding"),ki(yi(bi(),-8),"chars")],this.property)}encode(t,e,n=0){if(null==t)return this.layout.span;const r={chars:An.from(t,"utf8")};return this.layout.encode(r,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return bi().span+bi().span+new(s())(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function Si(t){return new Ai(t)}function Ii(t){return ki(32,t)}const xi=vi(bi("instruction"));function Ei(t,e){const n=An.alloc(null!=e?e:Ti),r=xi.encode(t,n);return void 0===e?n.slice(0,r):n}xi.addVariant(0,_i([wi("lamports"),wi("space"),Ii("owner")]),"createAccount"),xi.addVariant(1,_i([Ii("owner")]),"assign"),xi.addVariant(2,_i([wi("lamports")]),"transfer"),xi.addVariant(3,_i([Ii("base"),Si("seed"),wi("lamports"),wi("space"),Ii("owner")]),"createAccountWithSeed"),xi.addVariant(4,_i([Ii("authorized")]),"advanceNonceAccount"),xi.addVariant(5,_i([wi("lamports")]),"withdrawNonceAccount"),xi.addVariant(6,_i([Ii("authorized")]),"initializeNonceAccount"),xi.addVariant(7,_i([Ii("authorized")]),"authorizeNonceAccount"),xi.addVariant(8,_i([wi("space")]),"allocate"),xi.addVariant(9,_i([Ii("base"),Si("seed"),wi("space"),Ii("owner")]),"allocateWithSeed"),xi.addVariant(10,_i([Ii("base"),Si("seed"),Ii("owner")]),"assignWithSeed"),xi.addVariant(11,_i([wi("lamports"),Si("seed"),Ii("owner")]),"transferWithSeed");const Ti=Math.max(...Object.values(xi.registry).map((t=>t.span)));class Pi{constructor(t){this.idl=t}async encode(t,e){if("nonce"===t){const t=An.alloc(i.NONCE_ACCOUNT_LENGTH),n=$i.encode(e,t);return t.slice(0,n)}throw new Error(`Invalid account name: ${t}`)}decode(t,e){return this.decodeUnchecked(t,e)}decodeUnchecked(t,e){if("nonce"===t)return function(t){return $i.decode(t)}(e);throw new Error(`Invalid account name: ${t}`)}memcmp(t,e){if("nonce"===t)return{dataSize:i.NONCE_ACCOUNT_LENGTH};throw new Error(`Invalid account name: ${t}`)}size(t){var e;return null!==(e=Wr(this.idl,t))&&void 0!==e?e:0}}class Bi extends ni{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function Li(t){return new Bi(ki(32),(t=>new i.PublicKey(t)),(t=>t.toBuffer()),t)}const $i=_i([bi("version"),bi("state"),Li("authorizedPubkey"),Li("nonce"),_i([("lamportsPerSignature",new class extends ei{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return ci(t.readUInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=ui(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}("lamportsPerSignature"))],"feeCalculator")]);class Ri{constructor(t){}decode(t){throw new Error("System program does not have events")}}class Oi{constructor(t){}encode(t,e){throw new Error("System does not have user-defined types")}decode(t,e){throw new Error("System does not have user-defined types")}}class Di{constructor(t){this.instruction=new Mi(t),this.accounts=new Pi(t),this.events=new Ri(t),this.types=new Oi(t)}}var Ci=Object.freeze({__proto__:null,hash:function(t){return(new TextDecoder).decode((0,h.J)(t))}});function Ni(t,...e){let n=[r.Buffer.from([97,110,99,104,111,114])];e.forEach((t=>{n.push(t instanceof r.Buffer?t:zn(t).toBuffer())}));const[o]=i.PublicKey.findProgramAddressSync(n,zn(t));return o}var zi=Object.freeze({__proto__:null,createWithSeedSync:function(t,e,n){const o=r.Buffer.concat([t.toBuffer(),r.Buffer.from(e),n.toBuffer()]);return new i.PublicKey((0,h.J)(o))},associated:Ni});const Ui=new i.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),ji=new i.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var Yi=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Ui,ASSOCIATED_PROGRAM_ID:ji,associatedAddress:function({mint:t,owner:e}){return i.PublicKey.findProgramAddressSync([e.toBuffer(),Ui.toBuffer(),t.toBuffer()],ji)[0]}}),Fi={exports:{}};!function(t,e){var n="undefined"!=typeof self?self:Qr,r=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function m(t){var e=new FileReader,n=p(e);return e.readAsArrayBuffer(t),n}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=p(e);return e.readAsText(t),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function _(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function v(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];v.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function M(t,n){return new Promise((function(r,o){var s=new w(t,n);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new v(i,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}M.polyfill=!0,t.fetch||(t.fetch=M,t.Headers=h,t.Request=w,t.Response=v),e.Headers=h,e.Request=w,e.Response=v,e.fetch=M,Object.defineProperty(e,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(Fi,Fi.exports);var Wi=ti(Fi.exports);async function Hi(t,e){const n=await t.getAccountInfo(e);if(null===n)throw new Error("program account not found");const{program:r}=qi(n.data),i=await t.getAccountInfo(r.programdataAddress);if(null===i)throw new Error("program data account not found");const{programData:o}=qi(i.data);return o}const Ki=l.rustEnum([l.struct([],"uninitialized"),l.struct([l.option(l.publicKey(),"authorityAddress")],"buffer"),l.struct([l.publicKey("programdataAddress")],"program"),l.struct([l.u64("slot"),l.option(l.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,l.u32());function qi(t){return Ki.decode(t)}var Vi=Object.freeze({__proto__:null,verifiedBuild:async function(t,e,n=5){const r=`https://api.apr.dev/api/v0/program/${e.toString()}/latest?limit=${n}`,[i,o]=await Promise.all([Hi(t,e),Wi(r)]),s=(await o.json()).filter((t=>!t.aborted&&"Built"===t.state&&"Verified"===t.verified));if(0===s.length)return null;const a=s[0];return i.slot.toNumber()!==a.verified_slot?null:a},fetchData:Hi,decodeUpgradeableLoaderState:qi}),Gi=Object.freeze({__proto__:null,sha256:Ci,rpc:pr,publicKey:zi,bytes:On,token:Yi,features:Sr,registry:Vi});function Zi(t){return"accounts"in t}const Xi=l.struct([l.publicKey("authority"),l.vecU8("data")]);function Ji(t,e){var n,r;let i={};const o=t.args?t.args.length:0;if(e.length>o){if(e.length!==o+1)throw new Error(`provided too many arguments ${e} to instruction ${null==t?void 0:t.name} expecting: ${null!==(r=null===(n=t.args)||void 0===n?void 0:n.map((t=>t.name)))&&void 0!==r?r:[]}`);i=e.pop()}return[e,i]}class Qi{static build(t,e,n){if("_inner"===t.name)throw new Ir("the _inner name is reserved");const r=(...o)=>{const[s,a]=Ji(t,[...o]);Nn(t.accounts,a.accounts);const u=r.accounts(a.accounts);return void 0!==a.remainingAccounts&&u.push(...a.remainingAccounts),Ar("debug-logs")&&console.log("Outgoing account metas:",u),new i.TransactionInstruction({keys:u,programId:n,data:e(t.name,Cn(t,...s))})};return r.accounts=e=>Qi.accountsArray(e,t.accounts,n,t.name),r}static accountsArray(t,e,n,r){return t?e.map((e=>{if(void 0!==("accounts"in e?e.accounts:void 0)){const i=t[e.name];return Qi.accountsArray(i,e.accounts,n,r).flat()}{const i=e;let o;try{o=zn(t[e.name])}catch(t){throw new Error(`Wrong input type for account "${e.name}" in the instruction accounts object${void 0!==r?' for instruction "'+r+'"':""}. Expected PublicKey or string.`)}const s=i.isOptional&&o.equals(n);return{pubkey:o,isWritable:i.isMut&&!s,isSigner:i.isSigner&&!s}}})).flat():[]}}class to{static build(t,e){return(...n)=>{var r,o,s;const[,a]=Ji(t,[...n]),u=new i.Transaction;if(a.preInstructions&&a.instructions)throw new Error("instructions is deprecated, use preInstructions");return null===(r=a.preInstructions)||void 0===r||r.forEach((t=>u.add(t))),null===(o=a.instructions)||void 0===o||o.forEach((t=>u.add(t))),u.add(e(...n)),null===(s=a.postInstructions)||void 0===s||s.forEach((t=>u.add(t))),u}}}class eo{static build(t,e,n,r){return async(...i)=>{var o;const s=e(...i),[,a]=Ji(t,[...i]);if(void 0===r.sendAndConfirm)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await r.sendAndConfirm(s,null!==(o=a.signers)&&void 0!==o?o:[],a.options)}catch(t){throw Pr(t,n)}}}}class no{static build(t,e,n,r){var i;const o={};return null===(i=t.accounts)||void 0===i||i.forEach((i=>{const s=d()(i.name);o[s]=new ro(t,i,n,r,e)})),o}}class ro{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,r,i){this._idlAccount=e,this._programId=n,this._provider=null!=r?r:_r(),this._coder=null!=i?i:new Jr(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:r,context:i}=n;return{data:r&&0!==r.data.length?this._coder.accounts.decode(this._idlAccount.name,r.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(null===n)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:r}=await this.fetchNullableAndContext(t,e);if(null===n)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:r}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map((t=>t?t.data:null))}async fetchMultipleAndContext(t,e){return(await sr(this._provider.connection,t.map((t=>zn(t))),e)).map((t=>{if(null==t)return null;const{account:e,context:n}=t;return{data:this._coder.accounts.decode(this._idlAccount.name,e.data),context:n}}))}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof An?t:void 0),n=[];return null!=(null==e?void 0:e.offset)&&null!=(null==e?void 0:e.bytes)&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),null!=(null==e?void 0:e.dataSize)&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map((({pubkey:t,account:e})=>({publicKey:t,account:this._coder.accounts.decode(this._idlAccount.name,e.data)})))}subscribe(t,e){const n=io.get(t.toString());if(n)return n.ee;const r=new(Mn());t=zn(t);const i=this._provider.connection.onAccountChange(t,(t=>{const e=this._coder.accounts.decode(this._idlAccount.name,t.data);r.emit("change",e)}),e);return io.set(t.toString(),{ee:r,listener:i}),r}async unsubscribe(t){let e=io.get(t.toString());e?io&&await this._provider.connection.removeAccountChangeListener(e.listener).then((()=>{io.delete(t.toString())})).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(t,e){const n=this.size;if(void 0===this._provider.publicKey)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return i.SystemProgram.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:null!=e?e:n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(null!=e?e:n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await Ni(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(zn(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(zn(t),e)}}const io=new Map,oo="Program log: ";class so{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new ao(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let r=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,(null!==(n=this._eventListeners.get(t))&&void 0!==n?n:[]).concat(r)),this._eventCallbacks.set(r,[t,e]),void 0!==this._onLogsSubscriptionId||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,((t,e)=>{if(!t.err)for(const n of this._eventParser.parseLogs(t.logs)){const r=this._eventListeners.get(n.name);r&&r.forEach((r=>{const i=this._eventCallbacks.get(r);if(i){const[,r]=i;r(n.data,e.slot,t.signature)}}))}}))),r}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let r=this._eventListeners.get(n);if(!r)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),r=r.filter((e=>e!==t)),this._eventListeners.set(n,r),0===r.length&&this._eventListeners.delete(n),0===this._eventCallbacks.size){if(0!==this._eventListeners.size)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);void 0!==this._onLogsSubscriptionId&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class ao{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new co(t),r=new uo;let i=n.next();for(;null!==i;){let[t,o,s]=this.handleLog(r,i,e);t&&(yield t),o&&r.push(o),s&&r.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(oo)||t.startsWith("Program data: ")){const n=t.startsWith(oo)?t.slice(13):t.slice(14),r=this.coder.events.decode(n);if(e&&null===r)throw new Error(`Unable to decode event ${n}`);return[r,null,!1]}return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return null!==e.match(/^Program (.*) success/g)?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class uo{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class co{constructor(t){this.logs=t}next(){if(0===this.logs.length)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class lo{static build(t,e,n,r,i,o,s){return async(...a)=>{var u;const c=e(...a),[,d]=Ji(t,[...a]);let l;if(void 0===r.simulate)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{l=await r.simulate(c,d.signers,null===(u=d.options)||void 0===u?void 0:u.commitment)}catch(t){throw Pr(t,n)}if(void 0===l)throw new Error("Unable to simulate transaction");const h=l.logs;if(!h)throw new Error("Simulated logs not found");const f=[];if(s.events){let t=new ao(o,i);for(const e of t.parseLogs(h))f.push(e)}return{events:f,raw:h}}}}function ho(t){return new mo(ki(8),(t=>yo.fromBuffer(t)),(t=>t.toBuffer()),t)}function fo(t){return new mo(ki(32),(t=>new i.PublicKey(t)),(t=>t.toBuffer()),t)}function po(t,e){return new go(t,e)}class mo extends ni{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class go extends ni{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=bi()}encode(t,e,n=0){return null==t?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class yo extends(s()){toBuffer(){const t=super.toArray().reverse(),e=An.from(t);if(8===e.length)return e;if(e.length>=8)throw new Error("u64 too large");const n=An.alloc(8);return e.copy(n),n}static fromBuffer(t){if(8!==t.length)throw new Error(`Invalid buffer length: ${t.length}`);return new yo([...t].reverse().map((t=>`00${t.toString(16)}`.slice(-2))).join(""),16)}}const bo=_i([fo("mint"),fo("owner"),ho("amount"),po(fo(),"delegate"),(t=>{const e=vi(new oi(1,"discriminator"),null,"state");return e.addVariant(0,_i([]),"uninitialized"),e.addVariant(1,_i([]),"initialized"),e.addVariant(2,_i([]),"frozen"),e})(),po(ho(),"isNative"),ho("delegatedAmount"),po(fo(),"closeAuthority")]);class wo{constructor(t,e,n,r,i,o,s,a){this._accounts=e,this._provider=n,this._programId=r,this._idlIx=i,this._idlTypes=s,this._customResolver=a,this._args=t,this._accountStore=new _o(n,o,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const r of e){const e=r.name,i=t[e];void 0!==i&&(ko(i)?Zi(r)?n[e]=this.resolveOptionalsHelper(i,r.accounts):n[e]=Mo(i,!0):null!==i?n[e]=zn(i):r.isOptional&&(n[e]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce(((t,e)=>t&&t[e]),this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach(((r,i)=>{i==t.length-1&&(n[r]=e),n[r]=n[r]||{},n=n[r]}))}async resolveConst(t,e=[]){for(let n=0;n0&&!this.get([...e,a])&&Boolean(await this.autoPopulatePda(s,e))&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let r=0;r!this.get([...e,d()(t)])));if(n+=t.length,t.length>0){const n=await this._accountStore.fetchAccount({publicKey:c});await Promise.all(t.map((async t=>{const r=d()(t);return this.set([...e,r],n[r]),n[r]})))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map((t=>this.toBuffer(t,e))));if(n.some((t=>void 0===t)))return;const r=await this.parseProgramId(t,e);if(!r)return;const[o]=await i.PublicKey.findProgramAddress(n,r);this.set([...e,d()(t.name)],o)}async parseProgramId(t,e=[]){var n;if(!(null===(n=t.pda)||void 0===n?void 0:n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new i.PublicKey(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find((e=>e.name===t.defined));if(!n)throw new Error(`Cannot find type ${t.defined}`);const r=n.type.fields.find((t=>t.name===e[0]));return this.getType(r.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(void 0!==e)return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=d()(e[0]),r=this._idlIx.args.findIndex((t=>t.name===n));if(-1===r)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce(((t,e)=>(t||{})[e]),this._args[r])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),r=n[0],i=this.get([...e,d()(r)]);if(null===i)throw new Error("fieldPubkey is null");if(1===n.length)return i;const o=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(o,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[d()(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return An.from([e]);case"u16":let n=An.alloc(2);return n.writeUInt16LE(e),n;case"u32":let r=An.alloc(4);return r.writeUInt32LE(e),r;case"u64":let i=An.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return An.from(En(e));case"publicKey":return e.toBuffer();default:if(t.array)return An.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}wo.CONST_ACCOUNTS={associatedTokenProgram:ji,rent:i.SYSVAR_RENT_PUBKEY,systemProgram:i.SystemProgram.programId,tokenProgram:Ui,clock:i.SYSVAR_CLOCK_PUBKEY};class _o{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await xo.fetchIdl(t,this._provider);if(e){const n=new xo(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const r=t.toString();if(!this._cache.has(r))if("TokenAccount"===e){const e=await this._provider.connection.getAccountInfo(t);if(null===e)throw new Error(`invalid account info for ${r}`);const n=(i=e.data,bo.decode(i));this._cache.set(r,n)}else if(e){const i=await this.ensureIdl(n);if(i){const n=i[d()(e)];if(n){const e=await n.fetch(t);this._cache.set(r,e)}}}else{const e=await this._provider.connection.getAccountInfo(t);if(null===e)throw new Error(`invalid account info for ${r}`);const n=e.data,i=await this.ensureIdl(e.owner);if(i){const t=Object.values(i)[0];if(!t)throw new Error("No accounts for this program");const e=t.coder.accounts.decodeAny(n);this._cache.set(r,e)}}var i;return this._cache.get(r)}}class vo{static build(t,e,n,r,i,o,s,a,u,c,d){return(...l)=>new Ao(l,r,i,o,s,a,t,e,n,u,c,d)}}function ko(t){return"object"==typeof t&&null!==t&&!("_bn"in t)}function Mo(t,e){const n={};for(const r in t){const i=t[r];if(null!==i)n[r]=ko(i)?Mo(i,!0):zn(i);else if(e)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!")}return n}class Ao{constructor(t,e,n,r,i,o,s,a,u,c,d,l){this._ixFn=e,this._txFn=n,this._rpcFn=r,this._simulateFn=i,this._viewFn=o,this._programId=a,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new wo(t,this._accounts,s,a,u,c,d,l)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class So{static build(t,e,n,r){const i=e.accounts.find((t=>t.isMut)),o=!!e.returns;if(!i&&o)return async(...i)=>{var o,s;let a=await n(...i);const u=`Program return: ${t} `;let c=a.raw.find((t=>t.startsWith(u)));if(!c)throw new Error("View expected return log");let d=$n(c.slice(u.length)),l=e.returns;if(!l)throw new Error("View expected return type");return zr.fieldLayout({type:l},Array.from([...null!==(o=r.accounts)&&void 0!==o?o:[],...null!==(s=r.types)&&void 0!==s?s:[]])).decode(d)}}}class Io{static build(t,e,n,r,i){const o={},s={},a={},u={},c={},l={},h=Dn(t),f=t.accounts?no.build(t,e,n,r):{};return t.instructions.forEach((p=>{const m=Qi.build(p,((t,n)=>e.instruction.encode(t,n)),n),g=to.build(p,m),y=eo.build(p,g,h,r),b=lo.build(p,g,h,r,e,n,t),w=So.build(n,p,b,t),_=vo.build(r,n,p,m,g,y,b,w,f,t.types||[],i&&i(p)),v=d()(p.name);s[v]=m,a[v]=g,o[v]=y,u[v]=b,c[v]=_,w&&(l[v]=w)})),[o,s,a,f,u,c,l]}}class xo{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,r,i){e=zn(e),n||(n=_r()),this._idl=t,this._provider=n,this._programId=e,this._coder=null!=r?r:new Jr(t),this._events=new so(this._programId,n,this._coder);const[o,s,a,u,c,d,l]=Io.build(t,this._coder,e,n,null!=i?i:()=>{});this.rpc=o,this.instruction=s,this.transaction=a,this.account=u,this.simulate=c,this.methods=d,this.views=l}static async at(t,e){const n=zn(t),r=await xo.fetchIdl(n,e);if(!r)throw new Error(`IDL not found for program: ${t.toString()}`);return new xo(r,n,e)}static async fetchIdl(t,e){e=null!=e?e:_r();const n=zn(t),r=await async function(t){const e=(await i.PublicKey.findProgramAddress([],t))[0];return await i.PublicKey.createWithSeed(e,"anchor:idl",t)}(n),o=await e.connection.getAccountInfo(r);if(!o)return null;let s=(a=o.data.slice(8),Xi.decode(a));var a;const u=vn(s.data);return JSON.parse(xn(u))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}const Eo=new i.PublicKey("11111111111111111111111111111111");const To={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};class Po{static system(t){return function(t){return new xo(To,Eo,t,new Di(To))}(t)}}},6378:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.associatedAddress=e.ASSOCIATED_PROGRAM_ID=e.TOKEN_PROGRAM_ID=void 0;const r=n(33957);e.TOKEN_PROGRAM_ID=new r.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),e.ASSOCIATED_PROGRAM_ID=new r.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),e.associatedAddress=function({mint:t,owner:n}){return r.PublicKey.findProgramAddressSync([n.toBuffer(),e.TOKEN_PROGRAM_ID.toBuffer(),t.toBuffer()],e.ASSOCIATED_PROGRAM_ID)[0]}},61275:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.array=e.rustEnum=e.str=e.vecU8=e.tagged=e.vec=e.bool=e.option=e.publicKey=e.i256=e.u256=e.i128=e.u128=e.i64=e.u64=e.struct=e.f64=e.f32=e.i32=e.u32=e.i16=e.u16=e.i8=e.u8=void 0;const o=n(20698),s=n(33957),a=i(n(13550));var u=n(20698);Object.defineProperty(e,"u8",{enumerable:!0,get:function(){return u.u8}}),Object.defineProperty(e,"i8",{enumerable:!0,get:function(){return u.s8}}),Object.defineProperty(e,"u16",{enumerable:!0,get:function(){return u.u16}}),Object.defineProperty(e,"i16",{enumerable:!0,get:function(){return u.s16}}),Object.defineProperty(e,"u32",{enumerable:!0,get:function(){return u.u32}}),Object.defineProperty(e,"i32",{enumerable:!0,get:function(){return u.s32}}),Object.defineProperty(e,"f32",{enumerable:!0,get:function(){return u.f32}}),Object.defineProperty(e,"f64",{enumerable:!0,get:function(){return u.f64}}),Object.defineProperty(e,"struct",{enumerable:!0,get:function(){return u.struct}});class c extends o.Layout{constructor(t,e,n){super(t,n),this.blob=(0,o.blob)(t),this.signed=e}decode(t,e=0){const n=new a.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(t,e,n=0){return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(r,"le",this.span),e,n)}}function d(t){return new c(8,!1,t)}e.u64=d,e.i64=function(t){return new c(8,!0,t)},e.u128=function(t){return new c(16,!1,t)},e.i128=function(t){return new c(16,!0,t)},e.u256=function(t){return new c(32,!1,t)},e.i256=function(t){return new c(32,!0,t)};class l extends o.Layout{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}e.publicKey=function(t){return new l((0,o.blob)(32),(t=>new s.PublicKey(t)),(t=>t.toBuffer()),t)};class h extends o.Layout{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=(0,o.u8)()}encode(t,e,n=0){return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}getSpan(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}function f(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function p(t){return t?1:0}function m(t){const e=(0,o.u32)("length"),n=(0,o.struct)([e,(0,o.blob)((0,o.offset)(e,-e.span),"data")]);return new l(n,(({data:t})=>t),(t=>({data:t})),t)}e.option=function(t,e){return new h(t,e)},e.bool=function(t){return new l((0,o.u8)(),f,p,t)},e.vec=function(t,e){const n=(0,o.u32)("length"),r=(0,o.struct)([n,(0,o.seq)(t,(0,o.offset)(n,-n.span),"values")]);return new l(r,(({values:t})=>t),(t=>({values:t})),e)},e.tagged=function(t,e,n){const r=(0,o.struct)([d("tag"),e.replicate("data")]);return new l(r,(function({tag:e,data:n}){if(!e.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+e.toString("hex"));return n}),(e=>({tag:t,data:e})),n)},e.vecU8=m,e.str=function(t){return new l(m(),(t=>t.toString("utf-8")),(t=>r.from(t,"utf-8")),t)},e.rustEnum=function(t,e,n){const r=(0,o.union)(null!=n?n:(0,o.u8)(),e);return t.forEach(((t,e)=>r.addVariant(e,t,t.property))),r},e.array=function(t,e,n){const r=(0,o.struct)([(0,o.seq)(t,e,"values")]);return new l(r,(({values:t})=>t),(t=>({values:t})),n)};class g extends o.Layout{constructor(t,e,n){super(t.span+e.span,n),this.keyLayout=t,this.valueLayout=e}decode(t,e){return e=e||0,[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}encode(t,e,n){n=n||0;const r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}getSpan(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}e.map=function(t,e,n){const r=(0,o.u32)("length"),i=(0,o.struct)([r,(0,o.seq)(new g(t,e),(0,o.offset)(r,-r.span),"values")]);return new l(i,(({values:t})=>new Map(t)),(t=>({values:Array.from(t.entries())})),n)}},33957:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Account:()=>Jn,AddressLookupTableAccount:()=>ai,AddressLookupTableInstruction:()=>ns,AddressLookupTableProgram:()=>rs,Authorized:()=>ps,BLOCKHASH_CACHE_TIMEOUT_MS:()=>fi,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>Qn,BPF_LOADER_PROGRAM_ID:()=>qr,BpfLoader:()=>Vr,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>os,ComputeBudgetInstruction:()=>is,ComputeBudgetProgram:()=>ss,Connection:()=>Qo,Ed25519Program:()=>us,Enum:()=>Wn,EpochSchedule:()=>ei,FeeCalculatorLayout:()=>Cr,Keypair:()=>ts,LAMPORTS_PER_SOL:()=>Cs,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>es,Loader:()=>Kr,Lockup:()=>ms,MAX_SEED_LENGTH:()=>Vn,Message:()=>mr,MessageAccountKeys:()=>sr,MessageV0:()=>gr,NONCE_ACCOUNT_LENGTH:()=>zr,NonceAccount:()=>Ur,PACKET_DATA_SIZE:()=>tr,PUBLIC_KEY_LENGTH:()=>Gn,PublicKey:()=>Xn,SIGNATURE_LENGTH_IN_BYTES:()=>nr,SOLANA_SCHEMA:()=>Hn,STAKE_CONFIG_ID:()=>fs,STAKE_INSTRUCTION_LAYOUTS:()=>ys,SYSTEM_INSTRUCTION_LAYOUTS:()=>Fr,SYSVAR_CLOCK_PUBKEY:()=>Ar,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>Sr,SYSVAR_INSTRUCTIONS_PUBKEY:()=>Ir,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>xr,SYSVAR_RENT_PUBKEY:()=>Er,SYSVAR_REWARDS_PUBKEY:()=>Tr,SYSVAR_SLOT_HASHES_PUBKEY:()=>Pr,SYSVAR_SLOT_HISTORY_PUBKEY:()=>Br,SYSVAR_STAKE_HISTORY_PUBKEY:()=>Lr,Secp256k1Program:()=>ls,SendTransactionError:()=>ni,SolanaJSONRPCError:()=>ii,SolanaJSONRPCErrorCode:()=>ri,StakeAuthorizationLayout:()=>bs,StakeInstruction:()=>gs,StakeProgram:()=>ws,Struct:()=>Fn,SystemInstruction:()=>Yr,SystemProgram:()=>Wr,Transaction:()=>vr,TransactionExpiredBlockheightExceededError:()=>rr,TransactionExpiredNonceInvalidError:()=>or,TransactionExpiredTimeoutError:()=>ir,TransactionInstruction:()=>_r,TransactionMessage:()=>kr,TransactionStatus:()=>br,VALIDATOR_INFO_KEY:()=>Ss,VERSION_PREFIX_MASK:()=>er,VOTE_PROGRAM_ID:()=>Es,ValidatorInfo:()=>xs,VersionedMessage:()=>yr,VersionedTransaction:()=>Mr,VoteAccount:()=>Ps,VoteAuthorizationLayout:()=>Ms,VoteInit:()=>_s,VoteInstruction:()=>vs,VoteProgram:()=>As,clusterApiUrl:()=>Os,sendAndConfirmRawTransaction:()=>Ds,sendAndConfirmTransaction:()=>$r});var r={};n.r(r),n.d(r,{dQ:()=>rt,ci:()=>K,bytesToNumberBE:()=>X,ty:()=>J,eV:()=>nt,n$:()=>st,ql:()=>et,hexToBytes:()=>Z,_t:()=>W,tL:()=>Q,S5:()=>tt,FF:()=>ut});var i=n(48764);function o(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function s(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}const u="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function c(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const d=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),l=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function h(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function f(t){if("string"==typeof t&&(t=h(t)),!c(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function p(...t){let e=0;for(let n=0;nt().update(f(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function y(t=32){if(u&&"function"==typeof u.getRandomValues)return u.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class b extends m{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=d(this.buffer)}update(t){a(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=f(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const u=d(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t>_&w)}:{h:0|Number(t>>_&w),l:0|Number(t&w)}}const k=function(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it>>>n,A=(t,e,n)=>t<<32-n|e>>>n,S=(t,e,n)=>t>>>n|e<<32-n,I=(t,e,n)=>t<<32-n|e>>>n,x=(t,e,n)=>t<<64-n|e>>>n-32,E=(t,e,n)=>t>>>n-32|e<<64-n,T=function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},P=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),B=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,L=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),$=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,R=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,O=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0),[D,C]=(()=>k(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),N=new Uint32Array(80),z=new Uint32Array(80);class U extends b{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)N[n]=t.getUint32(e),z[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|N[t-15],n=0|z[t-15],r=S(e,n,1)^S(e,n,8)^M(e,n,7),i=I(e,n,1)^I(e,n,8)^A(e,n,7),o=0|N[t-2],s=0|z[t-2],a=S(o,s,19)^x(o,s,61)^M(o,s,6),u=I(o,s,19)^E(o,s,61)^A(o,s,6),c=L(i,u,z[t-7],z[t-16]),d=$(c,r,a,N[t-7],N[t-16]);N[t]=0|d,z[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=S(d,l,14)^S(d,l,18)^x(d,l,41),b=I(d,l,14)^I(d,l,18)^E(d,l,41),w=d&h^~d&p,_=O(y,b,l&f^~l&m,C[t],z[t]),v=R(_,g,e,w,D[t],N[t]),k=0|_,M=S(n,r,28)^x(n,r,34)^x(n,r,39),A=I(n,r,28)^E(n,r,34)^E(n,r,39),L=n&i^n&s^i&s,$=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|d,f=0|l,({h:d,l}=T(0|u,0|c,0|v,0|k)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const U=P(k,A,$);n=B(U,v,M,L),r=0|U}({h:n,l:r}=T(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=T(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=T(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=T(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=T(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=T(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=T(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=T(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y)}roundClean(){N.fill(0),z.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const j=g((()=>new U)),Y=(BigInt(0),BigInt(1)),F=BigInt(2);function W(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const H=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function K(t){if(!W(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n=V._0&&t<=V._9?t-V._0:t>=V._A&&t<=V._F?t-(V._A-10):t>=V._a&&t<=V._f?t-(V._a-10):void 0}function Z(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(F<new Uint8Array(t),ot=t=>Uint8Array.from(t);function st(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=it(t),i=it(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=it())=>{i=a(ot([0]),t),r=a(),0!==t.length&&(i=a(ot([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const at={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||W(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function ut(t,e,n={}){const r=(e,n,r)=>{const i=at[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const ct=BigInt(0),dt=BigInt(1),lt=BigInt(2),ht=BigInt(3),ft=BigInt(4),pt=BigInt(5),mt=BigInt(8);function gt(t,e){const n=t%e;return n>=ct?n:e+n}function yt(t,e,n){if(n<=ct||e 0");if(n===dt)return ct;let r=dt;for(;e>ct;)e&dt&&(r=r*t%n),t=t*t%n,e>>=dt;return r}function bt(t,e,n){let r=t;for(;e-- >ct;)r*=r,r%=n;return r}function wt(t,e){if(t===ct||e<=ct)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=gt(t,e),r=e,i=ct,o=dt,s=dt,a=ct;for(;n!==ct;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==dt)throw new Error("invert: does not exist");return gt(i,e)}BigInt(9),BigInt(16);const _t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function vt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function kt(t,e,n=!1,r={}){if(t<=ct)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=vt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%ft===ht){const e=(t+dt)/ft;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%mt===pt){const e=(t-pt)/mt;return function(t,n){const r=t.mul(n,lt),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,lt),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-dt)/lt;let n,r,i;for(n=t-dt,r=0;n%lt===ct;n/=lt,r++);for(i=lt;igt(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return ct<=e&&et===ct,isOdd:t=>(t&dt)===dt,neg:e=>gt(-e,t),eql:(t,e)=>t===e,sqr:e=>gt(e*e,t),add:(e,n)=>gt(e+n,t),sub:(e,n)=>gt(e-n,t),mul:(e,n)=>gt(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===ct)return t.ONE;if(n===dt)return e;let r=t.ONE,i=e;for(;n>ct;)n&dt&&(r=t.mul(r,i)),i=t.sqr(i),n>>=dt;return r}(a,t,e),div:(e,n)=>gt(e*wt(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>wt(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?tt(t,o):Q(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?J(t):X(t)}});return Object.freeze(a)}function Mt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function At(t){const e=Mt(t);return e+Math.ceil(e/2)}const St=BigInt(0),It=BigInt(1);function xt(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>St;)n&It&&(r=r.add(i)),i=i.double(),n>>=It;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=It);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function Et(t){return ut(t.Fp,_t.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),ut(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...vt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const Tt=BigInt(0),Pt=BigInt(1),Bt=BigInt(2),Lt=BigInt(8),$t={zip215:!0};function Rt(t){const e=function(t){const e=Et(t);return ut(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=Bt<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:Tt}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&Ttp(t)&&p(e)&&tt===Tt||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===Tt?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,Pt,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(Bt*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===Tt)return this.double();const r=d(s*Bt*h),f=d(a*Bt*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===Tt?M:this.equals(M)||e===Pt?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?Lt:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:Tt,y:Pt};if(u!==Pt)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===Pt?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=et("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=J(a);h===Tt||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-Pt),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&Pt)===Pt,_=0!=(128&u);if(!r&&b===Tt&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return x(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=tt(e,n.BYTES);return r[r.length-1]|=t&Pt?128:0,r}toHex(){return K(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,Pt,d(e.Gx*e.Gy)),v.ZERO=new v(Tt,Pt,Pt,Tt);const{BASE:k,ZERO:M}=v,A=xt(v,8*a);function S(t){return gt(t,r)}function I(t){return S(J(t))}function x(t){const e=a;t=et("private key",t,e);const n=et("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function E(t=new Uint8Array,...e){const n=nt(...e);return I(o(f(n,et("context",t),!!i)))}const T=$t;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return x(t).pointBytes},sign:function(t,e,r={}){t=et("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=x(e),c=E(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+E(r.context,d,u,t)*s);return b(l),et("result",nt(d,tt(l,n.BYTES)),2*a)},verify:function(t,e,r,o=T){const{context:s,zip215:a}=o,u=n.BYTES;t=et("signature",t,2*u),e=et("message",e),i&&(e=i(e));const c=J(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=E(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const Ot=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Dt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Ct=(BigInt(0),BigInt(1)),Nt=BigInt(2),zt=BigInt(5),Ut=BigInt(10),jt=BigInt(20),Yt=BigInt(40),Ft=BigInt(80);const Wt=kt(Ot,void 0,!0),Ht={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Wt,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:j,randomBytes:y,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=Ot,r=gt(e*e*e,n),i=gt(r*r*e,n);let o=gt(t*r*function(t){const e=Ot,n=t*t%e*t%e,r=bt(n,Nt,e)*n%e,i=bt(r,Ct,e)*t%e,o=bt(i,zt,e)*i%e,s=bt(o,Ut,e)*o%e,a=bt(s,jt,e)*s%e,u=bt(a,Yt,e)*a%e,c=bt(u,Ft,e)*u%e,d=bt(c,Ft,e)*u%e,l=bt(d,Ut,e)*o%e;return{pow_p_5_8:bt(l,Nt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=gt(e*o*o,n),a=o,u=gt(o*Dt,n),c=s===t,d=s===gt(-t,n),l=s===gt(-t*Dt,n);return c&&(o=a),(d||l)&&(o=u),(gt(o,n)&dt)===dt&&(o=gt(-o,n)),{isValid:c||d,value:o}}},Kt=Rt(Ht);const qt=(Wt.ORDER+BigInt(3))/BigInt(8);Wt.pow(Nt,qt),Wt.sqrt(Wt.neg(Wt.ONE)),Wt.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(Wt,Wt.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Vt=n(13550),Gt=n.n(Vt),Zt=n(77191),Xt=n.n(Zt);function Jt(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Qt(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function te(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ee(t,e){Qt(t);const n=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),re=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function ie(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),!((e=t)instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name))throw new Error("expected Uint8Array, got "+typeof t);var e;return t}class oe{clone(){return this._cloneInto()}}function se(t){const e=e=>t().update(ie(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}class ae extends oe{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ne(this.buffer)}update(t){te(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=ie(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=ne(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;tt&e^t&n^e&n,ce=new Uint32Array([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]),de=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),le=new Uint32Array(64);class he extends ae{constructor(){super(64,32,8,!1),this.A=0|de[0],this.B=0|de[1],this.C=0|de[2],this.D=0|de[3],this.E=0|de[4],this.F=0|de[5],this.G=0|de[6],this.H=0|de[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)le[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=le[t-15],n=le[t-2],r=re(e,7)^re(e,18)^e>>>3,i=re(n,17)^re(n,19)^n>>>10;le[t]=i+le[t-7]+r+le[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(re(s,6)^re(s,11)^re(s,25))+((d=s)&a^~d&u)+ce[t]+le[t]|0,l=(re(n,2)^re(n,13)^re(n,22))+ue(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){le.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const fe=se((()=>new he));var pe=n(25532),me=n(39386),ge=n(40475);class ye extends TypeError{constructor(t,e){let n;const{message:r,...i}=t,{path:o}=t;super(0===o.length?r:"At path: "+o.join(".")+" -- "+r),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[t,...e()]}}}function be(t){return"object"==typeof t&&null!=t}function we(t){return"string"==typeof t?JSON.stringify(t):""+t}function _e(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:o}=e,{type:s}=n,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+we(r)+"`"}=t;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:u}}function*ve(t,e,n,r){var i;be(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]);for(const i of t){const t=_e(i,e,n,r);t&&(yield t)}}function*ke(t,e,n={}){const{path:r=[],branch:i=[t],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(t=e.coercer(t,a),s&&"type"!==e.type&&be(e.schema)&&be(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let u=!0;for(const n of e.validator(t,a))u=!1,yield[n,void 0];for(let[n,c,d]of e.entries(t,a)){const e=ke(c,d,{path:void 0===n?r:[...r,n],branch:void 0===n?i:[...i,c],coerce:o,mask:s});for(const r of e)r[0]?(u=!1,yield[r[0],void 0]):o&&(c=r[1],void 0===n?t=c:t instanceof Map?t.set(n,c):t instanceof Set?t.add(c):be(t)&&(t[n]=c))}if(u)for(const n of e.refiner(t,a))u=!1,yield[n,void 0];u&&(yield[void 0,t])}class Me{constructor(t){const{type:e,schema:n,validator:r,refiner:i,coercer:o=(t=>t),entries:s=function*(){}}=t;this.type=e,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(t,e)=>ve(r(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>ve(i(t,e),e,this,t):()=>[]}assert(t){return Ae(t,this)}create(t){return Se(t,this)}is(t){return Ie(t,this)}mask(t){return function(t,e){const n=xe(t,e,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(t,this)}validate(t,e={}){return xe(t,this,e)}}function Ae(t,e){const n=xe(t,e);if(n[0])throw n[0]}function Se(t,e){const n=xe(t,e,{coerce:!0});if(n[0])throw n[0];return n[1]}function Ie(t,e){return!xe(t,e)[0]}function xe(t,e,n={}){const r=ke(t,e,n),i=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(r);return i[0]?[new ye(i[0],(function*(){for(const t of r)t[0]&&(yield t[0])})),void 0]:[void 0,i[1]]}function Ee(t,e){return new Me({type:t,schema:null,validator:e})}function Te(t){return new Me({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+we(t)})}function Pe(){return Ee("boolean",(t=>"boolean"==typeof t))}function Be(t){return Ee("instance",(e=>e instanceof t||"Expected a `"+t.name+"` instance, but received: "+we(e)))}function Le(t){const e=we(t),n=typeof t;return new Me({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||"Expected the literal `"+e+"`, but received: "+we(n)})}function $e(t){return new Me({...t,validator:(e,n)=>null===e||t.validator(e,n),refiner:(e,n)=>null===e||t.refiner(e,n)})}function Re(){return Ee("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+we(t)))}function Oe(t){return new Me({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function De(t,e){return new Me({type:"record",schema:null,*entries(n){if(be(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:t=>be(t)||"Expected an object, but received: "+we(t)})}function Ce(){return Ee("string",(t=>"string"==typeof t||"Expected a string, but received: "+we(t)))}function Ne(t){const e=Ee("never",(()=>!1));return new Me({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(t.length,n.length);for(let i=0;iArray.isArray(t)||"Expected an array, but received: "+we(t)})}function ze(t){const e=Object.keys(t);return new Me({type:"type",schema:t,*entries(n){if(be(n))for(const r of e)yield[r,n[r],t[r]]},validator:t=>be(t)||"Expected an object, but received: "+we(t)})}function Ue(t){const e=t.map((t=>t.type)).join(" | ");return new Me({type:"union",schema:null,validator(n,r){const i=[];for(const e of t){const[...t]=ke(n,e,r),[o]=t;if(!o[0])return[];for(const[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+we(n),...i]}})}function je(){return Ee("unknown",(()=>!0))}function Ye(t,e,n){return new Me({...t,coercer:(r,i)=>Ie(r,e)?t.coercer(n(r,i),i):t.coercer(r,i)})}var Fe=n(31198),We=n.n(Fe),He=n(80158),Ke=n(16916);const qe=BigInt(2**32-1),Ve=BigInt(32);function Ge(t,e=!1){return e?{h:Number(t&qe),l:Number(t>>Ve&qe)}:{h:0|Number(t>>Ve&qe),l:0|Number(t&qe)}}function Ze(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i>rn)*sn)%on,e&nn&&(i^=en<<(en<n>32?((t,e,n)=>e<>>64-n)(t,e,n):((t,e,n)=>t<>>32-n)(t,e,n),dn=(t,e,n)=>n>32?((t,e,n)=>t<>>64-n)(t,e,n):((t,e,n)=>e<>>32-n)(t,e,n);class ln extends oe{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Jt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=cn(o,s,1)^n[r],u=dn(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=Je[n],o=cn(e,i,r),s=dn(e,i,r),a=Xe[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=an[r],t[1]^=un[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){te(this);const{blockLen:e,state:n}=this,r=(t=ie(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Jt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ee(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new ln(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const hn=((t,e,n)=>se((()=>new ln(e,t,n))))(1,136,32),fn=(t,e,n)=>t&e^t&n^e&n,pn=new Uint32Array([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]),mn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gn=new Uint32Array(64);class yn extends b{constructor(){super(64,32,8,!1),this.A=0|mn[0],this.B=0|mn[1],this.C=0|mn[2],this.D=0|mn[3],this.E=0|mn[4],this.F=0|mn[5],this.G=0|mn[6],this.H=0|mn[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)gn[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=gn[t-15],n=gn[t-2],r=l(e,7)^l(e,18)^e>>>3,i=l(n,17)^l(n,19)^n>>>10;gn[t]=i+gn[t-7]+r+gn[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(l(s,6)^l(s,11)^l(s,25))+((d=s)&a^~d&u)+pn[t]+gn[t]|0,h=(l(n,2)^l(n,13)^l(n,22))+fn(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+h|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){gn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const bn=g((()=>new yn));class wn extends m{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(t.outputLen),o(t.blockLen)}(t);const n=f(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew wn(t,e).update(n).digest();_n.create=(t,e)=>new wn(t,e);const{bytesToNumberBE:vn,hexToBytes:kn}=r,Mn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=Mn;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:vn(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Mn,n="string"==typeof t?kn(t):t;if(!W(n))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=Mn._parseInt(n.subarray(2)),{d:s,l:a}=Mn._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},An=BigInt(0),Sn=BigInt(1),In=(BigInt(2),BigInt(3));function xn(t){const e=function(t){const e=Et(t);return ut(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return gt(t,r)}function a(t){return wt(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=Et(t);ut(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return nt(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&Ann.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(et("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,In),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,In);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===An)return r;if(a(t),t===Sn)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>An||c>An;)s&Sn&&(d=d.add(p)),c&Sn&&(h=h.add(p)),p=p.double(),s>>=Sn,c>>=Sn;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==An&&e!==Sn&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Sn)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Sn?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return K(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=xt(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=nt;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=X(s);if(!(An<(a=t)&&aK(Q(t,e.nByteLength));function f(t){return t>r>>Sn}const p=(t,e,n)=>X(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=et("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=Mn.toSig(et("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(et("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return Z(this.toDERHex())}toDERHex(){return Mn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Z(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=At(e.n);return function(t,e,n=!1){const r=t.length,i=Mt(e),o=At(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=gt(n?X(t):J(t),e-dt)+dt;return n?tt(s,i):Q(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=W(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=X(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=rt(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(An<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Q(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=et("msgHash",t),p&&(t=et("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g){const t=!0===g?d(n.BYTES):g;M.push(et("extraEntropy",t))}const A=nt(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===An)return;const o=s(n*s(S+i*_));if(o===An)return;let c=(r.x===i?0:2)|Number(r.y&Sn),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return st(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=et("msgHash",n),r=et("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||W(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof Mn.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function En(t){return{hash:t,hmac:(e,...n)=>_n(t,e,p(...n)),randomBytes:y}}BigInt(4);const Tn=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Pn=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Bn=BigInt(1),Ln=BigInt(2),$n=(t,e)=>(t+e/Ln)/e;const Rn=kt(Tn,void 0,void 0,{sqrt:function(t){const e=Tn,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=bt(d,n,e)*d%e,h=bt(l,n,e)*d%e,f=bt(h,Ln,e)*c%e,p=bt(f,i,e)*f%e,m=bt(p,o,e)*p%e,g=bt(m,a,e)*m%e,y=bt(g,u,e)*g%e,b=bt(y,a,e)*m%e,w=bt(b,n,e)*d%e,_=bt(w,s,e)*p%e,v=bt(_,r,e)*c%e,k=bt(v,Ln,e);if(!Rn.eql(Rn.sqr(k),t))throw new Error("Cannot find square root");return k}}),On=function(t,e){const n=e=>xn({...t,...En(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Rn,n:Pn,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Pn,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Bn*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=$n(o*t,e),u=$n(-r*t,e);let c=gt(t-a*n-u*i,e),d=gt(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},bn);BigInt(0),On.ProjectivePoint;const Dn=Kt.utils.randomPrivateKey,Cn=()=>{const t=Kt.utils.randomPrivateKey(),e=Nn(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},Nn=Kt.getPublicKey;function zn(t){try{return Kt.ExtendedPoint.fromHex(t),!0}catch{return!1}}const Un=(t,e)=>Kt.sign(t,e.slice(0,32)),jn=Kt.verify,Yn=t=>i.Buffer.isBuffer(t)?t:t instanceof Uint8Array?i.Buffer.from(t.buffer,t.byteOffset,t.byteLength):i.Buffer.from(t);class Fn{constructor(t){Object.assign(this,t)}encode(){return i.Buffer.from((0,pe.serialize)(Hn,this))}static decode(t){return(0,pe.deserialize)(Hn,this,t)}static decodeUnchecked(t){return(0,pe.deserializeUnchecked)(Hn,this,t)}}class Wn extends Fn{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}}const Hn=new Map;var Kn;let qn;const Vn=32,Gn=32;let Zn=1;qn=Symbol.toStringTag;class Xn extends Fn{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Xt().decode(t);if(e.length!=Gn)throw new Error("Invalid public key input");this._bn=new(Gt())(e)}else this._bn=new(Gt())(t);if(this._bn.byteLength()>Gn)throw new Error("Invalid public key input")}}static unique(){const t=new Xn(Zn);return Zn+=1,new Xn(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Xt().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(i.Buffer);if(t.length===Gn)return t;const e=i.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[qn](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=i.Buffer.concat([t.toBuffer(),i.Buffer.from(e),n.toBuffer()]),o=fe(r);return new Xn(o)}static createProgramAddressSync(t,e){let n=i.Buffer.alloc(0);t.forEach((function(t){if(t.length>Vn)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Yn(t)])})),n=i.Buffer.concat([n,e.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=fe(n);if(zn(r))throw new Error("Invalid seeds, address must fall off the curve");return new Xn(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const o=t.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return zn(new Xn(t).toBytes())}}Kn=Xn,Xn.default=new Kn("11111111111111111111111111111111"),Hn.set(Xn,{kind:"struct",fields:[["_bn","u256"]]});class Jn{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=Yn(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Yn(Dn()),this._publicKey=Yn(Nn(this._secretKey))}get publicKey(){return new Xn(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const Qn=new Xn("BPFLoader1111111111111111111111111111111111"),tr=1232,er=127,nr=64;class rr extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(rr.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class ir extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(ir.prototype,"name",{value:"TransactionExpiredTimeoutError"});class or extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(or.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class sr{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const ar=(t="publicKey")=>me.blob(32,t),ur=(t="signature")=>me.blob(64,t),cr=(t="string")=>{const e=me.struct([me.u32("length"),me.u32("lengthPadding"),me.blob(me.offset(me.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),o=e;return o.decode=(t,e)=>n(t,e).chars.toString(),o.encode=(t,e,n)=>{const o={chars:i.Buffer.from(t,"utf8")};return r(o,e,n)},o.alloc=t=>me.u32().span+me.u32().span+i.Buffer.from(t,"utf8").length,o};function dr(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return dr({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function lr(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function hr(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function fr(t,e){if(!t)throw new Error(e||"Assertion failed")}class pr{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new pr(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];fr(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{fr(e.length>0,"Expected at least one writable signer key");const[t]=e[0];fr(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Xn(t))),...n.map((([t])=>new Xn(t))),...r.map((([t])=>new Xn(t))),...i.map((([t])=>new Xn(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Xn(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(fr(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}class mr{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Xn(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Xt().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new sr(this.staticAccountKeys)}static compile(t){const e=pr.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new sr(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Xt().encode(t.data)})));return new mr({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];hr(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Xt().decode(t.data));let o=[];hr(o,e.length);let s=[];return hr(s,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:e,dataLength:i.Buffer.from(s),data:r}}));let r=[];hr(r,n.length);let o=i.Buffer.alloc(tr);i.Buffer.from(r).copy(o);let s=r.length;n.forEach((t=>{const e=me.struct([me.u8("programIdIndex"),me.blob(t.keyIndicesCount.length,"keyIndicesCount"),me.seq(me.u8("keyIndex"),t.keyIndices.length,"keyIndices"),me.blob(t.dataLength.length,"dataLength"),me.seq(me.u8("userdatum"),t.data.length,"data")]).encode(t,o,s);s+=e})),o=o.slice(0,s);const a=me.struct([me.blob(1,"numRequiredSignatures"),me.blob(1,"numReadonlySignedAccounts"),me.blob(1,"numReadonlyUnsignedAccounts"),me.blob(e.length,"keyCount"),me.seq(ar("key"),t,"keys"),ar("recentBlockhash")]),u={numRequiredSignatures:i.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:i.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:i.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:i.Buffer.from(e),keys:this.accountKeys.map((t=>Yn(t.toBytes()))),recentBlockhash:Xt().decode(this.recentBlockhash)};let c=i.Buffer.alloc(2048);const d=a.encode(u,c);return o.copy(c,d),c.slice(0,d+o.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&er))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=e.shift(),o=e.shift(),s=lr(e);let a=[];for(let t=0;t0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new sr(this.staticAccountKeys,e)}isAccountSigner(t){return t=n?t-nt+e.writableIndexes.length),0):t>=this.header.numRequiredSignatures?t-et.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const t of n.writableIndexes){if(!(tt.toBytes())),recentBlockhash:Xt().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let t=0;const e=new Uint8Array(tr);for(const n of this.compiledInstructions){const r=Array();hr(r,n.accountKeyIndexes.length);const i=Array();hr(i,n.data.length),t+=me.struct([me.u8("programIdIndex"),me.blob(r.length,"encodedAccountKeyIndexesLength"),me.seq(me.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),me.blob(i.length,"encodedDataLength"),me.blob(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(tr);for(const n of this.addressTableLookups){const r=Array();hr(r,n.writableIndexes.length);const i=Array();hr(i,n.readonlyIndexes.length),t+=me.struct([ar("accountKey"),me.blob(r.length,"encodedWritableIndexesLength"),me.seq(me.u8(),n.writableIndexes.length,"writableIndexes"),me.blob(i.length,"encodedReadonlyIndexesLength"),me.seq(me.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),r=n&er;fr(n!==r,"Expected versioned message but received legacy message"),fr(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},o=[],s=lr(e);for(let t=0;t{const e=yr.deserializeMessageVersion(t);if("legacy"===e)return mr.from(t);if(0===e)return gr.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let br=function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t}({});const wr=i.Buffer.alloc(nr).fill(0);class _r{constructor(t){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class vr{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new _r(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Xn(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Xt().encode(e)}}));return f.forEach((t=>{fr(t.programIdIndex>=0),t.accounts.forEach((t=>fr(t>=0)))})),new mr({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=Un(n,t.secretKey);this._addSignature(t.publicKey,Yn(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){fr(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=i.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):jn(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];hr(n,e.length);const r=n.length+64*e.length+t.length,o=i.Buffer.alloc(r);return fr(e.length<256),i.Buffer.from(n).copy(o,0),e.forEach((({signature:t},e)=>{null!==t&&(fr(64===t.length,"signature has invalid length"),i.Buffer.from(t).copy(o,n.length+64*e))})),t.copy(o,n.length+64*e.length),fr(o.length<=tr,`Transaction too large: ${o.length} > ${tr}`),o}get keys(){return fr(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return fr(1===this.instructions.length),this.instructions[0].programId}get data(){return fr(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=lr(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Xt().encode(wr)?null:Xt().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new _r({keys:r,programId:t.accountKeys[e.programIdIndex],data:Xt().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}class kr{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:r,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;fr(u>0,"Message header is invalid");const c=t.staticAccountKeys.length-o-a;fr(c>=0,"Message header is invalid");const d=t.getAccountKeys(e),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const t of r){const e=[];for(const r of t.accountKeyIndexes){const t=d.get(r);if(void 0===t)throw new Error(`Failed to find key for account key index ${r}`);let i;i=rt.equals(r.publicKey)));fr(t>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[t]=Un(e,r.secretKey)}}addSignature(t,e){fr(64===e.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((e=>e.equals(t)));fr(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const Ar=new Xn("SysvarC1ock11111111111111111111111111111111"),Sr=new Xn("SysvarEpochSchedu1e111111111111111111111111"),Ir=new Xn("Sysvar1nstructions1111111111111111111111111"),xr=new Xn("SysvarRecentB1ockHashes11111111111111111111"),Er=new Xn("SysvarRent111111111111111111111111111111111"),Tr=new Xn("SysvarRewards111111111111111111111111111111"),Pr=new Xn("SysvarS1otHashes111111111111111111111111111"),Br=new Xn("SysvarS1otHistory11111111111111111111111111"),Lr=new Xn("SysvarStakeHistory1111111111111111111111111");async function $r(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function Rr(t){return new Promise((e=>setTimeout(e,t)))}function Or(t,e){const n=t.layout.span>=0?t.layout.span:dr(t,e),r=i.Buffer.alloc(n),o=Object.assign({instruction:t.index},e);return t.layout.encode(o,r),r}function Dr(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const Cr=me.nu64("lamportsPerSignature"),Nr=me.struct([me.u32("version"),me.u32("state"),ar("authorizedPubkey"),ar("nonce"),me.struct([Cr],"feeCalculator")]),zr=Nr.span;class Ur{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=Nr.decode(Yn(t),0);return new Ur({authorizedPubkey:new Xn(e.authorizedPubkey),nonce:new Xn(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const jr=(8,t=>{const e=(0,me.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return(0,ge.toBigIntLE)(i.Buffer.from(n))},o.encode=(t,e,r)=>{const i=(0,ge.toBufferLE)(t,8);return n(i,e,r)},o});class Yr{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Fr))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=Dr(Fr.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new Xn(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=Dr(Fr.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=Dr(Fr.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new Xn(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=Dr(Fr.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=Dr(Fr.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Xn(e),seed:n,space:r,programId:new Xn(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=Dr(Fr.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new Xn(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=Dr(Fr.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Xn(e),seed:n,programId:new Xn(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=Dr(Fr.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new Xn(e),seed:n,lamports:r,space:i,programId:new Xn(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=Dr(Fr.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new Xn(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Dr(Fr.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Dr(Fr.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=Dr(Fr.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new Xn(e)}}static checkProgramId(t){if(!t.equals(Wr.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length0?i:1,space:o.length,programId:r}));null!==a&&await $r(t,a,[e,n],{commitment:"confirmed"})}const s=me.struct([me.u32("instruction"),me.u32("offset"),me.u32("bytesLength"),me.u32("bytesLengthPadding"),me.seq(me.u8("byte"),me.offset(me.u32(),-8),"bytes")]),a=Kr.chunkSize;let u=0,c=o,d=[];for(;c.length>0;){const o=c.slice(0,a),l=i.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:o,bytesLength:0,bytesLengthPadding:0},l);const h=(new vr).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push($r(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await Rr(1e3/t)}u+=a,c=c.slice(a)}await Promise.all(d);{const o=me.struct([me.u32("instruction")]),s=i.Buffer.alloc(o.span);o.encode({instruction:1},s);const a=(new vr).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Er,isSigner:!1,isWritable:!1}],programId:r,data:s}),u="processed",c=await t.sendTransaction(a,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}Kr.chunkSize=Hr;const qr=new Xn("BPFLoader2111111111111111111111111111111111");class Vr{static getMinNumSignatures(t){return Kr.getMinNumSignatures(t)}static load(t,e,n,r,i){return Kr.load(t,e,n,i,r)}}function Gr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Zr=Object.prototype.toString,Xr=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function Jr(t,e){var n,r,i,o,s,a,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return Jr(t.toJSON(),e);if("[object Array]"===(u=Zr.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=Jr(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Xr(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}class ei{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32)))-ti(32)-1;return[n,t-(this.getSlotsInEpoch(n)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}var e}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const n=(0,Ke.Z)(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in n?n.socket:n,n}),t,e,n),this.underlyingSocket=void 0}call(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class ai{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${t.index}`);return n}(ui,t),n=t.length-56;fr(n>=0,"lookup table is invalid"),fr(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=me.struct([me.seq(ar(),r,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new Xn(e.authority[0]):void 0,addresses:i.map((t=>new Xn(t)))}}}const ui={index:1,layout:me.struct([me.u32("typeIndex"),jr("deactivationSlot"),me.nu64("lastExtendedSlot"),me.u8("lastExtendedStartIndex"),me.u8(),me.seq(ar(),me.offset(me.u8(),-1),"authority")])},ci=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,di=Ye(Be(Xn),Ce(),(t=>new Xn(t))),li=Ne([Ce(),Le("base64")]),hi=Ye(Be(i.Buffer),li,(t=>i.Buffer.from(t[0],"base64"))),fi=3e4;function pi(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function mi(t){return Ue([ze({jsonrpc:Le("2.0"),id:Ce(),result:t}),ze({jsonrpc:Le("2.0"),id:Ce(),error:ze({code:je(),message:Ce(),data:Oe(Ee("any",(()=>!0)))})})])}const gi=mi(je());function yi(t){return Ye(mi(t),gi,(e=>"error"in e?e:{...e,result:Se(e.result,t)}))}function bi(t){return yi(ze({context:ze({slot:Re()}),value:t}))}function wi(t){return ze({context:ze({slot:Re()}),value:t})}function _i(t,e){return 0===t?new gr({header:e.header,staticAccountKeys:e.accountKeys.map((t=>new Xn(t))),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Xt().decode(t.data)}))),addressTableLookups:e.addressTableLookups}):new mr(e)}const vi=ze({foundation:Re(),foundationTerm:Re(),initial:Re(),taper:Re(),terminal:Re()}),ki=yi(Te($e(ze({epoch:Re(),effectiveSlot:Re(),amount:Re(),postBalance:Re(),commission:Oe($e(Re()))})))),Mi=Te(ze({slot:Re(),prioritizationFee:Re()})),Ai=ze({total:Re(),validator:Re(),foundation:Re(),epoch:Re()}),Si=ze({epoch:Re(),slotIndex:Re(),slotsInEpoch:Re(),absoluteSlot:Re(),blockHeight:Oe(Re()),transactionCount:Oe(Re())}),Ii=ze({slotsPerEpoch:Re(),leaderScheduleSlotOffset:Re(),warmup:Pe(),firstNormalEpoch:Re(),firstNormalSlot:Re()}),xi=De(Ce(),Te(Re())),Ei=$e(Ue([ze({}),Ce()])),Ti=ze({err:Ei}),Pi=Le("receivedSignature"),Bi=ze({"solana-core":Ce(),"feature-set":Oe(Re())}),Li=bi(ze({err:$e(Ue([ze({}),Ce()])),logs:$e(Te(Ce())),accounts:Oe($e(Te($e(ze({executable:Pe(),owner:Ce(),lamports:Re(),data:Te(Ce()),rentEpoch:Oe(Re())}))))),unitsConsumed:Oe(Re()),returnData:Oe($e(ze({programId:Ce(),data:Ne([Ce(),Le("base64")])})))})),$i=bi(ze({byIdentity:De(Ce(),Te(Re())),range:ze({firstSlot:Re(),lastSlot:Re()})})),Ri=yi(vi),Oi=yi(Ai),Di=yi(Mi),Ci=yi(Si),Ni=yi(Ii),zi=yi(xi),Ui=yi(Re()),ji=bi(ze({total:Re(),circulating:Re(),nonCirculating:Re(),nonCirculatingAccounts:Te(di)})),Yi=ze({amount:Ce(),uiAmount:$e(Re()),decimals:Re(),uiAmountString:Oe(Ce())}),Fi=bi(Te(ze({address:di,amount:Ce(),uiAmount:$e(Re()),decimals:Re(),uiAmountString:Oe(Ce())}))),Wi=bi(Te(ze({pubkey:di,account:ze({executable:Pe(),owner:di,lamports:Re(),data:hi,rentEpoch:Re()})}))),Hi=ze({program:Ce(),parsed:je(),space:Re()}),Ki=bi(Te(ze({pubkey:di,account:ze({executable:Pe(),owner:di,lamports:Re(),data:Hi,rentEpoch:Re()})}))),qi=bi(Te(ze({lamports:Re(),address:di}))),Vi=ze({executable:Pe(),owner:di,lamports:Re(),data:hi,rentEpoch:Re()}),Gi=ze({pubkey:di,account:Vi}),Zi=Ye(Ue([Be(i.Buffer),Hi]),Ue([li,Hi]),(t=>Array.isArray(t)?Se(t,hi):t)),Xi=ze({executable:Pe(),owner:di,lamports:Re(),data:Zi,rentEpoch:Re()}),Ji=ze({pubkey:di,account:Xi}),Qi=ze({state:Ue([Le("active"),Le("inactive"),Le("activating"),Le("deactivating")]),active:Re(),inactive:Re()}),to=yi(Te(ze({signature:Ce(),slot:Re(),err:Ei,memo:$e(Ce()),blockTime:Oe($e(Re()))}))),eo=yi(Te(ze({signature:Ce(),slot:Re(),err:Ei,memo:$e(Ce()),blockTime:Oe($e(Re()))}))),no=ze({subscription:Re(),result:wi(Vi)}),ro=ze({pubkey:di,account:Vi}),io=ze({subscription:Re(),result:wi(ro)}),oo=ze({parent:Re(),slot:Re(),root:Re()}),so=ze({subscription:Re(),result:oo}),ao=Ue([ze({type:Ue([Le("firstShredReceived"),Le("completed"),Le("optimisticConfirmation"),Le("root")]),slot:Re(),timestamp:Re()}),ze({type:Le("createdBank"),parent:Re(),slot:Re(),timestamp:Re()}),ze({type:Le("frozen"),slot:Re(),timestamp:Re(),stats:ze({numTransactionEntries:Re(),numSuccessfulTransactions:Re(),numFailedTransactions:Re(),maxTransactionsPerEntry:Re()})}),ze({type:Le("dead"),slot:Re(),timestamp:Re(),err:Ce()})]),uo=ze({subscription:Re(),result:ao}),co=ze({subscription:Re(),result:wi(Ue([Ti,Pi]))}),lo=ze({subscription:Re(),result:Re()}),ho=ze({pubkey:Ce(),gossip:$e(Ce()),tpu:$e(Ce()),rpc:$e(Ce()),version:$e(Ce())}),fo=ze({votePubkey:Ce(),nodePubkey:Ce(),activatedStake:Re(),epochVoteAccount:Pe(),epochCredits:Te(Ne([Re(),Re(),Re()])),commission:Re(),lastVote:Re(),rootSlot:$e(Re())}),po=yi(ze({current:Te(fo),delinquent:Te(fo)})),mo=Ue([Le("processed"),Le("confirmed"),Le("finalized")]),go=ze({slot:Re(),confirmations:$e(Re()),err:Ei,confirmationStatus:Oe(mo)}),yo=bi(Te($e(go))),bo=yi(Re()),wo=ze({accountKey:di,writableIndexes:Te(Re()),readonlyIndexes:Te(Re())}),_o=ze({signatures:Te(Ce()),message:ze({accountKeys:Te(Ce()),header:ze({numRequiredSignatures:Re(),numReadonlySignedAccounts:Re(),numReadonlyUnsignedAccounts:Re()}),instructions:Te(ze({accounts:Te(Re()),data:Ce(),programIdIndex:Re()})),recentBlockhash:Ce(),addressTableLookups:Oe(Te(wo))})}),vo=ze({pubkey:di,signer:Pe(),writable:Pe(),source:Oe(Ue([Le("transaction"),Le("lookupTable")]))}),ko=ze({accountKeys:Te(vo),signatures:Te(Ce())}),Mo=ze({parsed:je(),program:Ce(),programId:di}),Ao=ze({accounts:Te(di),data:Ce(),programId:di}),So=Ye(Ue([Ao,Mo]),Ue([ze({parsed:je(),program:Ce(),programId:Ce()}),ze({accounts:Te(Ce()),data:Ce(),programId:Ce()})]),(t=>Se(t,"accounts"in t?Ao:Mo))),Io=ze({signatures:Te(Ce()),message:ze({accountKeys:Te(vo),instructions:Te(So),recentBlockhash:Ce(),addressTableLookups:Oe($e(Te(wo)))})}),xo=ze({accountIndex:Re(),mint:Ce(),owner:Oe(Ce()),uiTokenAmount:Yi}),Eo=ze({writable:Te(di),readonly:Te(di)}),To=ze({err:Ei,fee:Re(),innerInstructions:Oe($e(Te(ze({index:Re(),instructions:Te(ze({accounts:Te(Re()),data:Ce(),programIdIndex:Re()}))})))),preBalances:Te(Re()),postBalances:Te(Re()),logMessages:Oe($e(Te(Ce()))),preTokenBalances:Oe($e(Te(xo))),postTokenBalances:Oe($e(Te(xo))),loadedAddresses:Oe(Eo),computeUnitsConsumed:Oe(Re())}),Po=ze({err:Ei,fee:Re(),innerInstructions:Oe($e(Te(ze({index:Re(),instructions:Te(So)})))),preBalances:Te(Re()),postBalances:Te(Re()),logMessages:Oe($e(Te(Ce()))),preTokenBalances:Oe($e(Te(xo))),postTokenBalances:Oe($e(Te(xo))),loadedAddresses:Oe(Eo),computeUnitsConsumed:Oe(Re())}),Bo=Ue([Le(0),Le("legacy")]),Lo=ze({pubkey:Ce(),lamports:Re(),postBalance:$e(Re()),rewardType:$e(Ce()),commission:Oe($e(Re()))}),$o=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:_o,meta:$e(To),version:Oe(Bo)})),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),Ro=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),Oo=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:ko,meta:$e(To),version:Oe(Bo)})),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),Do=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:Io,meta:$e(Po),version:Oe(Bo)})),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),Co=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:ko,meta:$e(Po),version:Oe(Bo)})),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),No=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),rewards:Oe(Te(Lo)),blockTime:$e(Re()),blockHeight:$e(Re())}))),zo=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),transactions:Te(ze({transaction:_o,meta:$e(To)})),rewards:Oe(Te(Lo)),blockTime:$e(Re())}))),Uo=yi($e(ze({blockhash:Ce(),previousBlockhash:Ce(),parentSlot:Re(),signatures:Te(Ce()),blockTime:$e(Re())}))),jo=yi($e(ze({slot:Re(),meta:$e(To),blockTime:Oe($e(Re())),transaction:_o,version:Oe(Bo)}))),Yo=yi($e(ze({slot:Re(),transaction:Io,meta:$e(Po),blockTime:Oe($e(Re())),version:Oe(Bo)}))),Fo=bi(ze({blockhash:Ce(),feeCalculator:ze({lamportsPerSignature:Re()})})),Wo=bi(ze({blockhash:Ce(),lastValidBlockHeight:Re()})),Ho=bi(Pe()),Ko=yi(Te(ze({slot:Re(),numTransactions:Re(),numSlots:Re(),samplePeriodSecs:Re()}))),qo=bi($e(ze({feeCalculator:ze({lamportsPerSignature:Re()})}))),Vo=yi(Ce()),Go=yi(Ce()),Zo=ze({err:Ei,logs:Te(Ce()),signature:Ce()}),Xo=ze({result:wi(Zo),subscription:Re()}),Jo={"solana-client":"js/0.0.0-development"};class Qo{constructor(t,e){let n,r,i,o,s,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const t={};return async e=>{const{commitment:n,config:r}=pi(e),i=this._buildArgs([],n,void 0,r),o=Qr(i);return t[o]=t[o]??(async()=>{try{const t=Se(await this._rpcRequest("getBlockHeight",i),yi(Re()));if("error"in t)throw new ii(t.error,"failed to get block height information");return t.result}finally{delete t[o]}})(),await t[o]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,n=e.wsEndpoint,r=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=n||function(t){const e=t.match(ci);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);const[n,r,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(t),this._rpcClient=function(t,e,n,r,i,o){const s=n||oi;let a;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(t,e)=>{const n=await new Promise(((n,i)=>{try{r(t,e,((t,e)=>n([t,e])))}catch(t){i(t)}}));return await s(...n)}),new(We())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},Jo)};try{let e,n=5,u=500;for(;e=a?await a(t,o):await s(t,o),429===e.status&&!0!==i&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await Rr(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{})}(t,r,i,o,s,a),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new si(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=Se(await this._rpcRequest("getBalance",i),bi(Re()));if("error"in o)throw new ii(o.error,`failed to get balance for ${t.toBase58()}`);return o.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=Se(await this._rpcRequest("getBlockTime",[t]),yi($e(Re())));if("error"in e)throw new ii(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){const t=Se(await this._rpcRequest("minimumLedgerSlot",[]),yi(Re()));if("error"in t)throw new ii(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){const t=Se(await this._rpcRequest("getFirstAvailableBlock",[]),Ui);if("error"in t)throw new ii(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=Se(await this._rpcRequest("getSupply",[e]),ji);if("error"in n)throw new ii(n.error,"failed to get supply");return n.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=Se(await this._rpcRequest("getTokenSupply",n),bi(Yi));if("error"in r)throw new ii(r.error,"failed to get token supply");return r.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=Se(await this._rpcRequest("getTokenAccountBalance",n),bi(Yi));if("error"in r)throw new ii(r.error,"failed to get token account balance");return r.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=pi(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=Se(await this._rpcRequest("getTokenAccountsByOwner",s),Wi);if("error"in a)throw new ii(a.error,`failed to get token accounts owned by account ${t.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=Se(await this._rpcRequest("getTokenAccountsByOwner",i),Ki);if("error"in o)throw new ii(o.error,`failed to get token accounts owned by account ${t.toBase58()}`);return o.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=Se(await this._rpcRequest("getLargestAccounts",n),qi);if("error"in r)throw new ii(r.error,"failed to get largest accounts");return r.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=Se(await this._rpcRequest("getTokenLargestAccounts",n),Fi);if("error"in r)throw new ii(r.error,"failed to get token largest accounts");return r.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=Se(await this._rpcRequest("getAccountInfo",i),bi($e(Vi)));if("error"in o)throw new ii(o.error,`failed to get info about account ${t.toBase58()}`);return o.result}async getParsedAccountInfo(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=Se(await this._rpcRequest("getAccountInfo",i),bi($e(Xi)));if("error"in o)throw new ii(o.error,`failed to get info about account ${t.toBase58()}`);return o.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){const{commitment:n,config:r}=pi(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=Se(await this._rpcRequest("getMultipleAccounts",o),bi(Te($e(Xi))));if("error"in s)throw new ii(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=pi(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),s=Se(await this._rpcRequest("getMultipleAccounts",o),bi(Te($e(Vi))));if("error"in s)throw new ii(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=pi(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),s=Se(await this._rpcRequest("getStakeActivation",o),yi(Qi));if("error"in s)throw new ii(s.error,`failed to get Stake Activation ${t.toBase58()}`);return s.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=pi(e),{encoding:i,...o}=r||{},s=this._buildArgs([t.toBase58()],n,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=Te(Gi),c=!0===o.withContext?Se(a,bi(u)):Se(a,yi(u));if("error"in c)throw new ii(c.error,`failed to get accounts owned by program ${t.toBase58()}`);return c.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=Se(await this._rpcRequest("getProgramAccounts",i),yi(Te(Ji)));if("error"in o)throw new ii(o.error,`failed to get accounts owned by program ${t.toBase58()}`);return o.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{const e=t;if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);n=e.signature}try{r=Xt().decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}return fr(64===r.length,"signature has invalid length"),"string"==typeof t?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise(((e,n)=>{null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(()=>{n(t.reason)})))}))}getTransactionConfirmationPromise({commitment:t,signature:e}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,s)=>{try{n=this.onSignature(e,((t,e)=>{n=void 0;const r={context:e,value:t};o({__type:br.PROCESSED,response:r})}),t);const a=new Promise((t=>{null==n?t():r=this._onSubscriptionStateChange(n,(e=>{"subscribed"===e&&t()}))}));(async()=>{if(await a,i)return;const n=await this.getSignatureStatus(e);if(i)return;if(null==n)return;const{context:r,value:u}=n;if(null!=u)if(u?.err)s(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,o({__type:br.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((e=>{const r=async()=>{try{return await this.getBlockHeight(t)}catch(t){return-1}};(async()=>{let t=await r();if(!i){for(;t<=n;){if(await Rr(1e3),i)return;if(t=await r(),i)return}e({__type:br.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:t,signature:r}),u=this.getCancellationPromise(e);let c;try{const t=await Promise.race([u,a,o]);if(t.__type!==br.PROCESSED)throw new rr(r);c=t.response}finally{i=!0,s()}return c}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let s=!1;const a=new Promise((e=>{let o=i,a=null;const u=async()=>{try{const{context:e,value:i}=await this.getNonceAndContext(r,{commitment:t,minContextSlot:n});return a=e.slot,i?.nonce}catch(t){return o}};(async()=>{if(o=await u(),!s)for(;;){if(i!==o)return void e({__type:br.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await Rr(2e3),s)return;if(o=await u(),s)return}})()})),{abortConfirmation:u,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(e);let l;try{const e=await Promise.race([d,c,a]);if(e.__type===br.PROCESSED)l=e.response;else{let r;for(;;){const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(e.slotInWhichNonceDidAdvance??n))){r=t;break}await Rr(400)}if(!r?.value)throw new or(o);{const e=t||"finalized",{confirmationStatus:n}=r.value;switch(e){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new or(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new or(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new or(o)}l={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,u()}return l}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let n;const r=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>e({__type:br.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});let s;try{const t=await Promise.race([o,r]);if(t.__type!==br.PROCESSED)throw new ir(e,t.timeoutMs/1e3);s=t.response}finally{clearTimeout(n),i()}return s}async getClusterNodes(){const t=Se(await this._rpcRequest("getClusterNodes",[]),yi(Te(ho)));if("error"in t)throw new ii(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=Se(await this._rpcRequest("getVoteAccounts",e),po);if("error"in n)throw new ii(n.error,"failed to get vote accounts");return n.result}async getSlot(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getSlot",r),yi(Re()));if("error"in i)throw new ii(i.error,"failed to get slot");return i.result}async getSlotLeader(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getSlotLeader",r),yi(Ce()));if("error"in i)throw new ii(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(t,e){const n=[t,e],r=Se(await this._rpcRequest("getSlotLeaders",n),yi(Te(di)));if("error"in r)throw new ii(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);return fr(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=Se(await this._rpcRequest("getSignatureStatuses",n),yo);if("error"in r)throw new ii(r.error,"failed to get signature status");return r.result}async getTransactionCount(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getTransactionCount",r),yi(Re()));if("error"in i)throw new ii(i.error,"failed to get transaction count");return i.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=Se(await this._rpcRequest("getInflationGovernor",e),Ri);if("error"in n)throw new ii(n.error,"failed to get inflation");return n.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=pi(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:i?.epoch}),s=Se(await this._rpcRequest("getInflationReward",o),ki);if("error"in s)throw new ii(s.error,"failed to get inflation reward");return s.result}async getInflationRate(){const t=Se(await this._rpcRequest("getInflationRate",[]),Oi);if("error"in t)throw new ii(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getEpochInfo",r),Ci);if("error"in i)throw new ii(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const t=Se(await this._rpcRequest("getEpochSchedule",[]),Ni);if("error"in t)throw new ii(t.error,"failed to get epoch schedule");const e=t.result;return new ei(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){const t=Se(await this._rpcRequest("getLeaderSchedule",[]),zi);if("error"in t)throw new ii(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=Se(await this._rpcRequest("getMinimumBalanceForRentExemption",n),bo);return"error"in r?(console.warn("Unable to fetch minimum balance for rent exemption"),0):r.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=Se(await this._rpcRequest("getRecentBlockhash",e),Fo);if("error"in n)throw new ii(n.error,"failed to get recent blockhash");return n.result}async getRecentPerformanceSamples(t){const e=Se(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),Ko);if("error"in e)throw new ii(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=Se(await this._rpcRequest("getFeeCalculatorForBlockhash",n),qo);if("error"in r)throw new ii(r.error,"failed to get fee calculator");const{context:i,value:o}=r.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(t,e){const n=Yn(t.serialize()).toString("base64"),r=this._buildArgs([n],e),i=Se(await this._rpcRequest("getFeeForMessage",r),bi($e(Re())));if("error"in i)throw new ii(i.error,"failed to get fee for message");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentPrioritizationFees(t){const e=t?.lockedWritableAccounts?.map((t=>t.toBase58())),n=e?.length?[e]:[],r=Se(await this._rpcRequest("getRecentPrioritizationFees",n),Di);if("error"in r)throw new ii(r.error,"failed to get recent prioritization fees");return r.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,void 0,n),i=Se(await this._rpcRequest("getLatestBlockhash",r),Wo);if("error"in i)throw new ii(i.error,"failed to get latest blockhash");return i.result}async isBlockhashValid(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgs([t],n,void 0,r),o=Se(await this._rpcRequest("isBlockhashValid",i),Ho);if("error"in o)throw new ii(o.error,"failed to determine if the blockhash `"+t+"`is valid");return o.result}async getVersion(){const t=Se(await this._rpcRequest("getVersion",[]),yi(Bi));if("error"in t)throw new ii(t.error,"failed to get version");return t.result}async getGenesisHash(){const t=Se(await this._rpcRequest("getGenesisHash",[]),yi(Ce()));if("error"in t)throw new ii(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=Se(o,Oo);if("error"in t)throw t.error;return t.result}case"none":{const t=Se(o,Ro);if("error"in t)throw t.error;return t.result}default:{const t=Se(o,$o);if("error"in t)throw t.error;const{result:e}=t;return e?{...e,transactions:e.transactions.map((({transaction:t,meta:e,version:n})=>({meta:e,transaction:{...t,message:_i(n,t.message)},version:n})))}:null}}}catch(t){throw new ii(t,"failed to get confirmed block")}}async getParsedBlock(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=Se(o,Co);if("error"in t)throw t.error;return t.result}case"none":{const t=Se(o,No);if("error"in t)throw t.error;return t.result}default:{const t=Se(o,Do);if("error"in t)throw t.error;return t.result}}}catch(t){throw new ii(t,"failed to get block")}}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=Se(await this._rpcRequest("getBlockProduction",r),$i);if("error"in i)throw new ii(i.error,"failed to get block production information");return i.result}async getTransaction(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=Se(await this._rpcRequest("getTransaction",i),jo);if("error"in o)throw new ii(o.error,"failed to get transaction");const s=o.result;return s?{...s,transaction:{...s.transaction,message:_i(s.version,s.transaction.message)}}:s}async getParsedTransaction(t,e){const{commitment:n,config:r}=pi(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=Se(await this._rpcRequest("getTransaction",i),Yo);if("error"in o)throw new ii(o.error,"failed to get transaction");return o.result}async getParsedTransactions(t,e){const{commitment:n,config:r}=pi(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=Se(t,Yo);if("error"in e)throw new ii(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const{commitment:n,config:r}=pi(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=Se(t,jo);if("error"in e)throw new ii(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:_i(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=Se(await this._rpcRequest("getConfirmedBlock",n),zo);if("error"in r)throw new ii(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");const o={...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new mr(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...o,transactions:o.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:vr.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=Se(await this._rpcRequest("getBlocks",r),yi(Te(Re())));if("error"in i)throw new ii(i.error,"failed to get blocks");return i.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=Se(await this._rpcRequest("getBlock",n),Uo);if("error"in r)throw new ii(r.error,"failed to get block");const i=r.result;if(!i)throw new Error("Block "+t+" not found");return i}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=Se(await this._rpcRequest("getConfirmedBlock",n),Uo);if("error"in r)throw new ii(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");return i}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=Se(await this._rpcRequest("getConfirmedTransaction",n),jo);if("error"in r)throw new ii(r.error,"failed to get transaction");const i=r.result;if(!i)return i;const o=new mr(i.transaction.message),s=i.transaction.signatures;return{...i,transaction:vr.populate(o,s)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=Se(await this._rpcRequest("getConfirmedTransaction",n),Yo);if("error"in r)throw new ii(r.error,"failed to get confirmed transaction");return r.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=Se(t,Yo);if("error"in e)throw new ii(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=Se(await this._rpcRequest("getConfirmedSignaturesForAddress2",r),to);if("error"in i)throw new ii(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=Se(await this._rpcRequest("getSignaturesForAddress",r),eo);if("error"in i)throw new ii(i.error,"failed to get signatures for address");return i.result}async getAddressLookupTable(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=new ai({key:t,state:ai.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=Ur.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=Se(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),Vo);if("error"in n)throw new ii(n.error,`airdrop to ${t.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await Rr(100);const t=Date.now()-this._blockhashInfo.lastFetch>=fi;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await Rr(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:e,config:n}=pi(t),r=this._buildArgs([],e,"base64",n),i=Se(await this._rpcRequest("getStakeMinimumDelegation",r),bi(Re()));if("error"in i)throw new ii(i.error,"failed to get stake minimum delegation");return i.result}async simulateTransaction(t,e,n){if("message"in t){const r=t.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(e)||void 0!==n)throw new Error("Invalid arguments");const s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment);const a=[o,s],u=Se(await this._rpcRequest("simulateTransaction",a),Li);if("error"in u)throw new Error("failed to simulate transaction: "+u.error.message);return u.result}let r;if(t instanceof vr){let e=t;r=new vr,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=vr.populate(t),r._message=r._json=void 0;if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid arguments");const o=e;if(r.nonceInfo&&o)r.sign(...o);else{let t=this._disableBlockhashCaching;for(;;){const e=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=e.lastValidBlockHeight,r.recentBlockhash=e.blockhash,!o)break;if(r.sign(...o),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}t=!0}}const s=r._compile(),a=s.serialize(),u=r._serialize(a).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:s.nonProgramIds()).map((t=>t.toBase58()));c.accounts={encoding:"base64",addresses:t}}o&&(c.sigVerify=!0);const d=[u,c],l=Se(await this._rpcRequest("simulateTransaction",d),Li);if("error"in l){let t;if("data"in l.error&&(t=l.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(l.error.message,n)}throw new ni("failed to simulate transaction: "+l.error.message,t)}return l.result}async sendTransaction(t,e,n){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const n=t.serialize();return await this.sendRawTransaction(n,e)}if(void 0===e||!Array.isArray(e))throw new Error("Invalid arguments");const r=e;if(t.nonceInfo)t.sign(...r);else{let e=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(e);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...r),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}e=!0}}const i=t.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(t,e){const n=Yn(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],s=Se(await this._rpcRequest("sendTransaction",o),Go);if("error"in s){let t;throw"data"in s.error&&(t=s.error.data.logs),new ni("failed to send transaction: "+s.error.message,t)}return s.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(t,e){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,n!==e.state){const n=this._subscriptionStateChangeCallbacksByHash[t];n&&n.forEach((t=>{try{t(e.state)}catch{}}))}}_onSubscriptionStateChange(t,e){const n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(e),()=>{r.delete(e),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const e=await this._rpcWebSocket.call(i,r);this._setSubscription(t,{...n,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=Se(t,no);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=Qr([t.method,e],!0),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];fr(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=Se(t,io);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=Se(t,Xo);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=Se(t,so);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=Se(t,uo);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=Se(t,co);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),s=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=Se(t,lo);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class ts{constructor(t){this._keypair=void 0,this._keypair=t??Cn()}static generate(){return new ts(Cn())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=Nn(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new ts({publicKey:n,secretKey:t})}static fromSeed(t){const e=Nn(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new ts({publicKey:e,secretKey:n})}get publicKey(){return new Xn(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const es=Object.freeze({CreateLookupTable:{index:0,layout:me.struct([me.u32("instruction"),jr("recentSlot"),me.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:me.struct([me.u32("instruction")])},ExtendLookupTable:{index:2,layout:me.struct([me.u32("instruction"),jr(),me.seq(ar(),me.offset(me.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:me.struct([me.u32("instruction")])},CloseLookupTable:{index:4,layout:me.struct([me.u32("instruction")])}});class ns{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(es))if(r.index==e){n=t;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);const{recentSlot:e}=Dr(es.CreateLookupTable,t.data);return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error(`invalid instruction; found ${t.keys.length} keys, expected at least 2`);const{addresses:e}=Dr(es.ExtendLookupTable,t.data);return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((t=>new Xn(t)))}}static decodeCloseLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}static decodeFreezeLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static decodeDeactivateLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(rs.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(t,e){if(t.lengtht.toBytes()))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Wr.programId,isSigner:!1,isWritable:!1}),new _r({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=Or(es.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new _r({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=Or(es.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new _r({programId:this.programId,keys:n,data:e})}}rs.programId=new Xn("AddressLookupTab1e1111111111111111111111111");class is{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u8("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(os))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=Dr(os.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=Dr(os.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=Dr(os.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=Dr(os.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(ss.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const os=Object.freeze({RequestUnits:{index:0,layout:me.struct([me.u8("instruction"),me.u32("units"),me.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:me.struct([me.u8("instruction"),me.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:me.struct([me.u8("instruction"),me.u32("units")])},SetComputeUnitPrice:{index:3,layout:me.struct([me.u8("instruction"),jr("microLamports")])}});class ss{constructor(){}static requestUnits(t){const e=Or(os.RequestUnits,t);return new _r({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=Or(os.RequestHeapFrame,t);return new _r({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=Or(os.SetComputeUnitLimit,t);return new _r({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=Or(os.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new _r({keys:[],programId:this.programId,data:e})}}ss.programId=new Xn("ComputeBudget111111111111111111111111111111");const as=me.struct([me.u8("numSignatures"),me.u8("padding"),me.u16("signatureOffset"),me.u16("signatureInstructionIndex"),me.u16("publicKeyOffset"),me.u16("publicKeyInstructionIndex"),me.u16("messageDataOffset"),me.u16("messageDataSize"),me.u16("messageInstructionIndex")]);class us{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:o}=t;fr(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),fr(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const s=as.span,a=s+e.length,u=a+r.length,c=i.Buffer.alloc(u+n.length),d=null==o?65535:o;return as.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,s),c.fill(r,a),c.fill(n,u),new _r({keys:[],programId:us.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;fr(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=ts.fromSecretKey(e),i=t.publicKey.toBytes(),o=Un(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}us.programId=new Xn("Ed25519SigVerify111111111111111111111111111"),On.utils.isValidPrivateKey;const cs=On.getPublicKey,ds=me.struct([me.u8("numSignatures"),me.u16("signatureOffset"),me.u8("signatureInstructionIndex"),me.u16("ethAddressOffset"),me.u8("ethAddressInstructionIndex"),me.u16("messageDataOffset"),me.u16("messageDataSize"),me.u8("messageInstructionIndex"),me.blob(20,"ethAddress"),me.blob(64,"signature"),me.u8("recoveryId")]);class ls{constructor(){}static publicKeyToEthAddress(t){fr(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return i.Buffer.from(hn(Yn(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return ls.createInstructionWithEthAddress({ethAddress:ls.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:o,instructionIndex:s=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?i.Buffer.from(e.substr(2),"hex"):i.Buffer.from(e,"hex"):e,fr(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,c=u+r.length+1,d=i.Buffer.alloc(ds.span+n.length);return ds.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:s,signature:Yn(r),ethAddress:Yn(a),recoveryId:o},d),d.fill(Yn(n),ds.span),new _r({keys:[],programId:ls.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;fr(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=Yn(e),o=cs(t,!1).slice(1),s=i.Buffer.from(hn(Yn(n))),[a,u]=((t,e)=>{const n=On.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(s,t);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var hs;ls.programId=new Xn("KeccakSecp256k11111111111111111111111111111");const fs=new Xn("StakeConfig11111111111111111111111111111111");class ps{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class ms{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}hs=ms,ms.default=new hs(0,0,Xn.default);class gs{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ys))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=Dr(ys.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new ps(new Xn(e.staker),new Xn(e.withdrawer)),lockup:new ms(n.unixTimestamp,n.epoch,new Xn(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),Dr(ys.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=Dr(ys.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Xn(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Dr(ys.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new Xn(i),newAuthorizedPubkey:new Xn(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Dr(ys.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Dr(ys.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Dr(ys.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Dr(ys.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(ws.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.lengthme.struct([ar("staker"),ar("withdrawer")],t))(),((t="lockup")=>me.struct([me.ns64("unixTimestamp"),me.ns64("epoch"),ar("custodian")],t))()])},Authorize:{index:1,layout:me.struct([me.u32("instruction"),ar("newAuthorized"),me.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:me.struct([me.u32("instruction")])},Split:{index:3,layout:me.struct([me.u32("instruction"),me.ns64("lamports")])},Withdraw:{index:4,layout:me.struct([me.u32("instruction"),me.ns64("lamports")])},Deactivate:{index:5,layout:me.struct([me.u32("instruction")])},Merge:{index:7,layout:me.struct([me.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:me.struct([me.u32("instruction"),ar("newAuthorized"),me.u32("stakeAuthorizationType"),cr("authoritySeed"),ar("authorityOwner")])}}),bs=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class ws{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||ms.default,o=Or(ys.Initialize,{authorized:{staker:Yn(n.staker.toBuffer()),withdrawer:Yn(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Yn(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Er,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new _r(s)}static createAccountWithSeed(t){const e=new vr;e.add(Wr.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new vr;e.add(Wr.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=Or(ys.Delegate);return(new vr).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:Lr,isSigner:!1,isWritable:!1},{pubkey:fs,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=Or(ys.Authorize,{newAuthorized:Yn(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new vr).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=Or(ys.AuthorizeWithSeed,{newAuthorized:Yn(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:Yn(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:Ar,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new vr).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=Or(ys.Split,{lamports:i});return new _r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new vr;return e.add(Wr.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:s}=t,a=new vr;return a.add(Wr.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),a.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:s}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=Or(ys.Merge);return(new vr).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:Lr,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=Or(ys.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:Lr,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new vr).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=Or(ys.Deactivate);return(new vr).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}ws.programId=new Xn("Stake11111111111111111111111111111111111111"),ws.space=200;class _s{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}class vs{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=me.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ks))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=Dr(ks.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new _s(new Xn(e.nodePubkey),new Xn(e.authorizedVoter),new Xn(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=Dr(ks.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Xn(e),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:e,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Dr(ks.AuthorizeWithSeed,t.data);return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new Xn(e),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new Xn(r),voteAuthorizationType:{index:i},votePubkey:t.keys[0].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Dr(ks.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(As.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.lengthme.struct([ar("nodePubkey"),ar("authorizedVoter"),ar("authorizedWithdrawer"),me.u8("commission")],t))()])},Authorize:{index:1,layout:me.struct([me.u32("instruction"),ar("newAuthorized"),me.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:me.struct([me.u32("instruction"),me.ns64("lamports")])},AuthorizeWithSeed:{index:10,layout:me.struct([me.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>me.struct([me.u32("voteAuthorizationType"),ar("currentAuthorityDerivedKeyOwnerPubkey"),cr("currentAuthorityDerivedKeySeed"),ar("newAuthorized")],t))()])}}),Ms=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class As{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=Or(ks.InitializeAccount,{voteInit:{nodePubkey:Yn(r.nodePubkey.toBuffer()),authorizedVoter:Yn(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Yn(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Er,isSigner:!1,isWritable:!1},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new _r(o)}static createAccount(t){const e=new vr;return e.add(Wr.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=Or(ks.Authorize,{newAuthorized:Yn(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new vr).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=Or(ks.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Yn(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Yn(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new vr).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=Or(ks.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new vr).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return As.withdraw(t)}}As.programId=new Xn("Vote111111111111111111111111111111111111111"),As.space=3731;const Ss=new Xn("Va1idator1nfo111111111111111111111111111111"),Is=ze({name:Ce(),website:Oe(Ce()),details:Oe(Ce()),keybaseUsername:Oe(Ce())});class xs{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==lr(e))return null;const n=[];for(let t=0;t<2;t++){const t=new Xn(e.slice(0,Gn));e=e.slice(Gn);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(Ss)&&n[1].isSigner){const t=cr().decode(i.Buffer.from(e)),r=JSON.parse(t);return Ae(r,Is),new xs(n[1].publicKey,r)}return null}}const Es=new Xn("Vote111111111111111111111111111111111111111"),Ts=me.struct([ar("nodePubkey"),ar("authorizedWithdrawer"),me.u8("commission"),me.nu64(),me.seq(me.struct([me.nu64("slot"),me.u32("confirmationCount")]),me.offset(me.u32(),-8),"votes"),me.u8("rootSlotValid"),me.nu64("rootSlot"),me.nu64(),me.seq(me.struct([me.nu64("epoch"),ar("authorizedVoter")]),me.offset(me.u32(),-8),"authorizedVoters"),me.struct([me.seq(me.struct([ar("authorizedPubkey"),me.nu64("epochOfLastAuthorizedSwitch"),me.nu64("targetEpoch")]),32,"buf"),me.nu64("idx"),me.u8("isEmpty")],"priorVoters"),me.nu64(),me.seq(me.struct([me.nu64("epoch"),me.nu64("credits"),me.nu64("prevCredits")]),me.offset(me.u32(),-8),"epochCredits"),me.struct([me.nu64("slot"),me.nu64("timestamp")],"lastTimestamp")]);class Ps{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=Ts.decode(Yn(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Ps({nodePubkey:new Xn(e.nodePubkey),authorizedWithdrawer:new Xn(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(Bs),priorVoters:$s(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function Bs({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new Xn(t)}}function Ls({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new Xn(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function $s({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(Ls),...t.slice(0,e).map(Ls)]}const Rs={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Os(t,e){const n=!1===e?"http":"https";if(!t)return Rs[n].devnet;const r=Rs[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r}async function Ds(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await t.sendRawTransaction(e,s),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(a,u),d=(await c).value;if(d.err)throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`);return a}const Cs=1e9},80158:(t,e,n)=>{"use strict";var r=n(48764).Buffer,i=n(64836);e.Z=void 0;var o=i(n(64687)),s=i(n(17156)),a=i(n(18698)),u=i(n(56690)),c=i(n(89728)),d=i(n(61655)),l=i(n(94993)),h=i(n(73808)),f=n(26729),p=n(52742);var m=function(t){(0,d.default)(b,t);var e,n,i,f,m,g,y=(m=b,g=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=(0,h.default)(m);if(g){var n=(0,h.default)(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return(0,l.default)(this,t)});function b(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;(0,u.default)(this,b);var s=r.autoconnect,a=void 0===s||s,c=r.reconnect,d=void 0===c||c,l=r.reconnect_interval,h=void 0===l?1e3:l,f=r.max_reconnects,m=void 0===f?5:f,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);in.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),b}(f.EventEmitter);e.Z=m},16916:(t,e,n)=>{"use strict";var r=n(64836);e.Z=function(t,e){return new c(t,e)};var i=r(n(56690)),o=r(n(89728)),s=r(n(61655)),a=r(n(94993)),u=r(n(73808));var c=function(t){(0,s.default)(c,t);var e,n,r=(e=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=(0,u.default)(e);if(n){var i=(0,u.default)(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return(0,a.default)(this,t)});function c(t,e,n){var o;return(0,i.default)(this,c),(o=r.call(this)).socket=new window.WebSocket(t,n),o.socket.onopen=function(){return o.emit("open")},o.socket.onmessage=function(t){return o.emit("message",t.data)},o.socket.onerror=function(t){return o.emit("error",t)},o.socket.onclose=function(t){o.emit("close",t.code,t.reason)},o}return(0,o.default)(c,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),c}(n(26729).EventEmitter)},52742:(t,e,n)=>{"use strict";var r=n(64836);Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDataPack=void 0,e.createError=function(t,e){var n={code:t,message:s.get(t)||"Internal Server Error"};return e&&(n.data=e),n};var i=r(n(56690)),o=r(n(89728)),s=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),a=function(){function t(){(0,i.default)(this,t)}return(0,o.default)(t,[{key:"encode",value:function(t){return JSON.stringify(t)}},{key:"decode",value:function(t){return JSON.parse(t)}}]),t}();e.DefaultDataPack=a},27320:(t,e)=>{"use strict";function n(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function r(t){if("boolean"!=typeof t)throw new Error(`boolean expected, not ${t}`)}function i(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}function o(t,...e){if(!i(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function s(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");n(t.outputLen),n(t.blockLen)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){o(t);const n=e.outputLen;if(t.length{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HashMD=e.Maj=e.Chi=void 0;const r=n(27320),i=n(98089);e.Chi=(t,e,n)=>t&e^~t&n,e.Maj=(t,e,n)=>t&e^t&n^e&n;class o extends i.Hash{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.createView)(this.buffer)}update(t){(0,r.exists)(this);const{view:e,buffer:n,blockLen:o}=this,s=(t=(0,i.toBytes)(t)).length;for(let r=0;ro-a&&(this.process(n,0),a=0);for(let t=a;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,o-8,BigInt(8*this.length),s),this.process(n,0);const u=(0,i.createView)(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,l=this.get();if(d>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},23061:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const r=n(75457),i=n(98089),o=new Uint32Array([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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class u extends r.HashMD{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)a[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=a[t-15],n=a[t-2],r=(0,i.rotr)(e,7)^(0,i.rotr)(e,18)^e>>>3,o=(0,i.rotr)(n,17)^(0,i.rotr)(n,19)^n>>>10;a[t]=o+a[t-7]+r+a[t-16]|0}let{A:n,B:s,C:u,D:c,E:d,F:l,G:h,H:f}=this;for(let t=0;t<64;t++){const e=f+((0,i.rotr)(d,6)^(0,i.rotr)(d,11)^(0,i.rotr)(d,25))+(0,r.Chi)(d,l,h)+o[t]+a[t]|0,p=((0,i.rotr)(n,2)^(0,i.rotr)(n,13)^(0,i.rotr)(n,22))+(0,r.Maj)(n,s,u)|0;f=h,h=l,l=d,d=c+e|0,c=u,u=s,s=n,n=e+p|0}n=n+this.A|0,s=s+this.B|0,u=u+this.C|0,c=c+this.D|0,d=d+this.E|0,l=l+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(n,s,u,c,d,l,h,f)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class c extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}e.sha256=(0,i.wrapConstructor)((()=>new u)),e.sha224=(0,i.wrapConstructor)((()=>new c))},98089:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const r=n(31945),i=n(27320);e.isBytes=function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name},e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),e.rotr=(t,e)=>t<<32-e|t>>>e,e.rotl=(t,e)=>t<>>32-e>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.byteSwap=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,e.byteSwapIfBE=e.isLE?t=>t:t=>(0,e.byteSwap)(t),e.byteSwap32=function(t){for(let n=0;ne.toString(16).padStart(2,"0")));e.bytesToHex=function(t){(0,i.bytes)(t);let e="";for(let n=0;n=s&&t<=a?t-s:t>=u&&t<=c?t-(u-10):t>=d&&t<=l?t-(d-10):void 0}function f(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function p(t){return"string"==typeof t&&(t=f(t)),(0,i.bytes)(t),t}e.hexToBytes=function(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e{},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o=0&&tt().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e},e.wrapXOFConstructorWithOpts=function(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(r.crypto&&"function"==typeof r.crypto.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}},71794:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.constructRemoveRewardsIx=e.constructSetEmissionsPerSecondIx=e.constructHarvestIx=e.constructRevertTokensIx=e.constructConvertTokensIx=e.constructInitUserFarmIx=e.constructInitGlobalFarmIx=e.getUserFarmAddress=e.fetchUserFarms=e.fetchGlobalFarms=e.UserFarm=e.GlobalFarm=e.Aquafarm=void 0;const a=s(n(19359));e.Aquafarm=a.default;const u=s(n(20880));e.GlobalFarm=u.default;const c=o(n(64097));e.UserFarm=c.default,Object.defineProperty(e,"getUserFarmAddress",{enumerable:!0,get:function(){return c.getUserFarmAddress}});const d=n(87990);Object.defineProperty(e,"fetchGlobalFarms",{enumerable:!0,get:function(){return d.fetchGlobalFarms}}),Object.defineProperty(e,"fetchUserFarms",{enumerable:!0,get:function(){return d.fetchUserFarms}});const l=n(59968);Object.defineProperty(e,"constructInitGlobalFarmIx",{enumerable:!0,get:function(){return l.constructInitGlobalFarmIx}}),Object.defineProperty(e,"constructInitUserFarmIx",{enumerable:!0,get:function(){return l.constructInitUserFarmIx}}),Object.defineProperty(e,"constructConvertTokensIx",{enumerable:!0,get:function(){return l.constructConvertTokensIx}}),Object.defineProperty(e,"constructRevertTokensIx",{enumerable:!0,get:function(){return l.constructRevertTokensIx}}),Object.defineProperty(e,"constructHarvestIx",{enumerable:!0,get:function(){return l.constructHarvestIx}}),Object.defineProperty(e,"constructSetEmissionsPerSecondIx",{enumerable:!0,get:function(){return l.constructSetEmissionsPerSecondIx}}),Object.defineProperty(e,"constructRemoveRewardsIx",{enumerable:!0,get:function(){return l.constructRemoveRewardsIx}})},59968:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.constructRemoveRewardsIx=e.constructSetEmissionsPerSecondIx=e.constructHarvestIx=e.constructRevertTokensIx=e.constructConvertTokensIx=e.constructInitUserFarmIx=e.constructInitGlobalFarmIx=e.INSTRUCTIONS=void 0;const i=n(86664),o=n(52454),s=n(61401),a=r(n(20698));var u;!function(t){t[t.InitGlobalFarm=0]="InitGlobalFarm",t[t.InitUserFarm=1]="InitUserFarm",t[t.ConvertTokens=2]="ConvertTokens",t[t.RevertTokens=3]="RevertTokens",t[t.Harvest=4]="Harvest",t[t.RemoveRewards=5]="RemoveRewards",t[t.SetEmissionsPerSecond=6]="SetEmissionsPerSecond"}(u=e.INSTRUCTIONS||(e.INSTRUCTIONS={})),e.constructInitGlobalFarmIx=function(t,e,n,r,a,c,d,l,h,f,p,m){const g=[{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:m,isSigner:!0,isWritable:!1},{pubkey:o.SystemProgram.programId,isSigner:!1,isWritable:!1}];return new o.TransactionInstruction({keys:g,programId:p,data:s.generateBufferData(s.INIT_GLOBAL_FARM_DATA_LAYOUT,{instruction:u.InitGlobalFarm,nonce:f,tokenProgramId:i.TOKEN_PROGRAM_ID.toBuffer(),emissionsAuthority:c.toBuffer(),removeRewardsAuthority:d.toBuffer(),emissionsPerSecondNumerator:l.toBuffer(),emissionsPerSecondDenominator:h.toBuffer()})})},e.constructInitUserFarmIx=function(t,e,n,r){const i=[{pubkey:t,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:o.SystemProgram.programId,isSigner:!1,isWritable:!1}];return new o.TransactionInstruction({keys:i,programId:r,data:s.generateBufferData(s.INIT_USER_FARM_DATA_LAYOUT,{instruction:u.InitUserFarm})})},e.constructConvertTokensIx=function(t,e,n,r,c,d,l,h,f,p,m,g,y){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!0,isWritable:!1},{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:m,isSigner:!1,isWritable:!1},{pubkey:i.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1}],programId:g,data:s.generateBufferData(a.default.struct([a.default.u8("instruction"),s.uint64("amountToConvert")]),{instruction:u.ConvertTokens,amountToConvert:y.toBuffer()})})},e.constructRevertTokensIx=function(t,e,n,r,c,d,l,h,f,p,m,g,y){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!0,isWritable:!1},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:m,isSigner:!1,isWritable:!1},{pubkey:i.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1}],programId:g,data:s.generateBufferData(a.default.struct([a.default.u8("instruction"),s.uint64("amountToRevert")]),{instruction:u.RevertTokens,amountToRevert:y.toBuffer()})})},e.constructHarvestIx=function(t,e,n,r,c,d,l,h){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:l,isSigner:!1,isWritable:!1},{pubkey:i.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1}],programId:h,data:s.generateBufferData(a.default.struct([a.default.u8("instruction")]),{instruction:u.Harvest})})},e.constructSetEmissionsPerSecondIx=function(t,e,n,r,i,c){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!0,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],programId:r,data:s.generateBufferData(a.default.struct([a.default.u8("instruction"),s.uint64("emissionsPerSecondNumerator"),s.uint64("emissionsPerSecondDenominator")]),{instruction:u.SetEmissionsPerSecond,emissionsPerSecondNumerator:s.u64ToBuffer(i),emissionsPerSecondDenominator:s.u64ToBuffer(c)})})},e.constructRemoveRewardsIx=function(t,e,n,r,c,d,l){return new o.TransactionInstruction({keys:[{pubkey:t,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:i.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1}],programId:d,data:s.generateBufferData(a.default.struct([a.default.u8("instruction"),s.uint64("amountToRemove")]),{instruction:u.RemoveRewards,amountToRemove:l.toBuffer()})})}},19359:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=n(86664),o=r(n(93776)),s=n(71794),a=n(82657),u=n(59968);e.default=class{constructor(t,e,n){this.globalFarm=t,this.programId=e,this.userFarm=n}getEmissionsPer1000USDPerDay(t,e){return new o.default(this.globalFarm.emissionsPerSecondNumerator.toString()).mul(864e5).div(this.globalFarm.emissionsPerSecondDenominator.toString()).div(t).div(new o.default(10).pow(e))}getWeeklyEmissions(t){return new o.default(this.globalFarm.emissionsPerSecondNumerator.toString()).mul(604800).div(this.globalFarm.emissionsPerSecondDenominator.toString()).div(new o.default(10).pow(t))}getHarvestableAmount(){if(null===this.userFarm)return;const t=this.globalFarm.cumulativeEmissionsPerFarmToken.sub(this.userFarm.cumulativeEmissionsCheckpoint);return new i.u64(new o.default(this.userFarm.baseTokensConverted.toString()).mul(t).floor().toString())}getCurrentHarvestableAmount(t){const e=this.getHarvestableAmount();if(!e||this.globalFarm.emissionsPerSecondDenominator.eq(a.ZERO)||t.eq(a.ZERO))return e;const n=new i.u64(Date.now()/1e3).sub(this.globalFarm.lastUpdatedTimestamp);return this.globalFarm.emissionsPerSecondNumerator.mul(n).mul(this.userFarm.baseTokensConverted).div(this.globalFarm.emissionsPerSecondDenominator).div(t).add(e)}isUserFarmInitialized(){var t;return(null===(t=this.userFarm)||void 0===t?void 0:t.isInitialized)||!1}constructInitUserFarmIx(t,e){return u.constructInitUserFarmIx(this.globalFarm.publicKey,e,t,this.programId)}constructConvertTokensIx(t,e,n,r,i,o,s){var a,c;const d=(null===(a=this.userFarm)||void 0===a?void 0:a.owner)||s;return o=(null===(c=this.userFarm)||void 0===c?void 0:c.publicKey)||o,d&&o?u.constructConvertTokensIx(d,t,e,n,r,this.globalFarm.baseTokenVault,this.globalFarm.farmTokenMint,this.globalFarm.publicKey,o,this.globalFarm.rewardTokenVault,this.globalFarm.authority,this.programId,i):null}constructRevertTokensIx(t,e,n,r,i){return this.userFarm?s.constructRevertTokensIx(this.userFarm.owner,t,e,n,r,this.globalFarm.baseTokenVault,this.globalFarm.farmTokenMint,this.globalFarm.publicKey,this.userFarm.publicKey,this.globalFarm.rewardTokenVault,this.globalFarm.authority,this.programId,i):null}constructHarvestIx(t){return this.userFarm?u.constructHarvestIx(this.userFarm.owner,t,this.globalFarm.baseTokenVault,this.globalFarm.publicKey,this.userFarm.publicKey,this.globalFarm.rewardTokenVault,this.globalFarm.authority,this.programId):null}}},20880:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getGlobalFarmAddress=e.getAuthorityAndNonce=void 0;const i=n(52454),o=n(59968);e.default=class{constructor(t){this.publicKey=t.publicKey,this.isInitialized=t.isInitialized,this.tokenProgramId=t.publicKey,this.authority=t.authority,this.nonce=t.nonce,this.emissionsAuthority=t.emissionsAuthority,this.removeRewardsAuthority=t.removeRewardsAuthority,this.baseTokenMint=t.baseTokenMint,this.baseTokenVault=t.baseTokenVault,this.rewardTokenVault=t.rewardTokenVault,this.farmTokenMint=t.farmTokenMint,this.emissionsPerSecondNumerator=t.emissionsPerSecondNumerator,this.emissionsPerSecondDenominator=t.emissionsPerSecondDenominator,this.lastUpdatedTimestamp=t.lastUpdatedTimestamp,this.cumulativeEmissionsPerFarmToken=t.cumulativeEmissionsPerFarmToken}constructSetEmissionsPerSecondIx(t,e,n){return o.constructSetEmissionsPerSecondIx(this.emissionsAuthority,this.publicKey,this.baseTokenVault,n,t,e)}toString(){return JSON.stringify({publicKey:this.publicKey.toBase58(),isInitialized:this.isInitialized,authority:this.authority.toBase58(),nonce:this.nonce,tokenProgramId:this.tokenProgramId.toBase58(),emissionsAuthority:this.emissionsAuthority.toBase58(),removeRewardsAuthority:this.removeRewardsAuthority.toBase58(),baseTokenMint:this.baseTokenMint.toBase58(),baseTokenVault:this.baseTokenVault.toBase58(),rewardTokenVault:this.rewardTokenVault.toBase58(),farmTokenMint:this.farmTokenMint.toBase58(),emissionsPerSecondNumerator:this.emissionsPerSecondNumerator.toString(),emissionsPerSecondDenominator:this.emissionsPerSecondDenominator.toString(),lastUpdatedTimestamp:this.lastUpdatedTimestamp.toString(),cumulativeEmissionsPerFarmToken:this.cumulativeEmissionsPerFarmToken.toString()},null,2)}},e.getAuthorityAndNonce=function(t,e){return r(this,void 0,void 0,(function*(){return i.PublicKey.findProgramAddress([t.toBuffer()],e)}))},e.getGlobalFarmAddress=function(t,e,n,o,s){return r(this,void 0,void 0,(function*(){return i.PublicKey.findProgramAddress([t.toBuffer(),e.toBuffer(),n.toBuffer(),o.toBuffer()],s)}))}},64097:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getUserFarmAddress=void 0;const i=n(52454);e.default=class{constructor(t){this.publicKey=t.publicKey,this.isInitialized=t.isInitialized,this.owner=t.owner,this.baseTokensConverted=t.baseTokensConverted,this.cumulativeEmissionsCheckpoint=t.cumulativeEmissionsCheckpoint}toString(){return JSON.stringify({publicKey:this.publicKey.toBase58(),isInitialized:this.isInitialized,owner:this.owner.toBase58(),baseTokensConverted:this.baseTokensConverted.toString(),cumulativeEmissionsCheckpoint:this.cumulativeEmissionsCheckpoint.toString()},null,2)}},e.getUserFarmAddress=function(t,e,n,o){return r(this,void 0,void 0,(function*(){return i.PublicKey.findProgramAddress([t.toBuffer(),e.toBuffer(),n.toBuffer()],o)}))}},87990:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},u=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.fetchUserFarms=e.fetchGlobalFarms=e.fetchBatchedAccountInfos=void 0;const c=s(n(20880)),d=n(61401),l=u(n(64097)),h=n(64097),f=n(86664);function p(t,e){return a(this,void 0,void 0,(function*(){const n=e.map((e=>({methodName:"getAccountInfo",args:t._buildArgs([e.toBase58()],"singleGossip","jsonParsed")})));return(yield t._rpcBatchRequest(n)).map((t=>t.result.value?Object.assign({},t.result.value,{data:r.from(t.result.value.data[0],"base64")}):null))}))}e.fetchBatchedAccountInfos=p,e.fetchGlobalFarms=function(t,e,n){return a(this,void 0,void 0,(function*(){const r=yield p(t,e);return Promise.all(r.map(((t,r)=>a(this,void 0,void 0,(function*(){if(!t)throw new Error("GlobalFarm not found");const i=d.decodeGlobalFarmBuffer(t),o=e[r],s=(yield c.getAuthorityAndNonce(o,n))[0];return new c.default(Object.assign(Object.assign({},i),{publicKey:o,authority:s}))})))))}))},e.fetchUserFarms=function(t,e,n,r){return a(this,void 0,void 0,(function*(){const i=yield Promise.all(n.map((t=>a(this,void 0,void 0,(function*(){return(yield h.getUserFarmAddress(t,e,f.TOKEN_PROGRAM_ID,r))[0]})))));return(yield p(t,i)).map(((t,e)=>{if(!t)return null;const n=d.decodeUserFarmBuffer(t);return new l.default(Object.assign(Object.assign({},n),{publicKey:i[e]}))}))}))}},61401:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.INIT_USER_FARM_DATA_LAYOUT=e.USER_FARM_DATA_LAYOUT=e.decodeUserFarmBuffer=e.INIT_GLOBAL_FARM_DATA_LAYOUT=e.GLOBAL_FARM_DATA_LAYOUT=e.decodeGlobalFarmBuffer=e.generateBufferData=e.u64ToBuffer=e.uint256ToDecimal=e.uint256ToString=e.uint8ToU64=e.uint8ToNumber=e.uint8ToPubkey=e.uint256=e.uint64=e.publicKey=void 0;const o=n(52454),s=n(86664),a=i(n(20698)),u=i(n(13550)),c=i(n(93776));function d(t){return new o.PublicKey(t)}function l(t){return new s.u64(t,10,"le")}function h(t){return new c.default(new u.default(t,10,"le").toString()).dividedBy("1_000_000_000_000")}e.publicKey=(t="publicKey")=>a.default.blob(32,t),e.uint64=(t="uint64")=>a.default.blob(8,t),e.uint256=(t="uint256")=>a.default.blob(32,t),e.uint8ToPubkey=d,e.uint8ToNumber=function(t){return new u.default(t,10,"le").toNumber()},e.uint8ToU64=l,e.uint256ToString=function(t){return new u.default(t,10,"le").toString()},e.uint256ToDecimal=h,e.u64ToBuffer=function(t){return t.toBuffer("le",8)},e.generateBufferData=function(t,e){let n=r.alloc(t.span);{const r=t.encode(e,n);n=n.slice(0,r)}return n},e.decodeGlobalFarmBuffer=function(t){const n=e.GLOBAL_FARM_DATA_LAYOUT.decode(t.data);return{isInitialized:!!n.isInitialized,accountType:n.accountType,nonce:n.nonce,tokenProgramId:d(n.tokenProgramId),emissionsAuthority:d(n.emissionsAuthority),removeRewardsAuthority:d(n.removeRewardsAuthority),baseTokenMint:d(n.baseTokenMint),baseTokenVault:d(n.baseTokenVault),rewardTokenVault:d(n.rewardTokenVault),farmTokenMint:d(n.farmTokenMint),emissionsPerSecondNumerator:l(n.emissionsPerSecondNumerator),emissionsPerSecondDenominator:l(n.emissionsPerSecondDenominator),lastUpdatedTimestamp:l(n.lastUpdatedTimestamp),cumulativeEmissionsPerFarmToken:h(n.cumulativeEmissionsPerFarmToken)}},e.GLOBAL_FARM_DATA_LAYOUT=a.default.struct([a.default.u8("isInitialized"),a.default.u8("accountType"),a.default.u8("nonce"),e.publicKey("tokenProgramId"),e.publicKey("emissionsAuthority"),e.publicKey("removeRewardsAuthority"),e.publicKey("baseTokenMint"),e.publicKey("baseTokenVault"),e.publicKey("rewardTokenVault"),e.publicKey("farmTokenMint"),e.uint64("emissionsPerSecondNumerator"),e.uint64("emissionsPerSecondDenominator"),e.uint64("lastUpdatedTimestamp"),e.uint256("cumulativeEmissionsPerFarmToken")]),e.INIT_GLOBAL_FARM_DATA_LAYOUT=a.default.struct([a.default.u8("instruction"),a.default.u8("nonce"),e.publicKey("tokenProgramId"),e.publicKey("emissionsAuthority"),e.publicKey("removeRewardsAuthority"),e.uint64("emissionsPerSecondNumerator"),e.uint64("emissionsPerSecondDenominator")]),e.decodeUserFarmBuffer=function(t){const n=e.USER_FARM_DATA_LAYOUT.decode(t.data);return{isInitialized:!!n.isInitialized,accountType:n.accountType,globalFarm:d(n.globalFarm),owner:d(n.owner),baseTokensConverted:l(n.baseTokensConverted),cumulativeEmissionsCheckpoint:h(n.cumulativeEmissionsCheckpoint)}},e.USER_FARM_DATA_LAYOUT=a.default.struct([a.default.u8("isInitialized"),a.default.u8("accountType"),e.publicKey("globalFarm"),e.publicKey("owner"),e.uint64("baseTokensConverted"),e.uint256("cumulativeEmissionsCheckpoint")]),e.INIT_USER_FARM_DATA_LAYOUT=a.default.struct([a.default.u8("instruction")])},82657:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ZERO=e.toU64WithDecimals=e.toBNWithDecimals=void 0;const r=n(86664);function i(t,e=9){const n=new r.u64(10).pow(new r.u64(e)),i=Math.floor(t),o=t%1,s=new r.u64(i).mul(n);if(!o)return s;const a=new r.u64(o.toString().substring(0,e).padEnd(e,"0"));return s.add(a)}e.toBNWithDecimals=i,e.toU64WithDecimals=function(t,e=9){const n=i(t,e);return new r.u64(n)},e.ZERO=new r.u64(0)},86664:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ASSOCIATED_TOKEN_PROGRAM_ID:()=>Kt,AccountLayout:()=>ee,MintLayout:()=>te,NATIVE_MINT:()=>Qt,TOKEN_PROGRAM_ID:()=>Ht,Token:()=>re,u64:()=>Zt});for(var r=n(64572),i=n(13550),o=n.n(i),s=n(52454),a={},u={byteLength:function(t){var e=p(t),n=e[0],r=e[1];return 3*(n+r)/4-r},toByteArray:function(t){var e,n,r=p(t),i=r[0],o=r[1],s=new l(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=d[t.charCodeAt(n)]<<2|d[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=d[t.charCodeAt(n)]<<10|d[t.charCodeAt(n+1)]<<4|d[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;sa?a:s+o));return 1===r?(e=t[n-1],i.push(c[e>>2]+c[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(c[e>>10]+c[e>>4&63]+c[e<<2&63]+"=")),i.join("")}},c=[],d=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0;f<64;++f)c[f]=h[f],d[h.charCodeAt(f)]=f;function p(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function m(t,e,n){for(var r,i,o=[],s=e;s>18&63]+c[i>>12&63]+c[i>>6&63]+c[63&i]);return o.join("")}d["-".charCodeAt(0)]=62,d["_".charCodeAt(0)]=63;var g={read:function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,d=-7,l=n?i-1:0,h=n?-1:1,f=t[e+l];for(l+=h,o=f&(1<<-d)-1,f>>=-d,d+=a;d>0;o=256*o+t[e+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+t[e+l],l+=h,d-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,d=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;t[n+f]=255&s,f+=p,s/=256,c-=8);t[n+f-p]|=128*m}};!function(t){const e=u,n=g,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return d(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|p(t,e);let r=o(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return h(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);const i=function(t){if(s.isBuffer(t)){const e=0|f(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?o(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function d(t){return c(t),o(t<0?0:0|f(t))}function l(t){const e=t.length<0?0:0|f(t.length),n=o(e);for(let r=0;r=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(i)return r?-1:K(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return T(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function I(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=x)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(e+=" ... "),""},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,i){if(G(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0);const u=Math.min(o,a),c=this.slice(r,i),d=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return k(this,t,e,n);case"base64":return M(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function $(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){Y(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function O(t,e,n,r,i){Y(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function C(t,e,r,i,o){return e=+e,r>>>=0,o||D(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function N(t,e,r,i,o){return e=+e,r>>>=0,o||D(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=J((function(t){F(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=J((function(t){F(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||L(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||$(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||$(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=J((function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=J((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);$(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);$(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=J((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=J((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return C(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return C(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return N(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function Y(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function F(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw F(t,n),new z.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=j(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function K(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}}(a);var y=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},b="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t};function w(t,e){var n={seen:[],stylize:v};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),S(e)?n.showHidden=e:e&&function(t,e){if(!e||!P(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]]}(n,e),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=_),k(n,t,n.depth)}function _(t,e){var n=w.styles[e];return n?"["+w.colors[n][0]+"m"+t+"["+w.colors[n][1]+"m":t}function v(t,e){return t}function k(t,e,n){if(t.customInspect&&e&&$(e.inspect)&&e.inspect!==w&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return x(r)||(r=k(t,r,n)),r}var i=function(t,e){if(E(e))return t.stylize("undefined","undefined");if(x(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return"number"==typeof e?t.stylize(""+e,"number"):S(e)?t.stylize(""+e,"boolean"):I(e)?t.stylize("null","null"):void 0}(t,e);if(i)return i;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),L(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return M(e);if(0===o.length){if($(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(T(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(B(e))return t.stylize(Date.prototype.toString.call(e),"date");if(L(e))return M(e)}var u,c,d="",l=!1,h=["{","}"];return u=e,Array.isArray(u)&&(l=!0,h=["[","]"]),$(e)&&(d=" [Function"+(e.name?": "+e.name:"")+"]"),T(e)&&(d=" "+RegExp.prototype.toString.call(e)),B(e)&&(d=" "+Date.prototype.toUTCString.call(e)),L(e)&&(d=" "+M(e)),0!==o.length||l&&0!=e.length?n<0?T(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=l?function(t,e,n,r,i){for(var o=[],s=0,a=e.length;s60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(c,d,h)):h[0]+d+h[1]}function M(t){return"["+Error.prototype.toString.call(t)+"]"}function A(t,e,n,r,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),D(r,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=I(n)?k(t,u.value,null):k(t,u.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function S(t){return"boolean"==typeof t}function I(t){return null===t}function x(t){return"string"==typeof t}function E(t){return void 0===t}function T(t){return P(t)&&"[object RegExp]"===O(t)}function P(t){return"object"==typeof t&&null!==t}function B(t){return P(t)&&"[object Date]"===O(t)}function L(t){return P(t)&&("[object Error]"===O(t)||t instanceof Error)}function $(t){return"function"==typeof t}function R(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function O(t){return Object.prototype.toString.call(t)}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function C(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}}function G(t,e){return"string"==typeof t?t.length=0;a--)if(u[a]!==c[a])return!1;for(a=u.length-1;a>=0;a--)if(!Q(t[s=u[a]],e[s],n,r))return!1;return!0}(t,e,n,r))}return n?t===e:t==e}function tt(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function et(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function nt(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&X(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!t&&i&&!n;if((!t&&L(i)&&o&&et(i,n)||s)&&X(i,n,"Got unwanted exception"+r),t&&i&&n&&!et(i,n)||!t&&i)throw i}H.AssertionError=V,b(V,Error),H.fail=X,H.ok=J,H.equal=function t(e,n,r){e!=n&&X(e,n,r,"==",t)},H.notEqual=function t(e,n,r){e==n&&X(e,n,r,"!=",t)},H.deepEqual=function t(e,n,r){Q(e,n,!1)||X(e,n,r,"deepEqual",t)},H.deepStrictEqual=function t(e,n,r){Q(e,n,!0)||X(e,n,r,"deepStrictEqual",t)},H.notDeepEqual=function t(e,n,r){Q(e,n,!1)&&X(e,n,r,"notDeepEqual",t)},H.notDeepStrictEqual=function t(e,n,r){Q(e,n,!0)&&X(e,n,r,"notDeepStrictEqual",t)},H.strictEqual=function t(e,n,r){e!==n&&X(e,n,r,"===",t)},H.notStrictEqual=function t(e,n,r){e===n&&X(e,n,r,"!==",t)},H.throws=function(t,e,n){nt(!0,t,e,n)},H.doesNotThrow=function(t,e,n){nt(!1,t,e,n)},H.ifError=function(t){if(t)throw t};var rt={};class it{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function ot(t,e){return e.property?t+"["+e.property+"]":t}rt.Layout=it,rt.nameWithProperty=ot,rt.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof it))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class st extends it{isCount(){throw new Error("ExternalLayout is abstract")}}class at extends st{constructor(t,e){if(void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class ut extends st{constructor(t,e,n){if(!(t instanceof it))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof ct||this.layout instanceof dt}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class ct extends it{constructor(t,e){if(super(t,e),6t+r.encode(i,e,n+t)),0);return this.count instanceof st&&this.count.encode(t.length,e,n),i}}class St extends it{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof it),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class It{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class xt extends It{constructor(t,e){if(!(t instanceof st&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class Et extends it{constructor(t,e,n){const r=t instanceof ct||t instanceof dt;if(r)t=new xt(new ut(t));else if(t instanceof st&&t.isCount())t=new xt(t);else if(!(t instanceof It))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof it))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new Tt(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return a.Buffer.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Tt extends it{constructor(t,e,n,r){if(!(t instanceof Et))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof it))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Pt(t){return 0>t&&(t+=4294967296),t}class Bt extends it{constructor(t,e,n){if(!(t instanceof ct||t instanceof dt))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Pt(t&this.valueMask))throw new TypeError(ot("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Pt(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof st&&(r=t.length),!a.Buffer.isBuffer(t)||r!==t.length)throw new TypeError(ot("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof st&&this.length.encode(r,e,n),r}}class Ot extends it{constructor(t){super(-1,t)}getSpan(t,e){if(!a.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}class Dt extends it{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!a.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}class Ct extends it{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}rt.ExternalLayout=st,rt.GreedyCount=at,rt.OffsetLayout=ut,rt.UInt=ct,rt.UIntBE=dt,rt.Int=lt,rt.IntBE=ht,rt.Float=_t,rt.FloatBE=vt,rt.Double=kt,rt.DoubleBE=Mt,rt.Sequence=At,rt.Structure=St,rt.UnionDiscriminator=It,rt.UnionLayoutDiscriminator=xt,rt.Union=Et,rt.VariantLayout=Tt,rt.BitStructure=Bt,rt.BitField=Lt,rt.Boolean=$t,rt.Blob=Rt,rt.CString=Ot,rt.UTF8=Dt,rt.Constant=Ct,rt.greedy=(t,e)=>new at(t,e),rt.offset=(t,e,n)=>new ut(t,e,n);var Nt=rt.u8=t=>new ct(1,t);rt.u16=t=>new ct(2,t),rt.u24=t=>new ct(3,t);var zt=rt.u32=t=>new ct(4,t);rt.u40=t=>new ct(5,t),rt.u48=t=>new ct(6,t),rt.nu64=t=>new gt(t),rt.u16be=t=>new dt(2,t),rt.u24be=t=>new dt(3,t),rt.u32be=t=>new dt(4,t),rt.u40be=t=>new dt(5,t),rt.u48be=t=>new dt(6,t),rt.nu64be=t=>new yt(t),rt.s8=t=>new lt(1,t),rt.s16=t=>new lt(2,t),rt.s24=t=>new lt(3,t),rt.s32=t=>new lt(4,t),rt.s40=t=>new lt(5,t),rt.s48=t=>new lt(6,t),rt.ns64=t=>new bt(t),rt.s16be=t=>new ht(2,t),rt.s24be=t=>new ht(3,t),rt.s32be=t=>new ht(4,t),rt.s40be=t=>new ht(5,t),rt.s48be=t=>new ht(6,t),rt.ns64be=t=>new wt(t),rt.f32=t=>new _t(t),rt.f32be=t=>new vt(t),rt.f64=t=>new kt(t),rt.f64be=t=>new Mt(t);var Ut=rt.struct=(t,e,n)=>new St(t,e,n);rt.bits=(t,e,n)=>new Bt(t,e,n),rt.seq=(t,e,n)=>new At(t,e,n),rt.union=(t,e,n)=>new Et(t,e,n),rt.unionLayoutDiscriminator=(t,e)=>new xt(t,e);var jt=rt.blob=(t,e)=>new Rt(t,e);rt.cstr=t=>new Ot(t),rt.utf8=(t,e)=>new Dt(t,e),rt.const=(t,e)=>new Ct(t,e);const Yt=(t="publicKey")=>jt(32,t),Ft=(t="uint64")=>jt(8,t);function Wt(t,e,n,...r){return(0,s.sendAndConfirmTransaction)(e,n,r,{skipPreflight:!1})}const Ht=new s.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Kt=new s.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),qt="Failed to find account",Vt="Invalid account owner";function Gt(t){return a.Buffer.from(t.toBuffer())}class Zt extends(o()){toBuffer(){const t=super.toArray().reverse(),e=a.Buffer.from(t);if(8===e.length)return e;H(e.length<8,"u64 too large");const n=a.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){return H(8===t.length,`Invalid buffer length: ${t.length}`),new Zt([...t].reverse().map((t=>`00${t.toString(16)}`.slice(-2))).join(""),16)}}function Xt(t){return"publicKey"in t}const Jt={MintTokens:0,FreezeAccount:1,AccountOwner:2,CloseAccount:3},Qt=new s.PublicKey("So11111111111111111111111111111111111111112"),te=Ut([zt("mintAuthorityOption"),Yt("mintAuthority"),Ft("supply"),Nt("decimals"),Nt("isInitialized"),zt("freezeAuthorityOption"),Yt("freezeAuthority")]),ee=Ut([Yt("mint"),Yt("owner"),Ft("amount"),zt("delegateOption"),Yt("delegate"),Nt("state"),zt("isNativeOption"),Ft("isNative"),Ft("delegatedAmount"),zt("closeAuthorityOption"),Yt("closeAuthority")]),ne=Ut([Nt("m"),Nt("n"),Nt("is_initialized"),Yt("signer1"),Yt("signer2"),Yt("signer3"),Yt("signer4"),Yt("signer5"),Yt("signer6"),Yt("signer7"),Yt("signer8"),Yt("signer9"),Yt("signer10"),Yt("signer11")]);class re{constructor(t,e,n,i){(0,r.Z)(this,"connection",void 0),(0,r.Z)(this,"publicKey",void 0),(0,r.Z)(this,"programId",void 0),(0,r.Z)(this,"associatedProgramId",void 0),(0,r.Z)(this,"payer",void 0),Object.assign(this,{connection:t,publicKey:e,programId:n,payer:i,associatedProgramId:Kt})}static async getMinBalanceRentForExemptMint(t){return await t.getMinimumBalanceForRentExemption(te.span)}static async getMinBalanceRentForExemptAccount(t){return await t.getMinimumBalanceForRentExemption(ee.span)}static async getMinBalanceRentForExemptMultisig(t){return await t.getMinimumBalanceForRentExemption(ne.span)}static async createMint(t,e,n,r,i,o){const a=s.Keypair.generate(),u=new re(t,a.publicKey,o,e),c=await re.getMinBalanceRentForExemptMint(t),d=new s.Transaction;return d.add(s.SystemProgram.createAccount({fromPubkey:e.publicKey,newAccountPubkey:a.publicKey,lamports:c,space:te.span,programId:o})),d.add(re.createInitMintInstruction(o,a.publicKey,i,n,r)),await Wt(0,t,d,e,a),u}async createAccount(t){const e=await re.getMinBalanceRentForExemptAccount(this.connection),n=s.Keypair.generate(),r=new s.Transaction;r.add(s.SystemProgram.createAccount({fromPubkey:this.payer.publicKey,newAccountPubkey:n.publicKey,lamports:e,space:ee.span,programId:this.programId}));const i=this.publicKey;return r.add(re.createInitAccountInstruction(this.programId,i,n.publicKey,t)),await Wt(0,this.connection,r,this.payer,n),n.publicKey}async createAssociatedTokenAccount(t){const e=await re.getAssociatedTokenAddress(this.associatedProgramId,this.programId,this.publicKey,t);return this.createAssociatedTokenAccountInternal(t,e)}async createAssociatedTokenAccountInternal(t,e){return await Wt(0,this.connection,(new s.Transaction).add(re.createAssociatedTokenAccountInstruction(this.associatedProgramId,this.programId,this.publicKey,e,t,this.payer.publicKey)),this.payer),e}async getOrCreateAssociatedAccountInfo(t){const e=await re.getAssociatedTokenAddress(this.associatedProgramId,this.programId,this.publicKey,t);try{return await this.getAccountInfo(e)}catch(n){if(n.message===qt||n.message===Vt){try{await this.createAssociatedTokenAccountInternal(t,e)}catch(t){}return await this.getAccountInfo(e)}throw n}}static async createWrappedNativeAccount(t,e,n,r,i){const o=await re.getMinBalanceRentForExemptAccount(t),a=s.Keypair.generate(),u=new s.Transaction;return u.add(s.SystemProgram.createAccount({fromPubkey:r.publicKey,newAccountPubkey:a.publicKey,lamports:o,space:ee.span,programId:e})),u.add(s.SystemProgram.transfer({fromPubkey:r.publicKey,toPubkey:a.publicKey,lamports:i})),u.add(re.createInitAccountInstruction(e,Qt,a.publicKey,n)),await Wt(0,t,u,r,a),a.publicKey}async createMultisig(t,e){const n=s.Keypair.generate(),r=await re.getMinBalanceRentForExemptMultisig(this.connection),i=new s.Transaction;i.add(s.SystemProgram.createAccount({fromPubkey:this.payer.publicKey,newAccountPubkey:n.publicKey,lamports:r,space:ne.span,programId:this.programId}));let o=[{pubkey:n.publicKey,isSigner:!1,isWritable:!0},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];e.forEach((t=>o.push({pubkey:t,isSigner:!1,isWritable:!1})));const u=Ut([Nt("instruction"),Nt("m")]),c=a.Buffer.alloc(u.span);return u.encode({instruction:2,m:t},c),i.add({keys:o,programId:this.programId,data:c}),await Wt(0,this.connection,i,this.payer,n),n.publicKey}async getMintInfo(){const t=await this.connection.getAccountInfo(this.publicKey);if(null===t)throw new Error("Failed to find mint account");if(!t.owner.equals(this.programId))throw new Error(`Invalid mint owner: ${JSON.stringify(t.owner)}`);if(t.data.length!=te.span)throw new Error("Invalid mint size");const e=a.Buffer.from(t.data),n=te.decode(e);return 0===n.mintAuthorityOption?n.mintAuthority=null:n.mintAuthority=new s.PublicKey(n.mintAuthority),n.supply=Zt.fromBuffer(n.supply),n.isInitialized=0!=n.isInitialized,0===n.freezeAuthorityOption?n.freezeAuthority=null:n.freezeAuthority=new s.PublicKey(n.freezeAuthority),n}async getAccountInfo(t,e){const n=await this.connection.getAccountInfo(t,e);if(null===n)throw new Error(qt);if(!n.owner.equals(this.programId))throw new Error(Vt);if(n.data.length!=ee.span)throw new Error("Invalid account size");const r=a.Buffer.from(n.data),i=ee.decode(r);if(i.address=t,i.mint=new s.PublicKey(i.mint),i.owner=new s.PublicKey(i.owner),i.amount=Zt.fromBuffer(i.amount),0===i.delegateOption?(i.delegate=null,i.delegatedAmount=new Zt):(i.delegate=new s.PublicKey(i.delegate),i.delegatedAmount=Zt.fromBuffer(i.delegatedAmount)),i.isInitialized=0!==i.state,i.isFrozen=2===i.state,1===i.isNativeOption?(i.rentExemptReserve=Zt.fromBuffer(i.isNative),i.isNative=!0):(i.rentExemptReserve=null,i.isNative=!1),0===i.closeAuthorityOption?i.closeAuthority=null:i.closeAuthority=new s.PublicKey(i.closeAuthority),!i.mint.equals(this.publicKey))throw new Error(`Invalid account mint: ${JSON.stringify(i.mint)} !== ${JSON.stringify(this.publicKey)}`);return i}async getMultisigInfo(t){const e=await this.connection.getAccountInfo(t);if(null===e)throw new Error("Failed to find multisig");if(!e.owner.equals(this.programId))throw new Error("Invalid multisig owner");if(e.data.length!=ne.span)throw new Error("Invalid multisig size");const n=a.Buffer.from(e.data),r=ne.decode(n);return r.signer1=new s.PublicKey(r.signer1),r.signer2=new s.PublicKey(r.signer2),r.signer3=new s.PublicKey(r.signer3),r.signer4=new s.PublicKey(r.signer4),r.signer5=new s.PublicKey(r.signer5),r.signer6=new s.PublicKey(r.signer6),r.signer7=new s.PublicKey(r.signer7),r.signer8=new s.PublicKey(r.signer8),r.signer9=new s.PublicKey(r.signer9),r.signer10=new s.PublicKey(r.signer10),r.signer11=new s.PublicKey(r.signer11),r}async transfer(t,e,n,r,i){let o,a;return Xt(n)?(o=n.publicKey,a=[n]):(o=n,a=r),await Wt("Transfer",this.connection,(new s.Transaction).add(re.createTransferInstruction(this.programId,t,e,o,r,i)),this.payer,...a)}async approve(t,e,n,r,i){let o,a;Xt(n)?(o=n.publicKey,a=[n]):(o=n,a=r),await Wt("Approve",this.connection,(new s.Transaction).add(re.createApproveInstruction(this.programId,t,e,o,r,i)),this.payer,...a)}async revoke(t,e,n){let r,i;Xt(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await Wt("Revoke",this.connection,(new s.Transaction).add(re.createRevokeInstruction(this.programId,t,r,n)),this.payer,...i)}async setAuthority(t,e,n,r,i){let o,a;Xt(r)?(o=r.publicKey,a=[r]):(o=r,a=i),await Wt("SetAuthority",this.connection,(new s.Transaction).add(re.createSetAuthorityInstruction(this.programId,t,e,n,o,i)),this.payer,...a)}async mintTo(t,e,n,r){let i,o;Xt(e)?(i=e.publicKey,o=[e]):(i=e,o=n),await Wt("MintTo",this.connection,(new s.Transaction).add(re.createMintToInstruction(this.programId,this.publicKey,t,i,n,r)),this.payer,...o)}async burn(t,e,n,r){let i,o;Xt(e)?(i=e.publicKey,o=[e]):(i=e,o=n),await Wt("Burn",this.connection,(new s.Transaction).add(re.createBurnInstruction(this.programId,this.publicKey,t,i,n,r)),this.payer,...o)}async closeAccount(t,e,n,r){let i,o;Xt(n)?(i=n.publicKey,o=[n]):(i=n,o=r),await Wt("CloseAccount",this.connection,(new s.Transaction).add(re.createCloseAccountInstruction(this.programId,t,e,i,r)),this.payer,...o)}async freezeAccount(t,e,n){let r,i;Xt(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await Wt("FreezeAccount",this.connection,(new s.Transaction).add(re.createFreezeAccountInstruction(this.programId,t,this.publicKey,r,n)),this.payer,...i)}async thawAccount(t,e,n){let r,i;Xt(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await Wt("ThawAccount",this.connection,(new s.Transaction).add(re.createThawAccountInstruction(this.programId,t,this.publicKey,r,n)),this.payer,...i)}async transferChecked(t,e,n,r,i,o){let a,u;return Xt(n)?(a=n.publicKey,u=[n]):(a=n,u=r),await Wt("TransferChecked",this.connection,(new s.Transaction).add(re.createTransferCheckedInstruction(this.programId,t,this.publicKey,e,a,r,i,o)),this.payer,...u)}async approveChecked(t,e,n,r,i,o){let a,u;Xt(n)?(a=n.publicKey,u=[n]):(a=n,u=r),await Wt("ApproveChecked",this.connection,(new s.Transaction).add(re.createApproveCheckedInstruction(this.programId,t,this.publicKey,e,a,r,i,o)),this.payer,...u)}async mintToChecked(t,e,n,r,i){let o,a;Xt(e)?(o=e.publicKey,a=[e]):(o=e,a=n),await Wt("MintToChecked",this.connection,(new s.Transaction).add(re.createMintToCheckedInstruction(this.programId,this.publicKey,t,o,n,r,i)),this.payer,...a)}async burnChecked(t,e,n,r,i){let o,a;Xt(e)?(o=e.publicKey,a=[e]):(o=e,a=n),await Wt("BurnChecked",this.connection,(new s.Transaction).add(re.createBurnCheckedInstruction(this.programId,this.publicKey,t,o,n,r,i)),this.payer,...a)}async syncNative(t){await Wt(0,this.connection,(new s.Transaction).add(re.createSyncNativeInstruction(this.programId,t)),this.payer)}static createInitMintInstruction(t,e,n,r,i){let o=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];const u=Ut([Nt("instruction"),Nt("decimals"),Yt("mintAuthority"),Nt("option"),Yt("freezeAuthority")]);let c=a.Buffer.alloc(1024);{const t=u.encode({instruction:0,decimals:n,mintAuthority:Gt(r),option:null===i?0:1,freezeAuthority:Gt(i||new s.PublicKey(0))},c);c=c.slice(0,t)}return new s.TransactionInstruction({keys:o,programId:t,data:c})}static createInitAccountInstruction(t,e,n,r){const i=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],o=Ut([Nt("instruction")]),u=a.Buffer.alloc(o.span);return o.encode({instruction:1},u),new s.TransactionInstruction({keys:i,programId:t,data:u})}static createTransferInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Ft("amount")]),c=a.Buffer.alloc(u.span);u.encode({instruction:3,amount:new Zt(o).toBuffer()},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?d.push({pubkey:r,isSigner:!0,isWritable:!1}):(d.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createApproveInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Ft("amount")]),c=a.Buffer.alloc(u.span);u.encode({instruction:4,amount:new Zt(o).toBuffer()},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?d.push({pubkey:r,isSigner:!0,isWritable:!1}):(d.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createRevokeInstruction(t,e,n,r){const i=Ut([Nt("instruction")]),o=a.Buffer.alloc(i.span);i.encode({instruction:5},o);let u=[{pubkey:e,isSigner:!1,isWritable:!0}];return 0===r.length?u.push({pubkey:n,isSigner:!0,isWritable:!1}):(u.push({pubkey:n,isSigner:!1,isWritable:!1}),r.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:u,programId:t,data:o})}static createSetAuthorityInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Nt("authorityType"),Nt("option"),Yt("newAuthority")]);let c=a.Buffer.alloc(1024);{const t=u.encode({instruction:6,authorityType:Jt[r],option:null===n?0:1,newAuthority:Gt(n||new s.PublicKey(0))},c);c=c.slice(0,t)}let d=[{pubkey:e,isSigner:!1,isWritable:!0}];return 0===o.length?d.push({pubkey:i,isSigner:!0,isWritable:!1}):(d.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createMintToInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Ft("amount")]),c=a.Buffer.alloc(u.span);u.encode({instruction:7,amount:new Zt(o).toBuffer()},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?d.push({pubkey:r,isSigner:!0,isWritable:!1}):(d.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createBurnInstruction(t,e,n,r,i,o){const u=Ut([Nt("instruction"),Ft("amount")]),c=a.Buffer.alloc(u.span);u.encode({instruction:8,amount:new Zt(o).toBuffer()},c);let d=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}];return 0===i.length?d.push({pubkey:r,isSigner:!0,isWritable:!1}):(d.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:d,programId:t,data:c})}static createCloseAccountInstruction(t,e,n,r,i){const o=Ut([Nt("instruction")]),u=a.Buffer.alloc(o.span);o.encode({instruction:9},u);let c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:c,programId:t,data:u})}static createFreezeAccountInstruction(t,e,n,r,i){const o=Ut([Nt("instruction")]),u=a.Buffer.alloc(o.span);o.encode({instruction:10},u);let c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:c,programId:t,data:u})}static createThawAccountInstruction(t,e,n,r,i){const o=Ut([Nt("instruction")]),u=a.Buffer.alloc(o.span);o.encode({instruction:11},u);let c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:c,programId:t,data:u})}static createTransferCheckedInstruction(t,e,n,r,i,o,u,c){const d=Ut([Nt("instruction"),Ft("amount"),Nt("decimals")]),l=a.Buffer.alloc(d.span);d.encode({instruction:12,amount:new Zt(u).toBuffer(),decimals:c},l);let h=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!0}];return 0===o.length?h.push({pubkey:i,isSigner:!0,isWritable:!1}):(h.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>h.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:h,programId:t,data:l})}static createApproveCheckedInstruction(t,e,n,r,i,o,u,c){const d=Ut([Nt("instruction"),Ft("amount"),Nt("decimals")]),l=a.Buffer.alloc(d.span);d.encode({instruction:13,amount:new Zt(u).toBuffer(),decimals:c},l);let h=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1}];return 0===o.length?h.push({pubkey:i,isSigner:!0,isWritable:!1}):(h.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>h.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:h,programId:t,data:l})}static createMintToCheckedInstruction(t,e,n,r,i,o,u){const c=Ut([Nt("instruction"),Ft("amount"),Nt("decimals")]),d=a.Buffer.alloc(c.span);c.encode({instruction:14,amount:new Zt(o).toBuffer(),decimals:u},d);let l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?l.push({pubkey:r,isSigner:!0,isWritable:!1}):(l.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>l.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:l,programId:t,data:d})}static createBurnCheckedInstruction(t,e,n,r,i,o,u){const c=Ut([Nt("instruction"),Ft("amount"),Nt("decimals")]),d=a.Buffer.alloc(c.span);c.encode({instruction:15,amount:new Zt(o).toBuffer(),decimals:u},d);let l=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}];return 0===i.length?l.push({pubkey:r,isSigner:!0,isWritable:!1}):(l.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>l.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new s.TransactionInstruction({keys:l,programId:t,data:d})}static createSyncNativeInstruction(t,e){const n=Ut([Nt("instruction")]),r=a.Buffer.alloc(n.span);n.encode({instruction:17},r);let i=[{pubkey:e,isSigner:!1,isWritable:!0}];return new s.TransactionInstruction({keys:i,programId:t,data:r})}static async getAssociatedTokenAddress(t,e,n,r,i=!1){if(!i&&!s.PublicKey.isOnCurve(r.toBuffer()))throw new Error(`Owner cannot sign: ${r.toString()}`);return(await s.PublicKey.findProgramAddress([r.toBuffer(),e.toBuffer(),n.toBuffer()],t))[0]}static createAssociatedTokenAccountInstruction(t,e,n,r,i,o){const u=a.Buffer.alloc(0);let c=[{pubkey:o,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:s.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];return new s.TransactionInstruction({keys:c,programId:t,data:u})}}},52454:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Account:()=>Qe,AddressLookupTableAccount:()=>cr,AddressLookupTableInstruction:()=>so,AddressLookupTableProgram:()=>ao,Authorized:()=>wo,BLOCKHASH_CACHE_TIMEOUT_MS:()=>mr,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>tn,BPF_LOADER_PROGRAM_ID:()=>Gn,BpfLoader:()=>Zn,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>co,ComputeBudgetInstruction:()=>uo,ComputeBudgetProgram:()=>lo,Connection:()=>ro,Ed25519Program:()=>fo,Enum:()=>He,EpochSchedule:()=>rr,FeeCalculatorLayout:()=>zn,Keypair:()=>io,LAMPORTS_PER_SOL:()=>Yo,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>oo,Loader:()=>Vn,Lockup:()=>_o,MAX_SEED_LENGTH:()=>Ge,Message:()=>yn,MessageAccountKeys:()=>un,MessageV0:()=>bn,NONCE_ACCOUNT_LENGTH:()=>jn,NonceAccount:()=>Yn,PACKET_DATA_SIZE:()=>en,PUBLIC_KEY_LENGTH:()=>Ze,PublicKey:()=>Je,SIGNATURE_LENGTH_IN_BYTES:()=>rn,SOLANA_SCHEMA:()=>Ke,STAKE_CONFIG_ID:()=>bo,STAKE_INSTRUCTION_LAYOUTS:()=>ko,SYSTEM_INSTRUCTION_LAYOUTS:()=>Hn,SYSVAR_CLOCK_PUBKEY:()=>In,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>xn,SYSVAR_INSTRUCTIONS_PUBKEY:()=>En,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>Tn,SYSVAR_RENT_PUBKEY:()=>Pn,SYSVAR_REWARDS_PUBKEY:()=>Bn,SYSVAR_SLOT_HASHES_PUBKEY:()=>Ln,SYSVAR_SLOT_HISTORY_PUBKEY:()=>$n,SYSVAR_STAKE_HISTORY_PUBKEY:()=>Rn,Secp256k1Program:()=>go,SendTransactionError:()=>ir,SolanaJSONRPCError:()=>sr,SolanaJSONRPCErrorCode:()=>or,StakeAuthorizationLayout:()=>Mo,StakeInstruction:()=>vo,StakeProgram:()=>Ao,Struct:()=>We,SystemInstruction:()=>Wn,SystemProgram:()=>Kn,Transaction:()=>Mn,TransactionExpiredBlockheightExceededError:()=>on,TransactionExpiredNonceInvalidError:()=>an,TransactionExpiredTimeoutError:()=>sn,TransactionInstruction:()=>kn,TransactionMessage:()=>An,TransactionStatus:()=>_n,VALIDATOR_INFO_KEY:()=>Po,VERSION_PREFIX_MASK:()=>nn,VOTE_PROGRAM_ID:()=>$o,ValidatorInfo:()=>Lo,VersionedMessage:()=>wn,VersionedTransaction:()=>Sn,VoteAccount:()=>Oo,VoteAuthorizationLayout:()=>Eo,VoteInit:()=>So,VoteInstruction:()=>Io,VoteProgram:()=>To,clusterApiUrl:()=>Uo,sendAndConfirmRawTransaction:()=>jo,sendAndConfirmTransaction:()=>On});var r={};n.r(r),n.d(r,{dQ:()=>Z,ci:()=>z,bytesToNumberBE:()=>W,ty:()=>H,eV:()=>G,n$:()=>Q,ql:()=>V,hexToBytes:()=>F,_t:()=>C,tL:()=>K,S5:()=>q,FF:()=>et});var i=n(48764);function o(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function s(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){s(t);const n=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),h=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function f(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function p(t){if("string"==typeof t&&(t=f(t)),!d(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function m(...t){let e=0;for(let n=0;nt().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function b(t=32){if(c&&"function"==typeof c.getRandomValues)return c.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class w extends g{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=l(this.buffer)}update(t){a(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=p(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=l(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t>v&_)}:{h:0|Number(t>>v&_),l:0|Number(t&_)}}function M(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it<>>32-n,S=(t,e,n)=>e<>>32-n,I=(t,e,n)=>e<>>64-n,x=(t,e,n)=>t<>>64-n,E={fromBig:k,split:M,toBig:(t,e)=>BigInt(t>>>0)<>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:A,rotlSL:S,rotlBH:I,rotlBL:x,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[T,P]=(()=>E.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),B=new Uint32Array(80),L=new Uint32Array(80);class $ extends w{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)B[n]=t.getUint32(e),L[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|B[t-15],n=0|L[t-15],r=E.rotrSH(e,n,1)^E.rotrSH(e,n,8)^E.shrSH(e,n,7),i=E.rotrSL(e,n,1)^E.rotrSL(e,n,8)^E.shrSL(e,n,7),o=0|B[t-2],s=0|L[t-2],a=E.rotrSH(o,s,19)^E.rotrBH(o,s,61)^E.shrSH(o,s,6),u=E.rotrSL(o,s,19)^E.rotrBL(o,s,61)^E.shrSL(o,s,6),c=E.add4L(i,u,L[t-7],L[t-16]),d=E.add4H(c,r,a,B[t-7],B[t-16]);B[t]=0|d,L[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=E.rotrSH(d,l,14)^E.rotrSH(d,l,18)^E.rotrBH(d,l,41),b=E.rotrSL(d,l,14)^E.rotrSL(d,l,18)^E.rotrBL(d,l,41),w=d&h^~d&p,_=l&f^~l&m,v=E.add5L(y,b,_,P[t],L[t]),k=E.add5H(v,g,e,w,T[t],B[t]),M=0|v,A=E.rotrSH(n,r,28)^E.rotrBH(n,r,34)^E.rotrBH(n,r,39),S=E.rotrSL(n,r,28)^E.rotrBL(n,r,34)^E.rotrBL(n,r,39),I=n&i^n&s^i&s,x=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|d,f=0|l,({h:d,l}=E.add(0|u,0|c,0|k,0|M)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const $=E.add3L(M,S,x);n=E.add3H($,k,A,I),r=0|$}({h:n,l:r}=E.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=E.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=E.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=E.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=E.add(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=E.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=E.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=E.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y)}roundClean(){B.fill(0),L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const R=y((()=>new $)),O=(BigInt(0),BigInt(1)),D=BigInt(2);function C(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const N=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function z(t){if(!C(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n=j._0&&t<=j._9?t-j._0:t>=j._A&&t<=j._F?t-(j._A-10):t>=j._a&&t<=j._f?t-(j._a-10):void 0}function F(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(D<new Uint8Array(t),J=t=>Uint8Array.from(t);function Q(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=X(t),i=X(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=X())=>{i=a(J([0]),t),r=a(),0!==t.length&&(i=a(J([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const tt={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||C(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function et(t,e,n={}){const r=(e,n,r)=>{const i=tt[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const nt=BigInt(0),rt=BigInt(1),it=BigInt(2),ot=BigInt(3),st=BigInt(4),at=BigInt(5),ut=BigInt(8);function ct(t,e){const n=t%e;return n>=nt?n:e+n}function dt(t,e,n){if(n<=nt||e 0");if(n===rt)return nt;let r=rt;for(;e>nt;)e&rt&&(r=r*t%n),t=t*t%n,e>>=rt;return r}function lt(t,e,n){let r=t;for(;e-- >nt;)r*=r,r%=n;return r}function ht(t,e){if(t===nt||e<=nt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=ct(t,e),r=e,i=nt,o=rt,s=rt,a=nt;for(;n!==nt;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==rt)throw new Error("invert: does not exist");return ct(i,e)}BigInt(9),BigInt(16);const ft=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function mt(t,e,n=!1,r={}){if(t<=nt)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=pt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%st===ot){const e=(t+rt)/st;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%ut===at){const e=(t-at)/ut;return function(t,n){const r=t.mul(n,it),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,it),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-rt)/it;let n,r,i;for(n=t-rt,r=0;n%it===nt;n/=it,r++);for(i=it;ict(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return nt<=e&&et===nt,isOdd:t=>(t&rt)===rt,neg:e=>ct(-e,t),eql:(t,e)=>t===e,sqr:e=>ct(e*e,t),add:(e,n)=>ct(e+n,t),sub:(e,n)=>ct(e-n,t),mul:(e,n)=>ct(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===nt)return t.ONE;if(n===rt)return e;let r=t.ONE,i=e;for(;n>nt;)n&rt&&(r=t.mul(r,i)),i=t.sqr(i),n>>=rt;return r}(a,t,e),div:(e,n)=>ct(e*ht(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>ht(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?q(t,o):K(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?H(t):W(t)}});return Object.freeze(a)}function gt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function yt(t){const e=gt(t);return e+Math.ceil(e/2)}const bt=BigInt(0),wt=BigInt(1);function _t(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>bt;)n&wt&&(r=r.add(i)),i=i.double(),n>>=wt;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=wt);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function vt(t){return et(t.Fp,ft.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),et(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const kt=BigInt(0),Mt=BigInt(1),At=BigInt(2),St=BigInt(8),It={zip215:!0};function xt(t){const e=function(t){const e=vt(t);return et(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=At<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:kt}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&ktp(t)&&p(e)&&tt===kt||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===kt?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,Mt,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(At*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===kt)return this.double();const r=d(s*At*h),f=d(a*At*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===kt?M:this.equals(M)||e===Mt?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?St:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:kt,y:Mt};if(u!==Mt)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===Mt?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=V("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=H(a);h===kt||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-Mt),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&Mt)===Mt,_=0!=(128&u);if(!r&&b===kt&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return x(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=q(e,n.BYTES);return r[r.length-1]|=t&Mt?128:0,r}toHex(){return z(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,Mt,d(e.Gx*e.Gy)),v.ZERO=new v(kt,Mt,Mt,kt);const{BASE:k,ZERO:M}=v,A=_t(v,8*a);function S(t){return ct(t,r)}function I(t){return S(H(t))}function x(t){const e=a;t=V("private key",t,e);const n=V("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function E(t=new Uint8Array,...e){const n=G(...e);return I(o(f(n,V("context",t),!!i)))}const T=It;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return x(t).pointBytes},sign:function(t,e,r={}){t=V("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=x(e),c=E(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+E(r.context,d,u,t)*s);return b(l),V("result",G(d,q(l,n.BYTES)),2*a)},verify:function(t,e,r,o=T){const{context:s,zip215:a}=o,u=n.BYTES;t=V("signature",t,2*u),e=V("message",e),i&&(e=i(e));const c=H(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=E(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const Et=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Tt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Pt=(BigInt(0),BigInt(1)),Bt=BigInt(2),Lt=BigInt(5),$t=BigInt(10),Rt=BigInt(20),Ot=BigInt(40),Dt=BigInt(80);const Ct=mt(Et,void 0,!0),Nt={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ct,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:R,randomBytes:b,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=Et,r=ct(e*e*e,n),i=ct(r*r*e,n);let o=ct(t*r*function(t){const e=Et,n=t*t%e*t%e,r=lt(n,Bt,e)*n%e,i=lt(r,Pt,e)*t%e,o=lt(i,Lt,e)*i%e,s=lt(o,$t,e)*o%e,a=lt(s,Rt,e)*s%e,u=lt(a,Ot,e)*a%e,c=lt(u,Dt,e)*u%e,d=lt(c,Dt,e)*u%e,l=lt(d,$t,e)*o%e;return{pow_p_5_8:lt(l,Bt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=ct(e*o*o,n),a=o,u=ct(o*Tt,n),c=s===t,d=s===ct(-t,n),l=s===ct(-t*Tt,n);return c&&(o=a),(d||l)&&(o=u),(ct(o,n)&rt)===rt&&(o=ct(-o,n)),{isValid:c||d,value:o}}},zt=xt(Nt);const Ut=(Ct.ORDER+BigInt(3))/BigInt(8);Ct.pow(Bt,Ut),Ct.sqrt(Ct.neg(Ct.ONE)),Ct.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(Ct,Ct.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var jt=n(13550),Yt=n.n(jt),Ft=n(77191),Wt=n.n(Ft);const Ht=(t,e,n)=>t&e^t&n^e&n,Kt=new Uint32Array([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]),qt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Vt=new Uint32Array(64);class Gt extends w{constructor(){super(64,32,8,!1),this.A=0|qt[0],this.B=0|qt[1],this.C=0|qt[2],this.D=0|qt[3],this.E=0|qt[4],this.F=0|qt[5],this.G=0|qt[6],this.H=0|qt[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Vt[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Vt[t-15],n=Vt[t-2],r=h(e,7)^h(e,18)^e>>>3,i=h(n,17)^h(n,19)^n>>>10;Vt[t]=i+Vt[t-7]+r+Vt[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(h(s,6)^h(s,11)^h(s,25))+((d=s)&a^~d&u)+Kt[t]+Vt[t]|0,l=(h(n,2)^h(n,13)^h(n,22))+Ht(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){Vt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Zt=y((()=>new Gt));var Xt=n(25532),Jt=n(39386),Qt=n(40475),te=n(53471),ee=n(31198),ne=n.n(ee),re=n(64906),ie=n(55852);const[oe,se,ae]=[[],[],[]],ue=BigInt(0),ce=BigInt(1),de=BigInt(2),le=BigInt(7),he=BigInt(256),fe=BigInt(113);for(let t=0,e=ce,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],oe.push(2*(5*r+n)),se.push((t+1)*(t+2)/2%64);let i=ue;for(let t=0;t<7;t++)e=(e<>le)*fe)%he,e&de&&(i^=ce<<(ce<n>32?I(t,e,n):A(t,e,n),ye=(t,e,n)=>n>32?x(t,e,n):S(t,e,n);class be extends g{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,o(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=ge(o,s,1)^n[r],u=ye(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=se[n],o=ge(e,i,r),s=ye(e,i,r),a=oe[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=pe[r],t[1]^=me[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){a(this);const{blockLen:e,state:n}=this,r=(t=p(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return o(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(u(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new be(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const we=((t,e,n)=>y((()=>new be(e,t,n))))(1,136,32);class _e extends g{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(t.outputLen),o(t.blockLen)}(t);const n=p(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew _e(t,e).update(n).digest();ve.create=(t,e)=>new _e(t,e);const{bytesToNumberBE:ke,hexToBytes:Me}=r,Ae={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=Ae;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:ke(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Ae,n="string"==typeof t?Me(t):t;if(!C(n))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=Ae._parseInt(n.subarray(2)),{d:s,l:a}=Ae._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},Se=BigInt(0),Ie=BigInt(1),xe=(BigInt(2),BigInt(3));function Ee(t){const e=function(t){const e=vt(t);return et(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return ct(t,r)}function a(t){return ht(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=vt(t);et(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return G(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&Sen.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(V("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,xe),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,xe);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===Se)return r;if(a(t),t===Ie)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>Se||c>Se;)s&Ie&&(d=d.add(p)),c&Ie&&(h=h.add(p)),p=p.double(),s>>=Ie,c>>=Ie;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==Se&&e!==Ie&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Ie)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Ie?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return z(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=_t(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=G;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=W(s);if(!(Se<(a=t)&&az(K(t,e.nByteLength));function f(t){return t>r>>Ie}const p=(t,e,n)=>W(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=V("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=Ae.toSig(V("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(V("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return F(this.toDERHex())}toDERHex(){return Ae.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return F(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=yt(e.n);return function(t,e,n=!1){const r=t.length,i=gt(e),o=yt(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=ct(n?W(t):H(t),e-rt)+rt;return n?q(s,i):K(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=C(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=W(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=Z(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(Se<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return K(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=V("msgHash",t),p&&(t=V("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g){const t=!0===g?d(n.BYTES):g;M.push(V("extraEntropy",t))}const A=G(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===Se)return;const o=s(n*s(S+i*_));if(o===Se)return;let c=(r.x===i?0:2)|Number(r.y&Ie),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return Q(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=V("msgHash",n),r=V("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||C(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof Ae.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function Te(t){return{hash:t,hmac:(e,...n)=>ve(t,e,m(...n)),randomBytes:b}}BigInt(4);const Pe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Be=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Le=BigInt(1),$e=BigInt(2),Re=(t,e)=>(t+e/$e)/e;const Oe=mt(Pe,void 0,void 0,{sqrt:function(t){const e=Pe,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=lt(d,n,e)*d%e,h=lt(l,n,e)*d%e,f=lt(h,$e,e)*c%e,p=lt(f,i,e)*f%e,m=lt(p,o,e)*p%e,g=lt(m,a,e)*m%e,y=lt(g,u,e)*g%e,b=lt(y,a,e)*m%e,w=lt(b,n,e)*d%e,_=lt(w,s,e)*p%e,v=lt(_,r,e)*c%e,k=lt(v,$e,e);if(!Oe.eql(Oe.sqr(k),t))throw new Error("Cannot find square root");return k}}),De=function(t,e){const n=e=>Ee({...t,...Te(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Oe,n:Be,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Be,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Le*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=Re(o*t,e),u=Re(-r*t,e);let c=ct(t-a*n-u*i,e),d=ct(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},Zt);BigInt(0),De.ProjectivePoint;const Ce=zt.utils.randomPrivateKey,Ne=()=>{const t=zt.utils.randomPrivateKey(),e=ze(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},ze=zt.getPublicKey;function Ue(t){try{return zt.ExtendedPoint.fromHex(t),!0}catch{return!1}}const je=(t,e)=>zt.sign(t,e.slice(0,32)),Ye=zt.verify,Fe=t=>i.Buffer.isBuffer(t)?t:t instanceof Uint8Array?i.Buffer.from(t.buffer,t.byteOffset,t.byteLength):i.Buffer.from(t);class We{constructor(t){Object.assign(this,t)}encode(){return i.Buffer.from((0,Xt.serialize)(Ke,this))}static decode(t){return(0,Xt.deserialize)(Ke,this,t)}static decodeUnchecked(t){return(0,Xt.deserializeUnchecked)(Ke,this,t)}}class He extends We{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}}const Ke=new Map;var qe;let Ve;const Ge=32,Ze=32;let Xe=1;Ve=Symbol.toStringTag;class Je extends We{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Wt().decode(t);if(e.length!=Ze)throw new Error("Invalid public key input");this._bn=new(Yt())(e)}else this._bn=new(Yt())(t);if(this._bn.byteLength()>Ze)throw new Error("Invalid public key input")}}static unique(){const t=new Je(Xe);return Xe+=1,new Je(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Wt().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(i.Buffer);if(t.length===Ze)return t;const e=i.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Ve](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=i.Buffer.concat([t.toBuffer(),i.Buffer.from(e),n.toBuffer()]),o=Zt(r);return new Je(o)}static createProgramAddressSync(t,e){let n=i.Buffer.alloc(0);t.forEach((function(t){if(t.length>Ge)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Fe(t)])})),n=i.Buffer.concat([n,e.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=Zt(n);if(Ue(r))throw new Error("Invalid seeds, address must fall off the curve");return new Je(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const o=t.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return Ue(new Je(t).toBytes())}}qe=Je,Je.default=new qe("11111111111111111111111111111111"),Ke.set(Je,{kind:"struct",fields:[["_bn","u256"]]});class Qe{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=Fe(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Fe(Ce()),this._publicKey=Fe(ze(this._secretKey))}get publicKey(){return new Je(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const tn=new Je("BPFLoader1111111111111111111111111111111111"),en=1232,nn=127,rn=64;class on extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(on.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class sn extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(sn.prototype,"name",{value:"TransactionExpiredTimeoutError"});class an extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(an.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class un{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const cn=(t="publicKey")=>Jt.blob(32,t),dn=(t="signature")=>Jt.blob(64,t),ln=(t="string")=>{const e=Jt.struct([Jt.u32("length"),Jt.u32("lengthPadding"),Jt.blob(Jt.offset(Jt.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),o=e;return o.decode=(t,e)=>n(t,e).chars.toString(),o.encode=(t,e,n)=>{const o={chars:i.Buffer.from(t,"utf8")};return r(o,e,n)},o.alloc=t=>Jt.u32().span+Jt.u32().span+i.Buffer.from(t,"utf8").length,o};function hn(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return hn({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function fn(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function pn(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function mn(t,e){if(!t)throw new Error(e||"Assertion failed")}class gn{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new gn(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];mn(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{mn(e.length>0,"Expected at least one writable signer key");const[t]=e[0];mn(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Je(t))),...n.map((([t])=>new Je(t))),...r.map((([t])=>new Je(t))),...i.map((([t])=>new Je(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Je(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(mn(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}class yn{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Je(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Wt().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new un(this.staticAccountKeys)}static compile(t){const e=gn.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new un(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Wt().encode(t.data)})));return new yn({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];pn(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Wt().decode(t.data));let o=[];pn(o,e.length);let s=[];return pn(s,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:e,dataLength:i.Buffer.from(s),data:r}}));let r=[];pn(r,n.length);let o=i.Buffer.alloc(en);i.Buffer.from(r).copy(o);let s=r.length;n.forEach((t=>{const e=Jt.struct([Jt.u8("programIdIndex"),Jt.blob(t.keyIndicesCount.length,"keyIndicesCount"),Jt.seq(Jt.u8("keyIndex"),t.keyIndices.length,"keyIndices"),Jt.blob(t.dataLength.length,"dataLength"),Jt.seq(Jt.u8("userdatum"),t.data.length,"data")]).encode(t,o,s);s+=e})),o=o.slice(0,s);const a=Jt.struct([Jt.blob(1,"numRequiredSignatures"),Jt.blob(1,"numReadonlySignedAccounts"),Jt.blob(1,"numReadonlyUnsignedAccounts"),Jt.blob(e.length,"keyCount"),Jt.seq(cn("key"),t,"keys"),cn("recentBlockhash")]),u={numRequiredSignatures:i.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:i.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:i.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:i.Buffer.from(e),keys:this.accountKeys.map((t=>Fe(t.toBytes()))),recentBlockhash:Wt().decode(this.recentBlockhash)};let c=i.Buffer.alloc(2048);const d=a.encode(u,c);return o.copy(c,d),c.slice(0,d+o.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&nn))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=e.shift(),o=e.shift(),s=fn(e);let a=[];for(let t=0;t0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new un(this.staticAccountKeys,e)}isAccountSigner(t){return t=n?t-nt+e.writableIndexes.length),0):t>=this.header.numRequiredSignatures?t-et.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const t of n.writableIndexes){if(!(tt.toBytes())),recentBlockhash:Wt().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let t=0;const e=new Uint8Array(en);for(const n of this.compiledInstructions){const r=Array();pn(r,n.accountKeyIndexes.length);const i=Array();pn(i,n.data.length),t+=Jt.struct([Jt.u8("programIdIndex"),Jt.blob(r.length,"encodedAccountKeyIndexesLength"),Jt.seq(Jt.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),Jt.blob(i.length,"encodedDataLength"),Jt.blob(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(en);for(const n of this.addressTableLookups){const r=Array();pn(r,n.writableIndexes.length);const i=Array();pn(i,n.readonlyIndexes.length),t+=Jt.struct([cn("accountKey"),Jt.blob(r.length,"encodedWritableIndexesLength"),Jt.seq(Jt.u8(),n.writableIndexes.length,"writableIndexes"),Jt.blob(i.length,"encodedReadonlyIndexesLength"),Jt.seq(Jt.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),r=n&nn;mn(n!==r,"Expected versioned message but received legacy message"),mn(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},o=[],s=fn(e);for(let t=0;t{const e=wn.deserializeMessageVersion(t);if("legacy"===e)return yn.from(t);if(0===e)return bn.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let _n=function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t}({});const vn=i.Buffer.alloc(rn).fill(0);class kn{constructor(t){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class Mn{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new kn(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Je(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Wt().encode(e)}}));return f.forEach((t=>{mn(t.programIdIndex>=0),t.accounts.forEach((t=>mn(t>=0)))})),new yn({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=je(n,t.secretKey);this._addSignature(t.publicKey,Fe(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){mn(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=i.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):Ye(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];pn(n,e.length);const r=n.length+64*e.length+t.length,o=i.Buffer.alloc(r);return mn(e.length<256),i.Buffer.from(n).copy(o,0),e.forEach((({signature:t},e)=>{null!==t&&(mn(64===t.length,"signature has invalid length"),i.Buffer.from(t).copy(o,n.length+64*e))})),t.copy(o,n.length+64*e.length),mn(o.length<=en,`Transaction too large: ${o.length} > ${en}`),o}get keys(){return mn(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return mn(1===this.instructions.length),this.instructions[0].programId}get data(){return mn(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=fn(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Wt().encode(vn)?null:Wt().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new kn({keys:r,programId:t.accountKeys[e.programIdIndex],data:Wt().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}class An{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:r,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;mn(u>0,"Message header is invalid");const c=t.staticAccountKeys.length-o-a;mn(c>=0,"Message header is invalid");const d=t.getAccountKeys(e),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const t of r){const e=[];for(const r of t.accountKeyIndexes){const t=d.get(r);if(void 0===t)throw new Error(`Failed to find key for account key index ${r}`);let i;i=rt.equals(r.publicKey)));mn(t>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[t]=je(e,r.secretKey)}}addSignature(t,e){mn(64===e.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((e=>e.equals(t)));mn(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const In=new Je("SysvarC1ock11111111111111111111111111111111"),xn=new Je("SysvarEpochSchedu1e111111111111111111111111"),En=new Je("Sysvar1nstructions1111111111111111111111111"),Tn=new Je("SysvarRecentB1ockHashes11111111111111111111"),Pn=new Je("SysvarRent111111111111111111111111111111111"),Bn=new Je("SysvarRewards111111111111111111111111111111"),Ln=new Je("SysvarS1otHashes111111111111111111111111111"),$n=new Je("SysvarS1otHistory11111111111111111111111111"),Rn=new Je("SysvarStakeHistory1111111111111111111111111");async function On(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function Dn(t){return new Promise((e=>setTimeout(e,t)))}function Cn(t,e){const n=t.layout.span>=0?t.layout.span:hn(t,e),r=i.Buffer.alloc(n),o=Object.assign({instruction:t.index},e);return t.layout.encode(o,r),r}function Nn(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const zn=Jt.nu64("lamportsPerSignature"),Un=Jt.struct([Jt.u32("version"),Jt.u32("state"),cn("authorizedPubkey"),cn("nonce"),Jt.struct([zn],"feeCalculator")]),jn=Un.span;class Yn{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=Un.decode(Fe(t),0);return new Yn({authorizedPubkey:new Je(e.authorizedPubkey),nonce:new Je(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const Fn=(8,t=>{const e=(0,Jt.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return(0,Qt.toBigIntLE)(i.Buffer.from(n))},o.encode=(t,e,r)=>{const i=(0,Qt.toBufferLE)(t,8);return n(i,e,r)},o});class Wn{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Hn))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=Nn(Hn.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new Je(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=Nn(Hn.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=Nn(Hn.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new Je(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=Nn(Hn.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=Nn(Hn.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Je(e),seed:n,space:r,programId:new Je(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=Nn(Hn.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new Je(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=Nn(Hn.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Je(e),seed:n,programId:new Je(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=Nn(Hn.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new Je(e),seed:n,lamports:r,space:i,programId:new Je(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=Nn(Hn.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new Je(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(Hn.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Nn(Hn.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=Nn(Hn.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new Je(e)}}static checkProgramId(t){if(!t.equals(Kn.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length0?i:1,space:o.length,programId:r}));null!==a&&await On(t,a,[e,n],{commitment:"confirmed"})}const s=Jt.struct([Jt.u32("instruction"),Jt.u32("offset"),Jt.u32("bytesLength"),Jt.u32("bytesLengthPadding"),Jt.seq(Jt.u8("byte"),Jt.offset(Jt.u32(),-8),"bytes")]),a=Vn.chunkSize;let u=0,c=o,d=[];for(;c.length>0;){const o=c.slice(0,a),l=i.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:o,bytesLength:0,bytesLengthPadding:0},l);const h=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push(On(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await Dn(1e3/t)}u+=a,c=c.slice(a)}await Promise.all(d);{const o=Jt.struct([Jt.u32("instruction")]),s=i.Buffer.alloc(o.span);o.encode({instruction:1},s);const a=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1}],programId:r,data:s}),u="processed",c=await t.sendTransaction(a,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}Vn.chunkSize=qn;const Gn=new Je("BPFLoader2111111111111111111111111111111111");class Zn{static getMinNumSignatures(t){return Vn.getMinNumSignatures(t)}static load(t,e,n,r,i){return Vn.load(t,e,n,i,r)}}function Xn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jn=Object.prototype.toString,Qn=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function tr(t,e){var n,r,i,o,s,a,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return tr(t.toJSON(),e);if("[object Array]"===(u=Jn.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=tr(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Qn(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}class rr{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32)))-nr(32)-1;return[n,t-(this.getSlotsInEpoch(n)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}var e}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const n=(0,ie.Z)(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in n?n.socket:n,n}),t,e,n),this.underlyingSocket=void 0}call(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class cr{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${t.index}`);return n}(dr,t),n=t.length-56;mn(n>=0,"lookup table is invalid"),mn(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=Jt.struct([Jt.seq(cn(),r,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new Je(e.authority[0]):void 0,addresses:i.map((t=>new Je(t)))}}}const dr={index:1,layout:Jt.struct([Jt.u32("typeIndex"),Fn("deactivationSlot"),Jt.nu64("lastExtendedSlot"),Jt.u8("lastExtendedStartIndex"),Jt.u8(),Jt.seq(cn(),Jt.offset(Jt.u8(),-1),"authority")])},lr=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,hr=(0,te.oQ)((0,te.eE)(Je),(0,te.Z_)(),(t=>new Je(t))),fr=(0,te.bc)([(0,te.Z_)(),(0,te.i0)("base64")]),pr=(0,te.oQ)((0,te.eE)(i.Buffer),fr,(t=>i.Buffer.from(t[0],"base64"))),mr=3e4;function gr(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function yr(t){return(0,te.G0)([(0,te.dt)({jsonrpc:(0,te.i0)("2.0"),id:(0,te.Z_)(),result:t}),(0,te.dt)({jsonrpc:(0,te.i0)("2.0"),id:(0,te.Z_)(),error:(0,te.dt)({code:(0,te._4)(),message:(0,te.Z_)(),data:(0,te.jt)((0,te.Yj)())})})])}const br=yr((0,te._4)());function wr(t){return(0,te.oQ)(yr(t),br,(e=>"error"in e?e:{...e,result:(0,te.Ue)(e.result,t)}))}function _r(t){return wr((0,te.dt)({context:(0,te.dt)({slot:(0,te.Rx)()}),value:t}))}function vr(t){return(0,te.dt)({context:(0,te.dt)({slot:(0,te.Rx)()}),value:t})}function kr(t,e){return 0===t?new bn({header:e.header,staticAccountKeys:e.accountKeys.map((t=>new Je(t))),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Wt().decode(t.data)}))),addressTableLookups:e.addressTableLookups}):new yn(e)}const Mr=(0,te.dt)({foundation:(0,te.Rx)(),foundationTerm:(0,te.Rx)(),initial:(0,te.Rx)(),taper:(0,te.Rx)(),terminal:(0,te.Rx)()}),Ar=wr((0,te.IX)((0,te.AG)((0,te.dt)({epoch:(0,te.Rx)(),effectiveSlot:(0,te.Rx)(),amount:(0,te.Rx)(),postBalance:(0,te.Rx)(),commission:(0,te.jt)((0,te.AG)((0,te.Rx)()))})))),Sr=(0,te.IX)((0,te.dt)({slot:(0,te.Rx)(),prioritizationFee:(0,te.Rx)()})),Ir=(0,te.dt)({total:(0,te.Rx)(),validator:(0,te.Rx)(),foundation:(0,te.Rx)(),epoch:(0,te.Rx)()}),xr=(0,te.dt)({epoch:(0,te.Rx)(),slotIndex:(0,te.Rx)(),slotsInEpoch:(0,te.Rx)(),absoluteSlot:(0,te.Rx)(),blockHeight:(0,te.jt)((0,te.Rx)()),transactionCount:(0,te.jt)((0,te.Rx)())}),Er=(0,te.dt)({slotsPerEpoch:(0,te.Rx)(),leaderScheduleSlotOffset:(0,te.Rx)(),warmup:(0,te.O7)(),firstNormalEpoch:(0,te.Rx)(),firstNormalSlot:(0,te.Rx)()}),Tr=(0,te.IM)((0,te.Z_)(),(0,te.IX)((0,te.Rx)())),Pr=(0,te.AG)((0,te.G0)([(0,te.dt)({}),(0,te.Z_)()])),Br=(0,te.dt)({err:Pr}),Lr=(0,te.i0)("receivedSignature"),$r=(0,te.dt)({"solana-core":(0,te.Z_)(),"feature-set":(0,te.jt)((0,te.Rx)())}),Rr=_r((0,te.dt)({err:(0,te.AG)((0,te.G0)([(0,te.dt)({}),(0,te.Z_)()])),logs:(0,te.AG)((0,te.IX)((0,te.Z_)())),accounts:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.AG)((0,te.dt)({executable:(0,te.O7)(),owner:(0,te.Z_)(),lamports:(0,te.Rx)(),data:(0,te.IX)((0,te.Z_)()),rentEpoch:(0,te.jt)((0,te.Rx)())}))))),unitsConsumed:(0,te.jt)((0,te.Rx)()),returnData:(0,te.jt)((0,te.AG)((0,te.dt)({programId:(0,te.Z_)(),data:(0,te.bc)([(0,te.Z_)(),(0,te.i0)("base64")])})))})),Or=_r((0,te.dt)({byIdentity:(0,te.IM)((0,te.Z_)(),(0,te.IX)((0,te.Rx)())),range:(0,te.dt)({firstSlot:(0,te.Rx)(),lastSlot:(0,te.Rx)()})})),Dr=wr(Mr),Cr=wr(Ir),Nr=wr(Sr),zr=wr(xr),Ur=wr(Er),jr=wr(Tr),Yr=wr((0,te.Rx)()),Fr=_r((0,te.dt)({total:(0,te.Rx)(),circulating:(0,te.Rx)(),nonCirculating:(0,te.Rx)(),nonCirculatingAccounts:(0,te.IX)(hr)})),Wr=(0,te.dt)({amount:(0,te.Z_)(),uiAmount:(0,te.AG)((0,te.Rx)()),decimals:(0,te.Rx)(),uiAmountString:(0,te.jt)((0,te.Z_)())}),Hr=_r((0,te.IX)((0,te.dt)({address:hr,amount:(0,te.Z_)(),uiAmount:(0,te.AG)((0,te.Rx)()),decimals:(0,te.Rx)(),uiAmountString:(0,te.jt)((0,te.Z_)())}))),Kr=_r((0,te.IX)((0,te.dt)({pubkey:hr,account:(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:pr,rentEpoch:(0,te.Rx)()})}))),qr=(0,te.dt)({program:(0,te.Z_)(),parsed:(0,te._4)(),space:(0,te.Rx)()}),Vr=_r((0,te.IX)((0,te.dt)({pubkey:hr,account:(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:qr,rentEpoch:(0,te.Rx)()})}))),Gr=_r((0,te.IX)((0,te.dt)({lamports:(0,te.Rx)(),address:hr}))),Zr=(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:pr,rentEpoch:(0,te.Rx)()}),Xr=(0,te.dt)({pubkey:hr,account:Zr}),Jr=(0,te.oQ)((0,te.G0)([(0,te.eE)(i.Buffer),qr]),(0,te.G0)([fr,qr]),(t=>Array.isArray(t)?(0,te.Ue)(t,pr):t)),Qr=(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:Jr,rentEpoch:(0,te.Rx)()}),ti=(0,te.dt)({pubkey:hr,account:Qr}),ei=(0,te.dt)({state:(0,te.G0)([(0,te.i0)("active"),(0,te.i0)("inactive"),(0,te.i0)("activating"),(0,te.i0)("deactivating")]),active:(0,te.Rx)(),inactive:(0,te.Rx)()}),ni=wr((0,te.IX)((0,te.dt)({signature:(0,te.Z_)(),slot:(0,te.Rx)(),err:Pr,memo:(0,te.AG)((0,te.Z_)()),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)()))}))),ri=wr((0,te.IX)((0,te.dt)({signature:(0,te.Z_)(),slot:(0,te.Rx)(),err:Pr,memo:(0,te.AG)((0,te.Z_)()),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)()))}))),ii=(0,te.dt)({subscription:(0,te.Rx)(),result:vr(Zr)}),oi=(0,te.dt)({pubkey:hr,account:Zr}),si=(0,te.dt)({subscription:(0,te.Rx)(),result:vr(oi)}),ai=(0,te.dt)({parent:(0,te.Rx)(),slot:(0,te.Rx)(),root:(0,te.Rx)()}),ui=(0,te.dt)({subscription:(0,te.Rx)(),result:ai}),ci=(0,te.G0)([(0,te.dt)({type:(0,te.G0)([(0,te.i0)("firstShredReceived"),(0,te.i0)("completed"),(0,te.i0)("optimisticConfirmation"),(0,te.i0)("root")]),slot:(0,te.Rx)(),timestamp:(0,te.Rx)()}),(0,te.dt)({type:(0,te.i0)("createdBank"),parent:(0,te.Rx)(),slot:(0,te.Rx)(),timestamp:(0,te.Rx)()}),(0,te.dt)({type:(0,te.i0)("frozen"),slot:(0,te.Rx)(),timestamp:(0,te.Rx)(),stats:(0,te.dt)({numTransactionEntries:(0,te.Rx)(),numSuccessfulTransactions:(0,te.Rx)(),numFailedTransactions:(0,te.Rx)(),maxTransactionsPerEntry:(0,te.Rx)()})}),(0,te.dt)({type:(0,te.i0)("dead"),slot:(0,te.Rx)(),timestamp:(0,te.Rx)(),err:(0,te.Z_)()})]),di=(0,te.dt)({subscription:(0,te.Rx)(),result:ci}),li=(0,te.dt)({subscription:(0,te.Rx)(),result:vr((0,te.G0)([Br,Lr]))}),hi=(0,te.dt)({subscription:(0,te.Rx)(),result:(0,te.Rx)()}),fi=(0,te.dt)({pubkey:(0,te.Z_)(),gossip:(0,te.AG)((0,te.Z_)()),tpu:(0,te.AG)((0,te.Z_)()),rpc:(0,te.AG)((0,te.Z_)()),version:(0,te.AG)((0,te.Z_)())}),pi=(0,te.dt)({votePubkey:(0,te.Z_)(),nodePubkey:(0,te.Z_)(),activatedStake:(0,te.Rx)(),epochVoteAccount:(0,te.O7)(),epochCredits:(0,te.IX)((0,te.bc)([(0,te.Rx)(),(0,te.Rx)(),(0,te.Rx)()])),commission:(0,te.Rx)(),lastVote:(0,te.Rx)(),rootSlot:(0,te.AG)((0,te.Rx)())}),mi=wr((0,te.dt)({current:(0,te.IX)(pi),delinquent:(0,te.IX)(pi)})),gi=(0,te.G0)([(0,te.i0)("processed"),(0,te.i0)("confirmed"),(0,te.i0)("finalized")]),yi=(0,te.dt)({slot:(0,te.Rx)(),confirmations:(0,te.AG)((0,te.Rx)()),err:Pr,confirmationStatus:(0,te.jt)(gi)}),bi=_r((0,te.IX)((0,te.AG)(yi))),wi=wr((0,te.Rx)()),_i=(0,te.dt)({accountKey:hr,writableIndexes:(0,te.IX)((0,te.Rx)()),readonlyIndexes:(0,te.IX)((0,te.Rx)())}),vi=(0,te.dt)({signatures:(0,te.IX)((0,te.Z_)()),message:(0,te.dt)({accountKeys:(0,te.IX)((0,te.Z_)()),header:(0,te.dt)({numRequiredSignatures:(0,te.Rx)(),numReadonlySignedAccounts:(0,te.Rx)(),numReadonlyUnsignedAccounts:(0,te.Rx)()}),instructions:(0,te.IX)((0,te.dt)({accounts:(0,te.IX)((0,te.Rx)()),data:(0,te.Z_)(),programIdIndex:(0,te.Rx)()})),recentBlockhash:(0,te.Z_)(),addressTableLookups:(0,te.jt)((0,te.IX)(_i))})}),ki=(0,te.dt)({pubkey:hr,signer:(0,te.O7)(),writable:(0,te.O7)(),source:(0,te.jt)((0,te.G0)([(0,te.i0)("transaction"),(0,te.i0)("lookupTable")]))}),Mi=(0,te.dt)({accountKeys:(0,te.IX)(ki),signatures:(0,te.IX)((0,te.Z_)())}),Ai=(0,te.dt)({parsed:(0,te._4)(),program:(0,te.Z_)(),programId:hr}),Si=(0,te.dt)({accounts:(0,te.IX)(hr),data:(0,te.Z_)(),programId:hr}),Ii=(0,te.G0)([Si,Ai]),xi=(0,te.G0)([(0,te.dt)({parsed:(0,te._4)(),program:(0,te.Z_)(),programId:(0,te.Z_)()}),(0,te.dt)({accounts:(0,te.IX)((0,te.Z_)()),data:(0,te.Z_)(),programId:(0,te.Z_)()})]),Ei=(0,te.oQ)(Ii,xi,(t=>"accounts"in t?(0,te.Ue)(t,Si):(0,te.Ue)(t,Ai))),Ti=(0,te.dt)({signatures:(0,te.IX)((0,te.Z_)()),message:(0,te.dt)({accountKeys:(0,te.IX)(ki),instructions:(0,te.IX)(Ei),recentBlockhash:(0,te.Z_)(),addressTableLookups:(0,te.jt)((0,te.AG)((0,te.IX)(_i)))})}),Pi=(0,te.dt)({accountIndex:(0,te.Rx)(),mint:(0,te.Z_)(),owner:(0,te.jt)((0,te.Z_)()),uiTokenAmount:Wr}),Bi=(0,te.dt)({writable:(0,te.IX)(hr),readonly:(0,te.IX)(hr)}),Li=(0,te.dt)({err:Pr,fee:(0,te.Rx)(),innerInstructions:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.dt)({index:(0,te.Rx)(),instructions:(0,te.IX)((0,te.dt)({accounts:(0,te.IX)((0,te.Rx)()),data:(0,te.Z_)(),programIdIndex:(0,te.Rx)()}))})))),preBalances:(0,te.IX)((0,te.Rx)()),postBalances:(0,te.IX)((0,te.Rx)()),logMessages:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.Z_)()))),preTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),postTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),loadedAddresses:(0,te.jt)(Bi),computeUnitsConsumed:(0,te.jt)((0,te.Rx)())}),$i=(0,te.dt)({err:Pr,fee:(0,te.Rx)(),innerInstructions:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.dt)({index:(0,te.Rx)(),instructions:(0,te.IX)(Ei)})))),preBalances:(0,te.IX)((0,te.Rx)()),postBalances:(0,te.IX)((0,te.Rx)()),logMessages:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.Z_)()))),preTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),postTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),loadedAddresses:(0,te.jt)(Bi),computeUnitsConsumed:(0,te.jt)((0,te.Rx)())}),Ri=(0,te.G0)([(0,te.i0)(0),(0,te.i0)("legacy")]),Oi=(0,te.dt)({pubkey:(0,te.Z_)(),lamports:(0,te.Rx)(),postBalance:(0,te.AG)((0,te.Rx)()),rewardType:(0,te.AG)((0,te.Z_)()),commission:(0,te.jt)((0,te.AG)((0,te.Rx)()))}),Di=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:vi,meta:(0,te.AG)(Li),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ci=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ni=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Mi,meta:(0,te.AG)(Li),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),zi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Ti,meta:(0,te.AG)($i),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ui=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Mi,meta:(0,te.AG)($i),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),ji=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Yi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:vi,meta:(0,te.AG)(Li)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)())}))),Fi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),signatures:(0,te.IX)((0,te.Z_)()),blockTime:(0,te.AG)((0,te.Rx)())}))),Wi=wr((0,te.AG)((0,te.dt)({slot:(0,te.Rx)(),meta:(0,te.AG)(Li),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)())),transaction:vi,version:(0,te.jt)(Ri)}))),Hi=wr((0,te.AG)((0,te.dt)({slot:(0,te.Rx)(),transaction:Ti,meta:(0,te.AG)($i),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)())),version:(0,te.jt)(Ri)}))),Ki=_r((0,te.dt)({blockhash:(0,te.Z_)(),feeCalculator:(0,te.dt)({lamportsPerSignature:(0,te.Rx)()})})),qi=_r((0,te.dt)({blockhash:(0,te.Z_)(),lastValidBlockHeight:(0,te.Rx)()})),Vi=_r((0,te.O7)()),Gi=(0,te.dt)({slot:(0,te.Rx)(),numTransactions:(0,te.Rx)(),numSlots:(0,te.Rx)(),samplePeriodSecs:(0,te.Rx)()}),Zi=wr((0,te.IX)(Gi)),Xi=_r((0,te.AG)((0,te.dt)({feeCalculator:(0,te.dt)({lamportsPerSignature:(0,te.Rx)()})}))),Ji=wr((0,te.Z_)()),Qi=wr((0,te.Z_)()),to=(0,te.dt)({err:Pr,logs:(0,te.IX)((0,te.Z_)()),signature:(0,te.Z_)()}),eo=(0,te.dt)({result:vr(to),subscription:(0,te.Rx)()}),no={"solana-client":"js/0.0.0-development"};class ro{constructor(t,e){let n,r,i,o,s,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const t={};return async e=>{const{commitment:n,config:r}=gr(e),i=this._buildArgs([],n,void 0,r),o=er(i);return t[o]=t[o]??(async()=>{try{const t=await this._rpcRequest("getBlockHeight",i),e=(0,te.Ue)(t,wr((0,te.Rx)()));if("error"in e)throw new sr(e.error,"failed to get block height information");return e.result}finally{delete t[o]}})(),await t[o]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,n=e.wsEndpoint,r=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=n||function(t){const e=t.match(lr);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);const[n,r,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(t),this._rpcClient=function(t,e,n,r,i,o){const s=n||ar;let a;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(t,e)=>{const n=await new Promise(((n,i)=>{try{r(t,e,((t,e)=>n([t,e])))}catch(t){i(t)}}));return await s(...n)}),new(ne())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},no)};try{let e,n=5,u=500;for(;e=a?await a(t,o):await s(t,o),429===e.status&&!0!==i&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await Dn(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{})}(t,r,i,o,s,a),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new ur(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=await this._rpcRequest("getBalance",i),s=(0,te.Ue)(o,_r((0,te.Rx)()));if("error"in s)throw new sr(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=await this._rpcRequest("getBlockTime",[t]),n=(0,te.Ue)(e,wr((0,te.AG)((0,te.Rx)())));if("error"in n)throw new sr(n.error,`failed to get block time for slot ${t}`);return n.result}async getMinimumLedgerSlot(){const t=await this._rpcRequest("minimumLedgerSlot",[]),e=(0,te.Ue)(t,wr((0,te.Rx)()));if("error"in e)throw new sr(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const t=await this._rpcRequest("getFirstAvailableBlock",[]),e=(0,te.Ue)(t,Yr);if("error"in e)throw new sr(e.error,"failed to get first available block");return e.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=await this._rpcRequest("getSupply",[e]),r=(0,te.Ue)(n,Fr);if("error"in r)throw new sr(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenSupply",n),i=(0,te.Ue)(r,_r(Wr));if("error"in i)throw new sr(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenAccountBalance",n),i=(0,te.Ue)(r,_r(Wr));if("error"in i)throw new sr(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=gr(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=await this._rpcRequest("getTokenAccountsByOwner",s),u=(0,te.Ue)(a,Kr);if("error"in u)throw new sr(u.error,`failed to get token accounts owned by account ${t.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",i),s=(0,te.Ue)(o,Vr);if("error"in s)throw new sr(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=await this._rpcRequest("getLargestAccounts",n),i=(0,te.Ue)(r,Gr);if("error"in i)throw new sr(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenLargestAccounts",n),i=(0,te.Ue)(r,Hr);if("error"in i)throw new sr(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,te.Ue)(o,_r((0,te.AG)(Zr)));if("error"in s)throw new sr(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,te.Ue)(o,_r((0,te.AG)(Qr)));if("error"in s)throw new sr(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,te.Ue)(s,_r((0,te.IX)((0,te.AG)(Qr))));if("error"in a)throw new sr(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,te.Ue)(s,_r((0,te.IX)((0,te.AG)(Zr))));if("error"in a)throw new sr(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=gr(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),s=await this._rpcRequest("getStakeActivation",o),a=(0,te.Ue)(s,wr(ei));if("error"in a)throw new sr(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=gr(e),{encoding:i,...o}=r||{},s=this._buildArgs([t.toBase58()],n,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=(0,te.IX)(Xr),c=!0===o.withContext?(0,te.Ue)(a,_r(u)):(0,te.Ue)(a,wr(u));if("error"in c)throw new sr(c.error,`failed to get accounts owned by program ${t.toBase58()}`);return c.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getProgramAccounts",i),s=(0,te.Ue)(o,wr((0,te.IX)(ti)));if("error"in s)throw new sr(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{const e=t;if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);n=e.signature}try{r=Wt().decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}return mn(64===r.length,"signature has invalid length"),"string"==typeof t?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise(((e,n)=>{null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(()=>{n(t.reason)})))}))}getTransactionConfirmationPromise({commitment:t,signature:e}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,s)=>{try{n=this.onSignature(e,((t,e)=>{n=void 0;const r={context:e,value:t};o({__type:_n.PROCESSED,response:r})}),t);const a=new Promise((t=>{null==n?t():r=this._onSubscriptionStateChange(n,(e=>{"subscribed"===e&&t()}))}));(async()=>{if(await a,i)return;const n=await this.getSignatureStatus(e);if(i)return;if(null==n)return;const{context:r,value:u}=n;if(null!=u)if(u?.err)s(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,o({__type:_n.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((e=>{const r=async()=>{try{return await this.getBlockHeight(t)}catch(t){return-1}};(async()=>{let t=await r();if(!i){for(;t<=n;){if(await Dn(1e3),i)return;if(t=await r(),i)return}e({__type:_n.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:t,signature:r}),u=this.getCancellationPromise(e);let c;try{const t=await Promise.race([u,a,o]);if(t.__type!==_n.PROCESSED)throw new on(r);c=t.response}finally{i=!0,s()}return c}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let s=!1;const a=new Promise((e=>{let o=i,a=null;const u=async()=>{try{const{context:e,value:i}=await this.getNonceAndContext(r,{commitment:t,minContextSlot:n});return a=e.slot,i?.nonce}catch(t){return o}};(async()=>{if(o=await u(),!s)for(;;){if(i!==o)return void e({__type:_n.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await Dn(2e3),s)return;if(o=await u(),s)return}})()})),{abortConfirmation:u,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(e);let l;try{const e=await Promise.race([d,c,a]);if(e.__type===_n.PROCESSED)l=e.response;else{let r;for(;;){const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(e.slotInWhichNonceDidAdvance??n))){r=t;break}await Dn(400)}if(!r?.value)throw new an(o);{const e=t||"finalized",{confirmationStatus:n}=r.value;switch(e){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new an(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new an(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new an(o)}l={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,u()}return l}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let n;const r=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>e({__type:_n.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});let s;try{const t=await Promise.race([o,r]);if(t.__type!==_n.PROCESSED)throw new sn(e,t.timeoutMs/1e3);s=t.response}finally{clearTimeout(n),i()}return s}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),e=(0,te.Ue)(t,wr((0,te.IX)(fi)));if("error"in e)throw new sr(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getVoteAccounts",e),r=(0,te.Ue)(n,mi);if("error"in r)throw new sr(r.error,"failed to get vote accounts");return r.result}async getSlot(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlot",r),o=(0,te.Ue)(i,wr((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get slot");return o.result}async getSlotLeader(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlotLeader",r),o=(0,te.Ue)(i,wr((0,te.Z_)()));if("error"in o)throw new sr(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(t,e){const n=[t,e],r=await this._rpcRequest("getSlotLeaders",n),i=(0,te.Ue)(r,wr((0,te.IX)(hr)));if("error"in i)throw new sr(i.error,"failed to get slot leaders");return i.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);return mn(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=await this._rpcRequest("getSignatureStatuses",n),i=(0,te.Ue)(r,bi);if("error"in i)throw new sr(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getTransactionCount",r),o=(0,te.Ue)(i,wr((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get transaction count");return o.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getInflationGovernor",e),r=(0,te.Ue)(n,Dr);if("error"in r)throw new sr(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=gr(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:i?.epoch}),s=await this._rpcRequest("getInflationReward",o),a=(0,te.Ue)(s,Ar);if("error"in a)throw new sr(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){const t=await this._rpcRequest("getInflationRate",[]),e=(0,te.Ue)(t,Cr);if("error"in e)throw new sr(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getEpochInfo",r),o=(0,te.Ue)(i,zr);if("error"in o)throw new sr(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){const t=await this._rpcRequest("getEpochSchedule",[]),e=(0,te.Ue)(t,Ur);if("error"in e)throw new sr(e.error,"failed to get epoch schedule");const n=e.result;return new rr(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),e=(0,te.Ue)(t,jr);if("error"in e)throw new sr(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getMinimumBalanceForRentExemption",n),i=(0,te.Ue)(r,wi);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getRecentBlockhash",e),r=(0,te.Ue)(n,Ki);if("error"in r)throw new sr(r.error,"failed to get recent blockhash");return r.result}async getRecentPerformanceSamples(t){const e=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),n=(0,te.Ue)(e,Zi);if("error"in n)throw new sr(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getFeeCalculatorForBlockhash",n),i=(0,te.Ue)(r,Xi);if("error"in i)throw new sr(i.error,"failed to get fee calculator");const{context:o,value:s}=i.result;return{context:o,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){const n=Fe(t.serialize()).toString("base64"),r=this._buildArgs([n],e),i=await this._rpcRequest("getFeeForMessage",r),o=(0,te.Ue)(i,_r((0,te.AG)((0,te.Rx)())));if("error"in o)throw new sr(o.error,"failed to get fee for message");if(null===o.result)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(t){const e=t?.lockedWritableAccounts?.map((t=>t.toBase58())),n=e?.length?[e]:[],r=await this._rpcRequest("getRecentPrioritizationFees",n),i=(0,te.Ue)(r,Nr);if("error"in i)throw new sr(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getLatestBlockhash",r),o=(0,te.Ue)(i,qi);if("error"in o)throw new sr(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t],n,void 0,r),o=await this._rpcRequest("isBlockhashValid",i),s=(0,te.Ue)(o,Vi);if("error"in s)throw new sr(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){const t=await this._rpcRequest("getVersion",[]),e=(0,te.Ue)(t,wr($r));if("error"in e)throw new sr(e.error,"failed to get version");return e.result}async getGenesisHash(){const t=await this._rpcRequest("getGenesisHash",[]),e=(0,te.Ue)(t,wr((0,te.Z_)()));if("error"in e)throw new sr(e.error,"failed to get genesis hash");return e.result}async getBlock(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,te.Ue)(o,Ni);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,te.Ue)(o,Ci);if("error"in t)throw t.error;return t.result}default:{const t=(0,te.Ue)(o,Di);if("error"in t)throw t.error;const{result:e}=t;return e?{...e,transactions:e.transactions.map((({transaction:t,meta:e,version:n})=>({meta:e,transaction:{...t,message:kr(n,t.message)},version:n})))}:null}}}catch(t){throw new sr(t,"failed to get confirmed block")}}async getParsedBlock(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,te.Ue)(o,Ui);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,te.Ue)(o,ji);if("error"in t)throw t.error;return t.result}default:{const t=(0,te.Ue)(o,zi);if("error"in t)throw t.error;return t.result}}}catch(t){throw new sr(t,"failed to get block")}}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=await this._rpcRequest("getBlockProduction",r),o=(0,te.Ue)(i,Or);if("error"in o)throw new sr(o.error,"failed to get block production information");return o.result}async getTransaction(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getTransaction",i),s=(0,te.Ue)(o,Wi);if("error"in s)throw new sr(s.error,"failed to get transaction");const a=s.result;return a?{...a,transaction:{...a.transaction,message:kr(a.version,a.transaction.message)}}:a}async getParsedTransaction(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getTransaction",i),s=(0,te.Ue)(o,Hi);if("error"in s)throw new sr(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,te.Ue)(t,Hi);if("error"in e)throw new sr(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,te.Ue)(t,Wi);if("error"in e)throw new sr(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:kr(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,te.Ue)(r,Yi);if("error"in i)throw new sr(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");const s={...o,transactions:o.transactions.map((({transaction:t,meta:e})=>{const n=new yn(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...s,transactions:s.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:Mn.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=await this._rpcRequest("getBlocks",r),o=(0,te.Ue)(i,wr((0,te.IX)((0,te.Rx)())));if("error"in o)throw new sr(o.error,"failed to get blocks");return o.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),i=(0,te.Ue)(r,Fi);if("error"in i)throw new sr(i.error,"failed to get block");const o=i.result;if(!o)throw new Error("Block "+t+" not found");return o}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,te.Ue)(r,Fi);if("error"in i)throw new sr(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");return o}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,te.Ue)(r,Wi);if("error"in i)throw new sr(i.error,"failed to get transaction");const o=i.result;if(!o)return o;const s=new yn(o.transaction.message),a=o.transaction.signatures;return{...o,transaction:Mn.populate(s,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,te.Ue)(r,Hi);if("error"in i)throw new sr(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=(0,te.Ue)(t,Hi);if("error"in e)throw new sr(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getConfirmedSignaturesForAddress2",r),o=(0,te.Ue)(i,ni);if("error"in o)throw new sr(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getSignaturesForAddress",r),o=(0,te.Ue)(i,ri);if("error"in o)throw new sr(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=new cr({key:t,state:cr.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=Yn.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),r=(0,te.Ue)(n,Ji);if("error"in r)throw new sr(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await Dn(100);const t=Date.now()-this._blockhashInfo.lastFetch>=mr;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await Dn(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,"base64",n),i=await this._rpcRequest("getStakeMinimumDelegation",r),o=(0,te.Ue)(i,_r((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(t,e,n){if("message"in t){const r=t.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(e)||void 0!==n)throw new Error("Invalid arguments");const s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment);const a=[o,s],u=await this._rpcRequest("simulateTransaction",a),c=(0,te.Ue)(u,Rr);if("error"in c)throw new Error("failed to simulate transaction: "+c.error.message);return c.result}let r;if(t instanceof Mn){let e=t;r=new Mn,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=Mn.populate(t),r._message=r._json=void 0;if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid arguments");const o=e;if(r.nonceInfo&&o)r.sign(...o);else{let t=this._disableBlockhashCaching;for(;;){const e=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=e.lastValidBlockHeight,r.recentBlockhash=e.blockhash,!o)break;if(r.sign(...o),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}t=!0}}const s=r._compile(),a=s.serialize(),u=r._serialize(a).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:s.nonProgramIds()).map((t=>t.toBase58()));c.accounts={encoding:"base64",addresses:t}}o&&(c.sigVerify=!0);const d=[u,c],l=await this._rpcRequest("simulateTransaction",d),h=(0,te.Ue)(l,Rr);if("error"in h){let t;if("data"in h.error&&(t=h.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(h.error.message,n)}throw new ir("failed to simulate transaction: "+h.error.message,t)}return h.result}async sendTransaction(t,e,n){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const n=t.serialize();return await this.sendRawTransaction(n,e)}if(void 0===e||!Array.isArray(e))throw new Error("Invalid arguments");const r=e;if(t.nonceInfo)t.sign(...r);else{let e=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(e);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...r),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}e=!0}}const i=t.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(t,e){const n=Fe(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],s=await this._rpcRequest("sendTransaction",o),a=(0,te.Ue)(s,Qi);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new ir("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(t,e){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,n!==e.state){const n=this._subscriptionStateChangeCallbacksByHash[t];n&&n.forEach((t=>{try{t(e.state)}catch{}}))}}_onSubscriptionStateChange(t,e){const n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(e),()=>{r.delete(e),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const e=await this._rpcWebSocket.call(i,r);this._setSubscription(t,{...n,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,ii);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=er([t.method,e],!0),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];mn(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,si);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,eo);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,ui);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,di);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,li);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),s=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,hi);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class io{constructor(t){this._keypair=void 0,this._keypair=t??Ne()}static generate(){return new io(Ne())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=ze(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new io({publicKey:n,secretKey:t})}static fromSeed(t){const e=ze(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new io({publicKey:e,secretKey:n})}get publicKey(){return new Je(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const oo=Object.freeze({CreateLookupTable:{index:0,layout:Jt.struct([Jt.u32("instruction"),Fn("recentSlot"),Jt.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Jt.struct([Jt.u32("instruction")])},ExtendLookupTable:{index:2,layout:Jt.struct([Jt.u32("instruction"),Fn(),Jt.seq(cn(),Jt.offset(Jt.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Jt.struct([Jt.u32("instruction")])},CloseLookupTable:{index:4,layout:Jt.struct([Jt.u32("instruction")])}});class so{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(oo))if(r.index==e){n=t;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);const{recentSlot:e}=Nn(oo.CreateLookupTable,t.data);return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error(`invalid instruction; found ${t.keys.length} keys, expected at least 2`);const{addresses:e}=Nn(oo.ExtendLookupTable,t.data);return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((t=>new Je(t)))}}static decodeCloseLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}static decodeFreezeLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static decodeDeactivateLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(ao.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(t,e){if(t.lengtht.toBytes()))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Kn.programId,isSigner:!1,isWritable:!1}),new kn({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=Cn(oo.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new kn({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=Cn(oo.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new kn({programId:this.programId,keys:n,data:e})}}ao.programId=new Je("AddressLookupTab1e1111111111111111111111111");class uo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u8("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(co))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=Nn(co.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=Nn(co.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=Nn(co.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=Nn(co.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(lo.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const co=Object.freeze({RequestUnits:{index:0,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("units"),Jt.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("units")])},SetComputeUnitPrice:{index:3,layout:Jt.struct([Jt.u8("instruction"),Fn("microLamports")])}});class lo{constructor(){}static requestUnits(t){const e=Cn(co.RequestUnits,t);return new kn({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=Cn(co.RequestHeapFrame,t);return new kn({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=Cn(co.SetComputeUnitLimit,t);return new kn({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=Cn(co.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new kn({keys:[],programId:this.programId,data:e})}}lo.programId=new Je("ComputeBudget111111111111111111111111111111");const ho=Jt.struct([Jt.u8("numSignatures"),Jt.u8("padding"),Jt.u16("signatureOffset"),Jt.u16("signatureInstructionIndex"),Jt.u16("publicKeyOffset"),Jt.u16("publicKeyInstructionIndex"),Jt.u16("messageDataOffset"),Jt.u16("messageDataSize"),Jt.u16("messageInstructionIndex")]);class fo{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:o}=t;mn(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),mn(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const s=ho.span,a=s+e.length,u=a+r.length,c=i.Buffer.alloc(u+n.length),d=null==o?65535:o;return ho.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,s),c.fill(r,a),c.fill(n,u),new kn({keys:[],programId:fo.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;mn(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=io.fromSecretKey(e),i=t.publicKey.toBytes(),o=je(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}fo.programId=new Je("Ed25519SigVerify111111111111111111111111111"),De.utils.isValidPrivateKey;const po=De.getPublicKey,mo=Jt.struct([Jt.u8("numSignatures"),Jt.u16("signatureOffset"),Jt.u8("signatureInstructionIndex"),Jt.u16("ethAddressOffset"),Jt.u8("ethAddressInstructionIndex"),Jt.u16("messageDataOffset"),Jt.u16("messageDataSize"),Jt.u8("messageInstructionIndex"),Jt.blob(20,"ethAddress"),Jt.blob(64,"signature"),Jt.u8("recoveryId")]);class go{constructor(){}static publicKeyToEthAddress(t){mn(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return i.Buffer.from(we(Fe(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return go.createInstructionWithEthAddress({ethAddress:go.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:o,instructionIndex:s=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?i.Buffer.from(e.substr(2),"hex"):i.Buffer.from(e,"hex"):e,mn(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,c=u+r.length+1,d=i.Buffer.alloc(mo.span+n.length);return mo.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:s,signature:Fe(r),ethAddress:Fe(a),recoveryId:o},d),d.fill(Fe(n),mo.span),new kn({keys:[],programId:go.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;mn(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=Fe(e),o=po(t,!1).slice(1),s=i.Buffer.from(we(Fe(n))),[a,u]=((t,e)=>{const n=De.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(s,t);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var yo;go.programId=new Je("KeccakSecp256k11111111111111111111111111111");const bo=new Je("StakeConfig11111111111111111111111111111111");class wo{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class _o{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}yo=_o,_o.default=new yo(0,0,Je.default);class vo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ko))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=Nn(ko.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new wo(new Je(e.staker),new Je(e.withdrawer)),lockup:new _o(n.unixTimestamp,n.epoch,new Je(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),Nn(ko.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=Nn(ko.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Je(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Nn(ko.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new Je(i),newAuthorizedPubkey:new Je(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Nn(ko.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(ko.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Nn(ko.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(ko.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(Ao.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.lengthJt.struct([cn("staker"),cn("withdrawer")],t))(),((t="lockup")=>Jt.struct([Jt.ns64("unixTimestamp"),Jt.ns64("epoch"),cn("custodian")],t))()])},Authorize:{index:1,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:Jt.struct([Jt.u32("instruction")])},Split:{index:3,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},Withdraw:{index:4,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},Deactivate:{index:5,layout:Jt.struct([Jt.u32("instruction")])},Merge:{index:7,layout:Jt.struct([Jt.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("stakeAuthorizationType"),ln("authoritySeed"),cn("authorityOwner")])}}),Mo=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Ao{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||_o.default,o=Cn(ko.Initialize,{authorized:{staker:Fe(n.staker.toBuffer()),withdrawer:Fe(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Fe(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new kn(s)}static createAccountWithSeed(t){const e=new Mn;e.add(Kn.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new Mn;e.add(Kn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=Cn(ko.Delegate);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:bo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=Cn(ko.Authorize,{newAuthorized:Fe(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=Cn(ko.AuthorizeWithSeed,{newAuthorized:Fe(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:Fe(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new Mn).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=Cn(ko.Split,{lamports:i});return new kn({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new Mn;return e.add(Kn.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:s}=t,a=new Mn;return a.add(Kn.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),a.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:s}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=Cn(ko.Merge);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=Cn(ko.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=Cn(ko.Deactivate);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}Ao.programId=new Je("Stake11111111111111111111111111111111111111"),Ao.space=200;class So{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}class Io{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(xo))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=Nn(xo.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new So(new Je(e.nodePubkey),new Je(e.authorizedVoter),new Je(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=Nn(xo.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Je(e),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:e,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Nn(xo.AuthorizeWithSeed,t.data);return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new Je(e),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new Je(r),voteAuthorizationType:{index:i},votePubkey:t.keys[0].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Nn(xo.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(To.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.lengthJt.struct([cn("nodePubkey"),cn("authorizedVoter"),cn("authorizedWithdrawer"),Jt.u8("commission")],t))()])},Authorize:{index:1,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},AuthorizeWithSeed:{index:10,layout:Jt.struct([Jt.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>Jt.struct([Jt.u32("voteAuthorizationType"),cn("currentAuthorityDerivedKeyOwnerPubkey"),ln("currentAuthorityDerivedKeySeed"),cn("newAuthorized")],t))()])}}),Eo=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class To{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=Cn(xo.InitializeAccount,{voteInit:{nodePubkey:Fe(r.nodePubkey.toBuffer()),authorizedVoter:Fe(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Fe(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new kn(o)}static createAccount(t){const e=new Mn;return e.add(Kn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=Cn(xo.Authorize,{newAuthorized:Fe(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=Cn(xo.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Fe(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Fe(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=Cn(xo.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return To.withdraw(t)}}To.programId=new Je("Vote111111111111111111111111111111111111111"),To.space=3731;const Po=new Je("Va1idator1nfo111111111111111111111111111111"),Bo=(0,te.dt)({name:(0,te.Z_)(),website:(0,te.jt)((0,te.Z_)()),details:(0,te.jt)((0,te.Z_)()),keybaseUsername:(0,te.jt)((0,te.Z_)())});class Lo{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==fn(e))return null;const n=[];for(let t=0;t<2;t++){const t=new Je(e.slice(0,Ze));e=e.slice(Ze);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(Po)&&n[1].isSigner){const t=ln().decode(i.Buffer.from(e)),r=JSON.parse(t);return(0,te.hu)(r,Bo),new Lo(n[1].publicKey,r)}return null}}const $o=new Je("Vote111111111111111111111111111111111111111"),Ro=Jt.struct([cn("nodePubkey"),cn("authorizedWithdrawer"),Jt.u8("commission"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("slot"),Jt.u32("confirmationCount")]),Jt.offset(Jt.u32(),-8),"votes"),Jt.u8("rootSlotValid"),Jt.nu64("rootSlot"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("epoch"),cn("authorizedVoter")]),Jt.offset(Jt.u32(),-8),"authorizedVoters"),Jt.struct([Jt.seq(Jt.struct([cn("authorizedPubkey"),Jt.nu64("epochOfLastAuthorizedSwitch"),Jt.nu64("targetEpoch")]),32,"buf"),Jt.nu64("idx"),Jt.u8("isEmpty")],"priorVoters"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("epoch"),Jt.nu64("credits"),Jt.nu64("prevCredits")]),Jt.offset(Jt.u32(),-8),"epochCredits"),Jt.struct([Jt.nu64("slot"),Jt.nu64("timestamp")],"lastTimestamp")]);class Oo{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=Ro.decode(Fe(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Oo({nodePubkey:new Je(e.nodePubkey),authorizedWithdrawer:new Je(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(Do),priorVoters:No(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function Do({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new Je(t)}}function Co({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new Je(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function No({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(Co),...t.slice(0,e).map(Co)]}const zo={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Uo(t,e){const n=!1===e?"http":"https";if(!t)return zo[n].devnet;const r=zo[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r}async function jo(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await t.sendRawTransaction(e,s),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(a,u),d=(await c).value;if(d.err)throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`);return a}const Yo=1e9},64906:(t,e,n)=>{"use strict";var r=n(48764).Buffer,i=n(64836);e.Z=void 0;var o=i(n(64687)),s=i(n(17156)),a=i(n(18698)),u=i(n(56690)),c=i(n(89728)),d=i(n(61655)),l=i(n(94993)),h=i(n(73808)),f=n(26729),p=n(63925);var m=function(t){(0,d.default)(b,t);var e,n,i,f,m,g,y=(m=b,g=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=(0,h.default)(m);if(g){var n=(0,h.default)(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return(0,l.default)(this,t)});function b(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;(0,u.default)(this,b);var s=r.autoconnect,a=void 0===s||s,c=r.reconnect,d=void 0===c||c,l=r.reconnect_interval,h=void 0===l?1e3:l,f=r.max_reconnects,m=void 0===f?5:f,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);in.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),b}(f.EventEmitter);e.Z=m},55852:(t,e,n)=>{"use strict";var r=n(64836);e.Z=function(t,e){return new c(t,e)};var i=r(n(56690)),o=r(n(89728)),s=r(n(61655)),a=r(n(94993)),u=r(n(73808));var c=function(t){(0,s.default)(c,t);var e,n,r=(e=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=(0,u.default)(e);if(n){var i=(0,u.default)(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return(0,a.default)(this,t)});function c(t,e,n){var o;return(0,i.default)(this,c),(o=r.call(this)).socket=new window.WebSocket(t,n),o.socket.onopen=function(){return o.emit("open")},o.socket.onmessage=function(t){return o.emit("message",t.data)},o.socket.onerror=function(t){return o.emit("error",t)},o.socket.onclose=function(t){o.emit("close",t.code,t.reason)},o}return(0,o.default)(c,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),c}(n(26729).EventEmitter)},63925:(t,e,n)=>{"use strict";var r=n(64836);Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDataPack=void 0,e.createError=function(t,e){var n={code:t,message:s.get(t)||"Internal Server Error"};return e&&(n.data=e),n};var i=r(n(56690)),o=r(n(89728)),s=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),a=function(){function t(){(0,i.default)(this,t)}return(0,o.default)(t,[{key:"encode",value:function(t){return JSON.stringify(t)}},{key:"decode",value:function(t){return JSON.parse(t)}}]),t}();e.DefaultDataPack=a},66259:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(14319),e),i(n(51084),e)},46494:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.DecimalUtil=void 0;const i=r(n(13550)),o=r(n(93776));e.DecimalUtil=class{static adjustDecimals(t,e=0){return t.div(o.default.pow(10,e))}static fromBN(t,e=0){return new o.default(t.toString()).div(new o.default(10).pow(e))}static fromNumber(t,e=0){return new o.default(t).div(new o.default(10).pow(e))}static toBN(t,e=0){if(t.isNeg())throw new Error("Negative decimal value ${input} cannot be converted to BN.");const n=t.mul(new o.default(10).pow(e)).trunc();return new i.default(n.toString())}}},14319:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(46494),e),i(n(44667),e),i(n(67399),e)},44667:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MathUtil=e.U64_MAX=e.U128=e.TWO=e.ONE=e.ZERO=void 0;const i=r(n(13550)),o=r(n(93776));e.ZERO=new i.default(0),e.ONE=new i.default(1),e.TWO=new i.default(2),e.U128=e.TWO.pow(new i.default(128)),e.U64_MAX=e.TWO.pow(new i.default(64)).sub(e.ONE),e.MathUtil=class{static toX64_BN(t){return t.mul(new i.default(2).pow(new i.default(64)))}static toX64_Decimal(t){return t.mul(o.default.pow(2,64))}static toX64(t){return new i.default(t.mul(o.default.pow(2,64)).floor().toFixed())}static fromX64(t){return new o.default(t.toString()).mul(o.default.pow(2,-64))}static fromX64_Decimal(t){return t.mul(o.default.pow(2,-64))}static fromX64_BN(t){return t.div(new i.default(2).pow(new i.default(64)))}static shiftRightRoundUp(t){let n=t.shrn(64);return t.mod(e.U64_MAX).gt(e.ZERO)&&(n=n.add(e.ONE)),n}static divRoundUp(t,n){return t.mod(n).eq(e.ZERO)?t.div(n):t.div(n).add(new i.default(1))}static subUnderflowU128(t,n){return t.add(e.U128).sub(n).mod(e.U128)}}},67399:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Percentage=void 0;const i=r(n(13550)),o=r(n(93776));class s{constructor(t,e){this.toString=()=>`${this.numerator.toString()}/${this.denominator.toString()}`,this.numerator=t,this.denominator=e}static fromDecimal(t){return s.fromFraction(t.toDecimalPlaces(1).mul(10).toNumber(),1e3)}static fromFraction(t,e){const n="number"==typeof t?new i.default(t.toString()):t,r="number"==typeof e?new i.default(e.toString()):e;return new s(n,r)}toDecimal(){return this.denominator.eq(new i.default(0))?new o.default(0):new o.default(this.numerator.toString()).div(new o.default(this.denominator.toString()))}add(t){const e=this.denominator.gcd(t.denominator),n=this.denominator.div(e).mul(t.denominator),r=n.div(this.denominator),o=n.div(t.denominator),a=this.numerator.mul(r),u=t.numerator.mul(o),c=a.add(u);return new s(new i.default(c.toString()),new i.default(n.toString()))}}e.Percentage=s},7623:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddressUtil=void 0;const r=n(18245);class i{static toPubKey(t){return t instanceof r.PublicKey?t:new r.PublicKey(t)}static toPubKeys(t){return t.map((t=>i.toPubKey(t)))}static toString(t){return"string"==typeof t?t:i.toPubKey(t).toBase58()}static toStrings(t){return t.map((t=>i.toString(t)))}static findProgramAddress(t,e){const[n,i]=r.PublicKey.findProgramAddressSync(t,e);return{publicKey:n,bump:i}}}e.AddressUtil=i},36208:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolveOrCreateATAs=e.resolveOrCreateATA=void 0;const r=n(29955),i=n(14319),o=n(64911),s=n(67209),a=n(97864);async function u(t,e,n,u,c=e,d=!1,l=!1,h="keypair"){const f=n.filter((({tokenMint:t})=>!t.equals(r.NATIVE_MINT))),p=n.filter((({tokenMint:t})=>t.equals(r.NATIVE_MINT))),m=n.filter((({tokenMint:t})=>t.equals(r.NATIVE_MINT_2022)));if(p.length>1)throw new Error("Cannot resolve multiple WSolAccounts");if(m.length>0)throw new Error("NATIVE_MINT_2022 is not supported");let g={};if(f.length>0){const n=await(0,o.getMultipleParsedAccounts)(t,f.map((t=>t.tokenMint)),o.ParsableMintInfo),i=f.map((({tokenMint:t},i)=>(0,r.getAssociatedTokenAddressSync)(t,e,l,n[i].tokenProgram)));(await(0,o.getMultipleParsedAccounts)(t,i,o.ParsableTokenAccountInfo)).forEach(((t,o)=>{const s=i[o];let u;if(t){if(!t.owner.equals(e))throw new Error(`ATA with change of ownership detected: ${s.toBase58()}`);u={address:s,tokenProgram:t.tokenProgram,...a.EMPTY_INSTRUCTION}}else{const t=d?(0,r.createAssociatedTokenAccountIdempotentInstruction)(c,s,e,f[o].tokenMint,n[o].tokenProgram):(0,r.createAssociatedTokenAccountInstruction)(c,s,e,f[o].tokenMint,n[o].tokenProgram);u={address:s,tokenProgram:n[o].tokenProgram,instructions:[t],cleanupInstructions:[],signers:[]}}g[f[o].tokenMint.toBase58()]=u}))}if(p.length>0){const t=await u(),n=p[0]?.wrappedSolAmountIn||i.ZERO;g[r.NATIVE_MINT.toBase58()]=s.TokenUtil.createWrappedNativeAccountInstruction(e,n,t,c,void 0,h)}return n.map((({tokenMint:t})=>g[t.toBase58()]))}e.resolveOrCreateATA=async function(t,e,n,r,o=i.ZERO,s=e,a=!1,c=!1,d="keypair"){return(await u(t,e,[{tokenMint:n,wrappedSolAmountIn:o}],r,s,a,c,d))[0]},e.resolveOrCreateATAs=u},51084:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(7623),e),i(n(36208),e),i(n(63687),e),i(n(64911),e),i(n(92888),e),i(n(67209),e),i(n(36493),e),i(n(44425),e)},63687:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},59431:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getMultipleAccounts=e.getMultipleAccountsInMap=e.getMultipleParsedAccounts=e.getParsedAccount=void 0;const i=r(n(26018)),o=n(7623);async function s(t,e,n=10,r=100){if(0===e.length)return[];const s=[],a=Math.ceil(e.length/r),u=new Array(a);for(let n=0;n{const r=(await t.getMultipleAccountsInfo(a)).map(((t,e)=>[a[e],t]));u[n]=r,e()}));s.push(c)}var c;await Promise.race([Promise.all(s),(c=n,"connection.getMultipleAccountsInfo timeout",new Promise(((t,e)=>{setTimeout((()=>{e(new Error("connection.getMultipleAccountsInfo timeout"))}),1e3*c)})))]);const d=u.flat();return(0,i.default)(d.length===e.length,"getMultipleAccounts not enough results"),d}e.getParsedAccount=async function(t,e,n){const r=await t.getAccountInfo(o.AddressUtil.toPubKey(e)),i=o.AddressUtil.toPubKey(e);return n.parse(i,r)},e.getMultipleParsedAccounts=async function(t,e,n,r=100){if(0===e.length)return[];const a=(await s(t,o.AddressUtil.toPubKeys(e),10,r)).map((t=>null===t[1]?null:n.parse(t[0],t[1])));return(0,i.default)(a.length===e.length,"not enough results fetched"),a},e.getMultipleAccountsInMap=async function(t,e,n=10,r=100){return(await s(t,e,n,r)).reduce(((t,[e,n])=>(t.set(e.toBase58(),n),t)),new Map)},e.getMultipleAccounts=s},12568:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(26514),e)},26514:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SimpleAccountFetcher=void 0;const r=n(7623),i=n(59431);e.SimpleAccountFetcher=class{constructor(t,e){this.connection=t,this.retentionPolicy=e,this.cache=new Map,this.cache=new Map}async getAccount(t,e,n,i=Date.now()){const o=r.AddressUtil.toPubKey(t),s=r.AddressUtil.toString(t),a=this.cache.get(s),u=this.getMaxAge(this.retentionPolicy.get(e),n),c=a?i-(a?.fetchedAt??0):Number.NEGATIVE_INFINITY;if(a&&!(c>u))return a.value;try{const t=await this.connection.getAccountInfo(o),n=e.parse(o,t);return this.cache.set(s,{parser:e,value:n,fetchedAt:i}),n}catch(t){return this.cache.set(s,{parser:e,value:null,fetchedAt:i}),null}}getMaxAge(t,e){return void 0!==e?.maxAge?e.maxAge:void 0===t?Number.POSITIVE_INFINITY:t}async getAccounts(t,e,n,i=Date.now()){const o=r.AddressUtil.toStrings(t);await this.fetchAndPopulateCache(o,e,n,i);const s=new Map;return o.forEach((t=>{const e=this.cache.get(t),n=e?.value;s.set(t,n)})),s}async getAccountsAsArray(t,e,n,i=Date.now()){const o=r.AddressUtil.toStrings(t);await this.fetchAndPopulateCache(o,e,n,i);const s=new Array;return o.forEach((t=>{const e=this.cache.get(t),n=e?.value;s.push(n)})),s}populateAccounts(t,e,n){Array.from(t.entries()).forEach((([t,r])=>{this.cache.set(t,{parser:e,value:r,fetchedAt:n})}))}async refreshAll(t=Date.now()){const e=Array.from(this.cache.keys()),n=await(0,i.getMultipleAccountsInMap)(this.connection,e);for(const[e,i]of this.cache.entries()){const o=i.parser,s=n.get(e),a=o.parse(r.AddressUtil.toPubKey(e),s);this.cache.set(e,{parser:o,value:a,fetchedAt:t})}}async fetchAndPopulateCache(t,e,n,o=Date.now()){const s=r.AddressUtil.toStrings(t),a=this.getMaxAge(this.retentionPolicy.get(e),n),u=s.filter((t=>{const e=this.cache.get(t),n=e?o-(e?.fetchedAt??0):Number.NEGATIVE_INFINITY;return!e||n>a}));if(u.length>0){const t=await(0,i.getMultipleAccountsInMap)(this.connection,u);u.forEach((n=>{const i=t.get(n),s=e.parse(r.AddressUtil.toPubKey(n),i);this.cache.set(n,{parser:e,value:s,fetchedAt:o})}))}}}},64911:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(59431),e),i(n(12568),e),i(n(52388),e),i(n(21598),e)},52388:function(t,e,n){"use strict";var r=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};Object.defineProperty(e,"__esModule",{value:!0}),e.staticImplements=e.ParsableMintInfo=e.ParsableTokenAccountInfo=void 0;const i=n(29955);let o=class{constructor(){}static parse(t,e){if(!e)return null;try{return{...(0,i.unpackAccount)(t,e,e.owner),tokenProgram:e.owner}}catch(e){return console.error(`error while parsing TokenAccount ${t.toBase58()}: ${e}`),null}}};e.ParsableTokenAccountInfo=o,e.ParsableTokenAccountInfo=o=r([t=>{}],o);let s=class{constructor(){}static parse(t,e){if(!e)return null;try{return{...(0,i.unpackMint)(t,e,e.owner),tokenProgram:e.owner}}catch(e){return console.error(`error while parsing Mint ${t.toBase58()}: ${e}`),null}}};e.ParsableMintInfo=s,e.ParsableMintInfo=s=r([t=>{}],s),e.staticImplements=function(){return t=>{}}},21598:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},92888:(t,e)=>{"use strict";function n(t,e){const n=t.toBytes(),r=e.toBytes();if(n.byteLength!==r.byteLength)return n.byteLength-r.byteLength;for(let t=0;t{const e=t,n=o.TOKEN_PROGRAM_ID,i=r.concat([e.toBuffer(),r.from(c),n.toBuffer()]),u=(0,a.sha256)(i);return new s.PublicKey(u)})(),l=s.SystemProgram.createAccountWithSeed({fromPubkey:i,basePubkey:t,seed:c,newAccountPubkey:d,lamports:e.toNumber()+n,space:o.AccountLayout.span,programId:o.TOKEN_PROGRAM_ID}),h=(0,o.createInitializeAccountInstruction)(d,o.NATIVE_MINT,t),f=(0,o.createCloseAccountInstruction)(d,u,t);return{address:d,tokenProgram:o.TOKEN_PROGRAM_ID,instructions:[l,h],cleanupInstructions:[f],signers:[]}}(t,e,n,l,h);default:throw new Error(`Invalid createAccountMethod: ${d}`)}}static async createSendTokensToWalletInstruction(t,e,n,r,i,a,l,h,f=!1){if((0,u.default)(!a.eq(c.ZERO),"SendToken transaction must send more than 0 tokens."),(0,u.default)(!r.equals(o.NATIVE_MINT_2022),"NATIVE_MINT_2022 is not supported."),r.equals(o.NATIVE_MINT))return{instructions:[s.SystemProgram.transfer({fromPubkey:e,toPubkey:n,lamports:BigInt(a.toString())})],cleanupInstructions:[],signers:[]};const p=await t.getAccountInfo(r);if(null===p)throw Error("Cannot fetch tokenMint.");const m=p.owner,g=(0,o.getAssociatedTokenAddressSync)(r,e,f,m),{address:y,...b}=await(0,d.resolveOrCreateATA)(t,n,r,l,a,h,void 0,!0),w=await(0,o.createTransferCheckedWithTransferHookInstruction)(t,g,r,y,e,BigInt(a.toString()),i,void 0,void 0,m);return{instructions:b.instructions.concat(w),cleanupInstructions:b.cleanupInstructions,signers:b.signers}}}},62313:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getLockWritableAccounts=e.getPriorityFeeInLamports=e.estimateComputeBudgetLimit=e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT=e.DEFAULT_MAX_PRIORITY_FEE_LAMPORTS=e.DEFAULT_PRIORITY_FEE_PERCENTILE=e.MICROLAMPORTS_PER_LAMPORT=void 0;const r=n(18245);e.MICROLAMPORTS_PER_LAMPORT=1e6,e.DEFAULT_PRIORITY_FEE_PERCENTILE=.9,e.DEFAULT_MAX_PRIORITY_FEE_LAMPORTS=1e6,e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT=14e5,e.estimateComputeBudgetLimit=async function(t,n,i,o,s){try{const a=n.flatMap((t=>t.instructions)),u=n.flatMap((t=>t.cleanupInstructions)),c=new r.TransactionMessage({recentBlockhash:r.PublicKey.default.toBase58(),payerKey:o,instructions:[...a,...u]}).compileToV0Message(i),d=new r.VersionedTransaction(c),l=await t.simulateTransaction(d,{sigVerify:!1,replaceRecentBlockhash:!0});if(!l.value.unitsConsumed)return e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT;const h=Math.max(1e5,s*l.value.unitsConsumed),f=Math.ceil(l.value.unitsConsumed+h);return Math.min(e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT,f)}catch{return e.DEFAULT_MAX_COMPUTE_UNIT_LIMIT}},e.getPriorityFeeInLamports=async function(t,n,r,i=e.DEFAULT_PRIORITY_FEE_PERCENTILE){return function(t,e){const n=t.sort(((t,e)=>t.prioritizationFee-e.prioritizationFee));return n[Math.min(Math.max(Math.floor(n.length*e),0),n.length-1)].prioritizationFee}(await t.getRecentPrioritizationFees({lockedWritableAccounts:r}),i)*n/e.MICROLAMPORTS_PER_LAMPORT},e.getLockWritableAccounts=function(t){return t.flatMap((t=>[...t.instructions,...t.cleanupInstructions])).flatMap((t=>t.keys)).filter((t=>t.isWritable)).map((t=>t.pubkey))}},18917:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MEASUREMENT_BLOCKHASH=e.TX_BASE64_ENCODED_SIZE_LIMIT=e.TX_SIZE_LIMIT=void 0;const r=n(18245);e.TX_SIZE_LIMIT=r.PACKET_DATA_SIZE,e.TX_BASE64_ENCODED_SIZE_LIMIT=4*Math.ceil(e.TX_SIZE_LIMIT/3),e.MEASUREMENT_BLOCKHASH={blockhash:"65FJ2gp6jC2x87bycfdZpxDyjiodcAoymxR6PMZzfavY",lastValidBlockHeight:160381350}},36493:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(62313),e),i(n(18917),e),i(n(38801),e),i(n(785),e),i(n(97864),e)},38801:(t,e,n)=>{"use strict";n(48764).Buffer,Object.defineProperty(e,"__esModule",{value:!0}),e.isVersionedTransaction=e.TransactionBuilder=e.defaultTransactionBuilderOptions=void 0;const r=n(18245),i=n(62313),o=n(18917);e.defaultTransactionBuilderOptions={defaultBuildOption:{maxSupportedTransactionVersion:0,blockhashCommitment:"confirmed"},defaultSendOption:{skipPreflight:!1,preflightCommitment:"confirmed",maxRetries:3},defaultConfirmationCommitment:"confirmed"},e.TransactionBuilder=class{constructor(t,n,r){this.connection=t,this.wallet=n,this.instructions=[],this.signers=[],this.opts=r??e.defaultTransactionBuilderOptions}addInstruction(t){return this.instructions.push(t),this}addInstructions(t){return this.instructions=this.instructions.concat(t),this}prependInstruction(t){return this.instructions.unshift(t),this}prependInstructions(t){return this.instructions=t.concat(this.instructions),this}addSigner(t){return this.signers.push(t),this}isEmpty(){return 0==this.instructions.length}compressIx(t){let e=[],n=[],r=[];return this.instructions.forEach((t=>{e=e.concat(t.instructions),n=t.cleanupInstructions.concat(n),r=r.concat(t.signers)})),t&&(e=e.concat(n),n=[]),{instructions:[...e],cleanupInstructions:[...n],signers:r}}txnSize(t){const n={...this.opts.defaultBuildOption,...t,latestBlockhash:o.MEASUREMENT_BLOCKHASH,computeBudgetOption:this.opts.defaultBuildOption.computeBudgetOption??{type:"none"}};if(this.isEmpty())return 0;const i=this.buildSync(n).transaction;return(0,e.isVersionedTransaction)(i)?function(t){let e;try{e=t.serialize()}catch(t){throw new Error("Unable to measure transaction size. Unable to serialize transaction.")}if(e.length>r.PACKET_DATA_SIZE)throw new Error("Unable to measure transaction size. Transaction too large.");return e.length}(i):function(t){const e=new Set;for(const n of t.instructions){for(const t of n.keys)e.add(t.pubkey.toBase58());e.add(n.programId.toBase58())}if(e.size>35)throw new Error("Unable to measure transaction size. Too many unique keys in transaction.");try{return t.serialize({requireAllSignatures:!1}).length}catch(t){throw new Error("Unable to measure transaction size. Unable to serialize transaction.")}}(i)}buildSync(t){const{latestBlockhash:e,maxSupportedTransactionVersion:n,computeBudgetOption:o}=t,s=this.compressIx(!0);let a=[];if("fixed"===o.type){const t=o.computeBudgetLimit??i.DEFAULT_MAX_COMPUTE_UNIT_LIMIT,e=Math.floor(o.priorityFeeLamports*i.MICROLAMPORTS_PER_LAMPORT/t);a=[r.ComputeBudgetProgram.setComputeUnitLimit({units:t}),r.ComputeBudgetProgram.setComputeUnitPrice({microLamports:e})]}"auto"===o.type&&(a=[r.ComputeBudgetProgram.setComputeUnitLimit({units:i.DEFAULT_MAX_COMPUTE_UNIT_LIMIT}),r.ComputeBudgetProgram.setComputeUnitPrice({microLamports:0})]);const u=s.signers.concat(this.signers),c=e;if("legacy"===n){const t=new r.Transaction({...c,feePayer:this.wallet.publicKey});return a.length>0&&t.add(...a),t.add(...s.instructions),t.feePayer=this.wallet.publicKey,{transaction:t,signers:u,recentBlockhash:c}}const d=new r.TransactionMessage({recentBlockhash:c.blockhash,payerKey:this.wallet.publicKey,instructions:[...a,...s.instructions]}),{lookupTableAccounts:l}=t,h=d.compileToV0Message(l);return{transaction:new r.VersionedTransaction(h),signers:u,recentBlockhash:c}}async build(t){const e={...this.opts.defaultBuildOption,...t},{latestBlockhash:n,blockhashCommitment:r,computeBudgetOption:o}=e;let s=n;s||(s=await this.connection.getLatestBlockhash(r));let a=o??{type:"none"};if("auto"===a.type){const t=a.computeLimitMargin??.1,n="legacy"===e.maxSupportedTransactionVersion?void 0:e.lookupTableAccounts,r=await(0,i.estimateComputeBudgetLimit)(this.connection,this.instructions,n,this.wallet.publicKey,t),o=a.computePricePercentile??i.DEFAULT_PRIORITY_FEE_PERCENTILE,s=await(0,i.getPriorityFeeInLamports)(this.connection,r,(0,i.getLockWritableAccounts)(this.instructions),o),u=a.maxPriorityFeeLamports??i.DEFAULT_MAX_PRIORITY_FEE_LAMPORTS;a={type:"fixed",priorityFeeLamports:Math.min(s,u),computeBudgetLimit:r}}return this.buildSync({...e,latestBlockhash:s,computeBudgetOption:a})}async buildAndExecute(t,n,r){const i={...this.opts.defaultSendOption,...n},o=await this.build(t),s=o.transaction,a=r??this.opts.defaultConfirmationCommitment;let u;if((0,e.isVersionedTransaction)(s)){const t=await this.wallet.signTransaction(s);t.sign(o.signers),u=await this.connection.sendTransaction(t,i)}else{const t=await this.wallet.signTransaction(s);o.signers.filter((t=>void 0!==t)).forEach((e=>t.partialSign(e))),u=await this.connection.sendRawTransaction(t.serialize(),i)}const c=(await this.connection.confirmTransaction({signature:u,...o.recentBlockhash},a)).value.err;if(c)throw new Error(c.toString());return u}},e.isVersionedTransaction=t=>"version"in t},785:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionProcessor=void 0;const r=n(38801);e.TransactionProcessor=class{constructor(t,e,n="confirmed"){this.connection=t,this.wallet=e,this.commitment=n}async signTransaction(t){const{transactions:e,lastValidBlockHeight:n,blockhash:r}=await this.signTransactions([t]);return{transaction:e[0],lastValidBlockHeight:n,blockhash:r}}async signTransactions(t){const{blockhash:e,lastValidBlockHeight:n}=await this.connection.getLatestBlockhash(this.commitment),i=this.wallet.publicKey,o=t.map((t=>function(t,e,n){if((0,r.isVersionedTransaction)(t.transaction)){let e=t.transaction;return t.signers&&e.sign(t.signers??[]),e}{let r=t.transaction,i=t.signers??[];return r.feePayer=e,r.recentBlockhash=n,i.forEach((t=>{r.partialSign(t)})),r}}(t,i,e)));return{transactions:await this.wallet.signAllTransactions(o),lastValidBlockHeight:n,blockhash:e}}async sendTransaction(t,e,n){const r=this.constructSendTransactions([t],e,n),i=(await r())[0];if("fulfilled"===i.status)return i.value;throw i.reason}constructSendTransactions(t,e,n,r=!0){const i=async t=>{const e=t.serialize();return this.connection.sendRawTransaction(e,{preflightCommitment:this.commitment})},o=async t=>{const r=await this.connection.confirmTransaction({signature:t,lastValidBlockHeight:e,blockhash:n},this.commitment);if(r.value.err)throw new Error(`Transaction failed: ${JSON.stringify(r.value)}`)};return async()=>{if(r){const e=t.map((async t=>{const e=await i(t);return await o(e),e}));return Promise.allSettled(e)}{const e=[];for(const n of t){const t=await i(n);await o(t),e.push(t)}return Promise.allSettled(e)}}}async signAndConstructTransaction(t){const{transaction:e,lastValidBlockHeight:n,blockhash:r}=await this.signTransaction(t);return{signedTx:e,execute:async()=>this.sendTransaction(e,n,r)}}async signAndConstructTransactions(t,e=!0){const{transactions:n,lastValidBlockHeight:r,blockhash:i}=await this.signTransactions(t);return{signedTxs:n,execute:this.constructSendTransactions(n,r,i,e)}}}},97864:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_INSTRUCTION=void 0,e.EMPTY_INSTRUCTION={instructions:[],cleanupInstructions:[],signers:[]}},44425:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ReadOnlyWallet=void 0;const r=n(18245);e.ReadOnlyWallet=class{constructor(t=r.PublicKey.default){this.publicKey=t}signTransaction(t){throw new Error("Read only wallet cannot sign transaction.")}signAllTransactions(t){throw new Error("Read only wallet cannot sign transactions.")}}},68795:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCubicRoots=void 0;var r=n(93776),i=new r.Decimal(-1),o=new r.Decimal(0),s=new r.Decimal(1),a=new r.Decimal(2),u=new r.Decimal(3),c=a.pow(-52),d=function(t,e){this.real=t,this.imag=e};function l(t){return t.gt(o)?s:t.lt(o)?i:o}function h(t){var e=r.Decimal.floor(t),n=r.Decimal.ceil(t),i=t.sub(e).abs(),o=t.sub(n).abs();return i.gt(o)?o:i}function f(t,e,n,r,i){var o=e.mul(t),s=o.add(n),a=s.mul(t).add(r);return{Q:a.mul(t).add(i),dQ:o.add(s).mul(t).add(a),B1:s,C2:a}}e.getCubicRoots=function(t,e,n,i){var p,m,g,y,b=[];if(t.eq(o))m=e,g=n,y=i;else if(i.eq(o))p=o,m=t,g=e,y=n,b.push(new d(p,o));else{m=t;var w=f(p=e.div(t).div(u).neg(),t,e,n,i),_=w.Q,v=w.dQ;g=w.B1,y=w.C2;var k=_.div(t),M=k.abs().cubeRoot(),A=l(k);(k=v.div(t).neg()).gt(o)&&(M=new r.Decimal("1.324717957244746").mul(r.Decimal.max(M,k.sqrt())));var S=p.sub(A.mul(M));if(!S.eq(p)){var I=c.mul(100).add(s);do{_=(w=f(p=S,t,e,n,i)).Q,v=w.dQ,g=w.B1,y=w.C2,S=v.eq(o)?p:p.sub(_.div(v).div(I))}while(A.mul(S).gt(A.mul(p)));t.abs().mul(p).mul(p).gt(i.div(p).abs())&&(g=(y=i.div(p).neg()).sub(n).div(p))}b.push(new d(p,o))}var x=function(t,e,n){var i=e.div(a).neg(),s=function(t,e,n){var i=t,s=e,a=n;if(r.Decimal.floor(t).sub(t).abs().eq(o)&&r.Decimal.floor(s).sub(s).abs().eq(o)&&r.Decimal.floor(n).sub(n).abs().eq(o)){i.mul(a).gt(o)&&(i=t.abs(),a=n.abs());var u=!1;do{if(u=!1,i{"use strict";e.Ek=void 0;var r=n(91113),i=(n(93776),n(68795),new r.u64(0)),o=new r.u64(1),s=new r.u64(2),a=(new r.u64(3),new r.u64(4),new r.u64(8),new r.u64(16),s),u=new r.u64(4);function c(t,e,n,r){var i=e.mul(n),s=r.mul(a),u=i.add(s).mul(t),c=t.mul(e.sub(o)),d=r.mul(a.add(o)),l=c.add(d);return u.div(l)}e.Ek=function(t,e,n,d){var l=d.mul(a),h=function(t,e,n){for(var r,i=n.pow(a.add(o)).div(e.mul(u).mul(t)),c=e.add(n.div(t)),d=n,l=0;l<32&&(r=d,!(d=d.sqr().add(i).div(d.mul(s).add(c).sub(n))).eq(r));l++);return d}(l,t.add(e),function(t,e,n){var r,s=e.mul(a).add(o),u=n.mul(a).add(o),d=e.add(n);if(d.eq(i))return i;for(var l=d,h=0;h<32&&(r=l,!(l=c(l,t,d,l.mul(l).div(s).mul(l).div(u))).eq(r));h++);return l}(l,e,n)),f=n.sub(h);return new r.u64(f.toString())}},91113:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ASSOCIATED_TOKEN_PROGRAM_ID:()=>fo,AccountLayout:()=>ko,MintLayout:()=>vo,NATIVE_MINT:()=>_o,TOKEN_PROGRAM_ID:()=>ho,Token:()=>Ao,u64:()=>yo});var r={};n.r(r),n.d(r,{dQ:()=>Q,ci:()=>Y,bytesToNumberBE:()=>q,ty:()=>V,eV:()=>J,n$:()=>nt,ql:()=>X,hexToBytes:()=>K,_t:()=>U,tL:()=>G,S5:()=>Z,FF:()=>it});var i=n(64572),o=n(13550),s=n.n(o),a=n(48764);function u(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function c(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function d(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function l(t,e){c(t);const n=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),m=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function g(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function y(t){if("string"==typeof t&&(t=g(t)),!f(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function b(...t){let e=0;for(let n=0;nt().update(y(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function v(t=32){if(h&&"function"==typeof h.getRandomValues)return h.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class k extends w{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=p(this.buffer)}update(t){d(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=y(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=p(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t>A&M)}:{h:0|Number(t>>A&M),l:0|Number(t&M)}}function I(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it<>>32-n,E=(t,e,n)=>e<>>32-n,T=(t,e,n)=>e<>>64-n,P=(t,e,n)=>t<>>64-n,B={fromBig:S,split:I,toBig:(t,e)=>BigInt(t>>>0)<>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:x,rotlSL:E,rotlBH:T,rotlBL:P,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[L,$]=(()=>B.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),R=new Uint32Array(80),O=new Uint32Array(80);class D extends k{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)R[n]=t.getUint32(e),O[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|R[t-15],n=0|O[t-15],r=B.rotrSH(e,n,1)^B.rotrSH(e,n,8)^B.shrSH(e,n,7),i=B.rotrSL(e,n,1)^B.rotrSL(e,n,8)^B.shrSL(e,n,7),o=0|R[t-2],s=0|O[t-2],a=B.rotrSH(o,s,19)^B.rotrBH(o,s,61)^B.shrSH(o,s,6),u=B.rotrSL(o,s,19)^B.rotrBL(o,s,61)^B.shrSL(o,s,6),c=B.add4L(i,u,O[t-7],O[t-16]),d=B.add4H(c,r,a,R[t-7],R[t-16]);R[t]=0|d,O[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=B.rotrSH(d,l,14)^B.rotrSH(d,l,18)^B.rotrBH(d,l,41),b=B.rotrSL(d,l,14)^B.rotrSL(d,l,18)^B.rotrBL(d,l,41),w=d&h^~d&p,_=l&f^~l&m,v=B.add5L(y,b,_,$[t],O[t]),k=B.add5H(v,g,e,w,L[t],R[t]),M=0|v,A=B.rotrSH(n,r,28)^B.rotrBH(n,r,34)^B.rotrBH(n,r,39),S=B.rotrSL(n,r,28)^B.rotrBL(n,r,34)^B.rotrBL(n,r,39),I=n&i^n&s^i&s,x=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|d,f=0|l,({h:d,l}=B.add(0|u,0|c,0|k,0|M)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const E=B.add3L(M,S,x);n=B.add3H(E,k,A,I),r=0|E}({h:n,l:r}=B.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=B.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=B.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=B.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=B.add(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=B.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=B.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=B.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y)}roundClean(){R.fill(0),O.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const C=_((()=>new D)),N=(BigInt(0),BigInt(1)),z=BigInt(2);function U(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const j=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Y(t){if(!U(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n=W._0&&t<=W._9?t-W._0:t>=W._A&&t<=W._F?t-(W._A-10):t>=W._a&&t<=W._f?t-(W._a-10):void 0}function K(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(z<new Uint8Array(t),et=t=>Uint8Array.from(t);function nt(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=tt(t),i=tt(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=tt())=>{i=a(et([0]),t),r=a(),0!==t.length&&(i=a(et([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const rt={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||U(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function it(t,e,n={}){const r=(e,n,r)=>{const i=rt[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const ot=BigInt(0),st=BigInt(1),at=BigInt(2),ut=BigInt(3),ct=BigInt(4),dt=BigInt(5),lt=BigInt(8);function ht(t,e){const n=t%e;return n>=ot?n:e+n}function ft(t,e,n){if(n<=ot||e 0");if(n===st)return ot;let r=st;for(;e>ot;)e&st&&(r=r*t%n),t=t*t%n,e>>=st;return r}function pt(t,e,n){let r=t;for(;e-- >ot;)r*=r,r%=n;return r}function mt(t,e){if(t===ot||e<=ot)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=ht(t,e),r=e,i=ot,o=st,s=st,a=ot;for(;n!==ot;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==st)throw new Error("invert: does not exist");return ht(i,e)}BigInt(9),BigInt(16);const gt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function yt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function bt(t,e,n=!1,r={}){if(t<=ot)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=yt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%ct===ut){const e=(t+st)/ct;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%lt===dt){const e=(t-dt)/lt;return function(t,n){const r=t.mul(n,at),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,at),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-st)/at;let n,r,i;for(n=t-st,r=0;n%at===ot;n/=at,r++);for(i=at;iht(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return ot<=e&&et===ot,isOdd:t=>(t&st)===st,neg:e=>ht(-e,t),eql:(t,e)=>t===e,sqr:e=>ht(e*e,t),add:(e,n)=>ht(e+n,t),sub:(e,n)=>ht(e-n,t),mul:(e,n)=>ht(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===ot)return t.ONE;if(n===st)return e;let r=t.ONE,i=e;for(;n>ot;)n&st&&(r=t.mul(r,i)),i=t.sqr(i),n>>=st;return r}(a,t,e),div:(e,n)=>ht(e*mt(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>mt(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?Z(t,o):G(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?V(t):q(t)}});return Object.freeze(a)}function wt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function _t(t){const e=wt(t);return e+Math.ceil(e/2)}const vt=BigInt(0),kt=BigInt(1);function Mt(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>vt;)n&kt&&(r=r.add(i)),i=i.double(),n>>=kt;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=kt);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function At(t){return it(t.Fp,gt.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),it(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...yt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const St=BigInt(0),It=BigInt(1),xt=BigInt(2),Et=BigInt(8),Tt={zip215:!0};function Pt(t){const e=function(t){const e=At(t);return it(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=xt<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:St}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&Stp(t)&&p(e)&&tt===St||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===St?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,It,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(xt*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===St)return this.double();const r=d(s*xt*h),f=d(a*xt*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===St?M:this.equals(M)||e===It?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?Et:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:St,y:It};if(u!==It)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===It?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=X("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=V(a);h===St||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-It),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&It)===It,_=0!=(128&u);if(!r&&b===St&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return x(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=Z(e,n.BYTES);return r[r.length-1]|=t&It?128:0,r}toHex(){return Y(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,It,d(e.Gx*e.Gy)),v.ZERO=new v(St,It,It,St);const{BASE:k,ZERO:M}=v,A=Mt(v,8*a);function S(t){return ht(t,r)}function I(t){return S(V(t))}function x(t){const e=a;t=X("private key",t,e);const n=X("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function E(t=new Uint8Array,...e){const n=J(...e);return I(o(f(n,X("context",t),!!i)))}const T=Tt;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return x(t).pointBytes},sign:function(t,e,r={}){t=X("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=x(e),c=E(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+E(r.context,d,u,t)*s);return b(l),X("result",J(d,Z(l,n.BYTES)),2*a)},verify:function(t,e,r,o=T){const{context:s,zip215:a}=o,u=n.BYTES;t=X("signature",t,2*u),e=X("message",e),i&&(e=i(e));const c=V(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=E(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const Bt=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Lt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),$t=(BigInt(0),BigInt(1)),Rt=BigInt(2),Ot=BigInt(5),Dt=BigInt(10),Ct=BigInt(20),Nt=BigInt(40),zt=BigInt(80);const Ut=bt(Bt,void 0,!0),jt={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ut,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:C,randomBytes:v,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=Bt,r=ht(e*e*e,n),i=ht(r*r*e,n);let o=ht(t*r*function(t){const e=Bt,n=t*t%e*t%e,r=pt(n,Rt,e)*n%e,i=pt(r,$t,e)*t%e,o=pt(i,Ot,e)*i%e,s=pt(o,Dt,e)*o%e,a=pt(s,Ct,e)*s%e,u=pt(a,Nt,e)*a%e,c=pt(u,zt,e)*u%e,d=pt(c,zt,e)*u%e,l=pt(d,Dt,e)*o%e;return{pow_p_5_8:pt(l,Rt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=ht(e*o*o,n),a=o,u=ht(o*Lt,n),c=s===t,d=s===ht(-t,n),l=s===ht(-t*Lt,n);return c&&(o=a),(d||l)&&(o=u),(ht(o,n)&st)===st&&(o=ht(-o,n)),{isValid:c||d,value:o}}},Yt=Pt(jt);const Ft=(Ut.ORDER+BigInt(3))/BigInt(8);Ut.pow(Rt,Ft),Ut.sqrt(Ut.neg(Ut.ONE)),Ut.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(Ut,Ut.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Wt=n(77191),Ht=n.n(Wt);const Kt=(t,e,n)=>t&e^t&n^e&n,qt=new Uint32Array([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]),Vt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Gt=new Uint32Array(64);class Zt extends k{constructor(){super(64,32,8,!1),this.A=0|Vt[0],this.B=0|Vt[1],this.C=0|Vt[2],this.D=0|Vt[3],this.E=0|Vt[4],this.F=0|Vt[5],this.G=0|Vt[6],this.H=0|Vt[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Gt[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Gt[t-15],n=Gt[t-2],r=m(e,7)^m(e,18)^e>>>3,i=m(n,17)^m(n,19)^n>>>10;Gt[t]=i+Gt[t-7]+r+Gt[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(m(s,6)^m(s,11)^m(s,25))+((d=s)&a^~d&u)+qt[t]+Gt[t]|0,l=(m(n,2)^m(n,13)^m(n,22))+Kt(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){Gt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Xt=_((()=>new Zt));var Jt=n(25532),Qt=n(39386),te=n(40475),ee=n(53471);n(31198),n(48990),n(46299);const[ne,re,ie]=[[],[],[]],oe=BigInt(0),se=BigInt(1),ae=BigInt(2),ue=BigInt(7),ce=BigInt(256),de=BigInt(113);for(let t=0,e=se,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],ne.push(2*(5*r+n)),re.push((t+1)*(t+2)/2%64);let i=oe;for(let t=0;t<7;t++)e=(e<>ue)*de)%ce,e&ae&&(i^=se<<(se<n>32?T(t,e,n):x(t,e,n),pe=(t,e,n)=>n>32?P(t,e,n):E(t,e,n);class me extends w{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,u(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=fe(o,s,1)^n[r],u=pe(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=re[n],o=fe(e,i,r),s=pe(e,i,r),a=ne[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=le[r],t[1]^=he[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){d(this);const{blockLen:e,state:n}=this,r=(t=y(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return u(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(l(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new me(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const ge=((t,e,n)=>_((()=>new me(e,t,n))))(1,136,32);class ye extends w{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");u(t.outputLen),u(t.blockLen)}(t);const n=y(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew ye(t,e).update(n).digest();be.create=(t,e)=>new ye(t,e);const{bytesToNumberBE:we,hexToBytes:_e}=r,ve={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=ve;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:we(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=ve,n="string"==typeof t?_e(t):t;if(!U(n))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=ve._parseInt(n.subarray(2)),{d:s,l:a}=ve._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},ke=BigInt(0),Me=BigInt(1),Ae=(BigInt(2),BigInt(3));function Se(t){const e=function(t){const e=At(t);return it(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return ht(t,r)}function a(t){return mt(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=At(t);it(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return J(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&ken.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(X("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,Ae),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,Ae);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===ke)return r;if(a(t),t===Me)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>ke||c>ke;)s&Me&&(d=d.add(p)),c&Me&&(h=h.add(p)),p=p.double(),s>>=Me,c>>=Me;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==ke&&e!==Me&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Me)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Me?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return Y(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=Mt(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=J;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=q(s);if(!(ke<(a=t)&&aY(G(t,e.nByteLength));function f(t){return t>r>>Me}const p=(t,e,n)=>q(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=X("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=ve.toSig(X("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(X("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return K(this.toDERHex())}toDERHex(){return ve.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return K(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=_t(e.n);return function(t,e,n=!1){const r=t.length,i=wt(e),o=_t(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=ht(n?q(t):V(t),e-st)+st;return n?Z(s,i):G(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=U(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=q(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=Q(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(ke<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return G(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=X("msgHash",t),p&&(t=X("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g){const t=!0===g?d(n.BYTES):g;M.push(X("extraEntropy",t))}const A=J(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===ke)return;const o=s(n*s(S+i*_));if(o===ke)return;let c=(r.x===i?0:2)|Number(r.y&Me),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return nt(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=X("msgHash",n),r=X("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||U(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof ve.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function Ie(t){return{hash:t,hmac:(e,...n)=>be(t,e,b(...n)),randomBytes:v}}BigInt(4);const xe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ee=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Te=BigInt(1),Pe=BigInt(2),Be=(t,e)=>(t+e/Pe)/e;const Le=bt(xe,void 0,void 0,{sqrt:function(t){const e=xe,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=pt(d,n,e)*d%e,h=pt(l,n,e)*d%e,f=pt(h,Pe,e)*c%e,p=pt(f,i,e)*f%e,m=pt(p,o,e)*p%e,g=pt(m,a,e)*m%e,y=pt(g,u,e)*g%e,b=pt(y,a,e)*m%e,w=pt(b,n,e)*d%e,_=pt(w,s,e)*p%e,v=pt(_,r,e)*c%e,k=pt(v,Pe,e);if(!Le.eql(Le.sqr(k),t))throw new Error("Cannot find square root");return k}}),$e=function(t,e){const n=e=>Se({...t,...Ie(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Le,n:Ee,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Ee,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Te*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=Be(o*t,e),u=Be(-r*t,e);let c=ht(t-a*n-u*i,e),d=ht(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},Xt);BigInt(0),$e.ProjectivePoint,Yt.utils.randomPrivateKey;const Re=()=>{const t=Yt.utils.randomPrivateKey(),e=Oe(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},Oe=Yt.getPublicKey;function De(t){try{return Yt.ExtendedPoint.fromHex(t),!0}catch{return!1}}const Ce=(t,e)=>Yt.sign(t,e.slice(0,32)),Ne=Yt.verify,ze=t=>a.Buffer.isBuffer(t)?t:t instanceof Uint8Array?a.Buffer.from(t.buffer,t.byteOffset,t.byteLength):a.Buffer.from(t);class Ue{constructor(t){Object.assign(this,t)}encode(){return a.Buffer.from((0,Jt.serialize)(je,this))}static decode(t){return(0,Jt.deserialize)(je,this,t)}static decodeUnchecked(t){return(0,Jt.deserializeUnchecked)(je,this,t)}}const je=new Map;var Ye;let Fe;const We=32;let He=1;Fe=Symbol.toStringTag;class Ke extends Ue{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Ht().decode(t);if(e.length!=We)throw new Error("Invalid public key input");this._bn=new(s())(e)}else this._bn=new(s())(t);if(this._bn.byteLength()>We)throw new Error("Invalid public key input")}}static unique(){const t=new Ke(He);return He+=1,new Ke(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Ht().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(a.Buffer);if(t.length===We)return t;const e=a.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Fe](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=a.Buffer.concat([t.toBuffer(),a.Buffer.from(e),n.toBuffer()]),i=Xt(r);return new Ke(i)}static createProgramAddressSync(t,e){let n=a.Buffer.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=a.Buffer.concat([n,ze(t)])})),n=a.Buffer.concat([n,e.toBuffer(),a.Buffer.from("ProgramDerivedAddress")]);const r=Xt(n);if(De(r))throw new Error("Invalid seeds, address must fall off the curve");return new Ke(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const i=t.concat(a.Buffer.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return De(new Ke(t).toBytes())}}Ye=Ke,Ke.default=new Ye("11111111111111111111111111111111"),je.set(Ke,{kind:"struct",fields:[["_bn","u256"]]}),new Ke("BPFLoader1111111111111111111111111111111111");class qe extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(qe.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class Ve extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Ve.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Ge extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Ge.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class Ze{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const Xe=(t="publicKey")=>Qt.blob(32,t),Je=(t="string")=>{const e=Qt.struct([Qt.u32("length"),Qt.u32("lengthPadding"),Qt.blob(Qt.offset(Qt.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=(t,e)=>n(t,e).chars.toString(),i.encode=(t,e,n)=>{const i={chars:a.Buffer.from(t,"utf8")};return r(i,e,n)},i.alloc=t=>Qt.u32().span+Qt.u32().span+a.Buffer.from(t,"utf8").length,i};function Qe(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return Qe({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function tn(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function en(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function nn(t,e){if(!t)throw new Error(e||"Assertion failed")}class rn{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new rn(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];nn(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{nn(e.length>0,"Expected at least one writable signer key");const[t]=e[0];nn(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Ke(t))),...n.map((([t])=>new Ke(t))),...r.map((([t])=>new Ke(t))),...i.map((([t])=>new Ke(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Ke(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(nn(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}class on{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Ke(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Ht().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new Ze(this.staticAccountKeys)}static compile(t){const e=rn.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new Ze(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Ht().encode(t.data)})));return new on({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];en(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Ht().decode(t.data));let i=[];en(i,e.length);let o=[];return en(o,r.length),{programIdIndex:n,keyIndicesCount:a.Buffer.from(i),keyIndices:e,dataLength:a.Buffer.from(o),data:r}}));let r=[];en(r,n.length);let i=a.Buffer.alloc(1232);a.Buffer.from(r).copy(i);let o=r.length;n.forEach((t=>{const e=Qt.struct([Qt.u8("programIdIndex"),Qt.blob(t.keyIndicesCount.length,"keyIndicesCount"),Qt.seq(Qt.u8("keyIndex"),t.keyIndices.length,"keyIndices"),Qt.blob(t.dataLength.length,"dataLength"),Qt.seq(Qt.u8("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);const s=Qt.struct([Qt.blob(1,"numRequiredSignatures"),Qt.blob(1,"numReadonlySignedAccounts"),Qt.blob(1,"numReadonlyUnsignedAccounts"),Qt.blob(e.length,"keyCount"),Qt.seq(Xe("key"),t,"keys"),Xe("recentBlockhash")]),u={numRequiredSignatures:a.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:a.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:a.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:a.Buffer.from(e),keys:this.accountKeys.map((t=>ze(t.toBytes()))),recentBlockhash:Ht().decode(this.recentBlockhash)};let c=a.Buffer.alloc(2048);const d=s.encode(u,c);return i.copy(c,d),c.slice(0,d+i.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(127&n))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=e.shift(),i=e.shift(),o=tn(e);let s=[];for(let t=0;t({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class un{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new an(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Ke(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Ht().encode(e)}}));return f.forEach((t=>{nn(t.programIdIndex>=0),t.accounts.forEach((t=>nn(t>=0)))})),new on({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=Ce(n,t.secretKey);this._addSignature(t.publicKey,ze(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){nn(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=a.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):Ne(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];en(n,e.length);const r=n.length+64*e.length+t.length,i=a.Buffer.alloc(r);return nn(e.length<256),a.Buffer.from(n).copy(i,0),e.forEach((({signature:t},e)=>{null!==t&&(nn(64===t.length,"signature has invalid length"),a.Buffer.from(t).copy(i,n.length+64*e))})),t.copy(i,n.length+64*e.length),nn(i.length<=1232,`Transaction too large: ${i.length} > 1232`),i}get keys(){return nn(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return nn(1===this.instructions.length),this.instructions[0].programId}get data(){return nn(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=tn(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Ht().encode(sn)?null:Ht().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new an({keys:r,programId:t.accountKeys[e.programIdIndex],data:Ht().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}const cn=new Ke("SysvarC1ock11111111111111111111111111111111"),dn=(new Ke("SysvarEpochSchedu1e111111111111111111111111"),new Ke("Sysvar1nstructions1111111111111111111111111"),new Ke("SysvarRecentB1ockHashes11111111111111111111")),ln=new Ke("SysvarRent111111111111111111111111111111111"),hn=(new Ke("SysvarRewards111111111111111111111111111111"),new Ke("SysvarS1otHashes111111111111111111111111111"),new Ke("SysvarS1otHistory11111111111111111111111111"),new Ke("SysvarStakeHistory1111111111111111111111111"));async function fn(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function pn(t){return new Promise((e=>setTimeout(e,t)))}function mn(t,e){const n=t.layout.span>=0?t.layout.span:Qe(t,e),r=a.Buffer.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}const gn=Qt.nu64("lamportsPerSignature"),yn=Qt.struct([Qt.u32("version"),Qt.u32("state"),Xe("authorizedPubkey"),Xe("nonce"),Qt.struct([gn],"feeCalculator")]).span,bn=(8,t=>{const e=(0,Qt.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),i=e;return i.decode=(t,e)=>{const n=r(t,e);return(0,te.toBigIntLE)(a.Buffer.from(n))},i.encode=(t,e,r)=>{const i=(0,te.toBufferLE)(t,8);return n(i,e,r)},i});const wn=Object.freeze({Create:{index:0,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports"),Qt.ns64("space"),Xe("programId")])},Assign:{index:1,layout:Qt.struct([Qt.u32("instruction"),Xe("programId")])},Transfer:{index:2,layout:Qt.struct([Qt.u32("instruction"),bn("lamports")])},CreateWithSeed:{index:3,layout:Qt.struct([Qt.u32("instruction"),Xe("base"),Je("seed"),Qt.ns64("lamports"),Qt.ns64("space"),Xe("programId")])},AdvanceNonceAccount:{index:4,layout:Qt.struct([Qt.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:Qt.struct([Qt.u32("instruction"),Xe("authorized")])},AuthorizeNonceAccount:{index:7,layout:Qt.struct([Qt.u32("instruction"),Xe("authorized")])},Allocate:{index:8,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("space")])},AllocateWithSeed:{index:9,layout:Qt.struct([Qt.u32("instruction"),Xe("base"),Je("seed"),Qt.ns64("space"),Xe("programId")])},AssignWithSeed:{index:10,layout:Qt.struct([Qt.u32("instruction"),Xe("base"),Je("seed"),Xe("programId")])},TransferWithSeed:{index:11,layout:Qt.struct([Qt.u32("instruction"),bn("lamports"),Je("seed"),Xe("programId")])},UpgradeNonceAccount:{index:12,layout:Qt.struct([Qt.u32("instruction")])}});class _n{constructor(){}static createAccount(t){const e=mn(wn.Create,{lamports:t.lamports,space:t.space,programId:ze(t.programId.toBuffer())});return new an({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;return"basePubkey"in t?(e=mn(wn.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:ze(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=mn(wn.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new an({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;return"basePubkey"in t?(e=mn(wn.AssignWithSeed,{base:ze(t.basePubkey.toBuffer()),seed:t.seed,programId:ze(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=mn(wn.Assign,{programId:ze(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new an({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=mn(wn.CreateWithSeed,{base:ze(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:ze(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new an({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new un;"basePubkey"in t&&"seed"in t?e.add(_n.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:yn,programId:this.programId})):e.add(_n.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:yn,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=mn(wn.InitializeNonceAccount,{authorized:ze(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:dn,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new an(n)}static nonceAdvance(t){const e=mn(wn.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:dn,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new an(n)}static nonceWithdraw(t){const e=mn(wn.WithdrawNonceAccount,{lamports:t.lamports});return new an({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:dn,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=mn(wn.AuthorizeNonceAccount,{authorized:ze(t.newAuthorizedPubkey.toBuffer())});return new an({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;return"basePubkey"in t?(e=mn(wn.AllocateWithSeed,{base:ze(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:ze(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=mn(wn.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new an({keys:n,programId:this.programId,data:e})}}_n.programId=new Ke("11111111111111111111111111111111");class vn{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/vn.chunkSize)+1+1)}static async load(t,e,n,r,i){{const o=await t.getMinimumBalanceForRentExemption(i.length),s=await t.getAccountInfo(n.publicKey,"confirmed");let a=null;if(null!==s){if(s.executable)return console.error("Program load failed, account is already executable"),!1;s.data.length!==i.length&&(a=a||new un,a.add(_n.allocate({accountPubkey:n.publicKey,space:i.length}))),s.owner.equals(r)||(a=a||new un,a.add(_n.assign({accountPubkey:n.publicKey,programId:r}))),s.lamports0?o:1,space:i.length,programId:r}));null!==a&&await fn(t,a,[e,n],{commitment:"confirmed"})}const o=Qt.struct([Qt.u32("instruction"),Qt.u32("offset"),Qt.u32("bytesLength"),Qt.u32("bytesLengthPadding"),Qt.seq(Qt.u8("byte"),Qt.offset(Qt.u32(),-8),"bytes")]),s=vn.chunkSize;let u=0,c=i,d=[];for(;c.length>0;){const i=c.slice(0,s),l=a.Buffer.alloc(s+16);o.encode({instruction:0,offset:u,bytes:i,bytesLength:0,bytesLengthPadding:0},l);const h=(new un).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push(fn(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await pn(1e3/t)}u+=s,c=c.slice(s)}await Promise.all(d);{const i=Qt.struct([Qt.u32("instruction")]),o=a.Buffer.alloc(i.span);i.encode({instruction:1},o);const s=(new un).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1}],programId:r,data:o}),u="processed",c=await t.sendTransaction(s,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:s.lastValidBlockHeight,blockhash:s.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}vn.chunkSize=932,new Ke("BPFLoader2111111111111111111111111111111111"),Object.prototype.toString,Object.keys,globalThis.fetch,Qt.struct([Qt.u32("typeIndex"),bn("deactivationSlot"),Qt.nu64("lastExtendedSlot"),Qt.u8("lastExtendedStartIndex"),Qt.u8(),Qt.seq(Xe(),Qt.offset(Qt.u8(),-1),"authority")]);const kn=(0,ee.oQ)((0,ee.eE)(Ke),(0,ee.Z_)(),(t=>new Ke(t))),Mn=(0,ee.bc)([(0,ee.Z_)(),(0,ee.i0)("base64")]),An=(0,ee.oQ)((0,ee.eE)(a.Buffer),Mn,(t=>a.Buffer.from(t[0],"base64")));function Sn(t){return(0,ee.G0)([(0,ee.dt)({jsonrpc:(0,ee.i0)("2.0"),id:(0,ee.Z_)(),result:t}),(0,ee.dt)({jsonrpc:(0,ee.i0)("2.0"),id:(0,ee.Z_)(),error:(0,ee.dt)({code:(0,ee._4)(),message:(0,ee.Z_)(),data:(0,ee.jt)((0,ee.Yj)())})})])}const In=Sn((0,ee._4)());function xn(t){return(0,ee.oQ)(Sn(t),In,(e=>"error"in e?e:{...e,result:(0,ee.Ue)(e.result,t)}))}function En(t){return xn((0,ee.dt)({context:(0,ee.dt)({slot:(0,ee.Rx)()}),value:t}))}function Tn(t){return(0,ee.dt)({context:(0,ee.dt)({slot:(0,ee.Rx)()}),value:t})}const Pn=(0,ee.dt)({foundation:(0,ee.Rx)(),foundationTerm:(0,ee.Rx)(),initial:(0,ee.Rx)(),taper:(0,ee.Rx)(),terminal:(0,ee.Rx)()}),Bn=(xn((0,ee.IX)((0,ee.AG)((0,ee.dt)({epoch:(0,ee.Rx)(),effectiveSlot:(0,ee.Rx)(),amount:(0,ee.Rx)(),postBalance:(0,ee.Rx)(),commission:(0,ee.jt)((0,ee.AG)((0,ee.Rx)()))})))),(0,ee.IX)((0,ee.dt)({slot:(0,ee.Rx)(),prioritizationFee:(0,ee.Rx)()}))),Ln=(0,ee.dt)({total:(0,ee.Rx)(),validator:(0,ee.Rx)(),foundation:(0,ee.Rx)(),epoch:(0,ee.Rx)()}),$n=(0,ee.dt)({epoch:(0,ee.Rx)(),slotIndex:(0,ee.Rx)(),slotsInEpoch:(0,ee.Rx)(),absoluteSlot:(0,ee.Rx)(),blockHeight:(0,ee.jt)((0,ee.Rx)()),transactionCount:(0,ee.jt)((0,ee.Rx)())}),Rn=(0,ee.dt)({slotsPerEpoch:(0,ee.Rx)(),leaderScheduleSlotOffset:(0,ee.Rx)(),warmup:(0,ee.O7)(),firstNormalEpoch:(0,ee.Rx)(),firstNormalSlot:(0,ee.Rx)()}),On=(0,ee.IM)((0,ee.Z_)(),(0,ee.IX)((0,ee.Rx)())),Dn=(0,ee.AG)((0,ee.G0)([(0,ee.dt)({}),(0,ee.Z_)()])),Cn=(0,ee.dt)({err:Dn}),Nn=(0,ee.i0)("receivedSignature");(0,ee.dt)({"solana-core":(0,ee.Z_)(),"feature-set":(0,ee.jt)((0,ee.Rx)())}),En((0,ee.dt)({err:(0,ee.AG)((0,ee.G0)([(0,ee.dt)({}),(0,ee.Z_)()])),logs:(0,ee.AG)((0,ee.IX)((0,ee.Z_)())),accounts:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.AG)((0,ee.dt)({executable:(0,ee.O7)(),owner:(0,ee.Z_)(),lamports:(0,ee.Rx)(),data:(0,ee.IX)((0,ee.Z_)()),rentEpoch:(0,ee.jt)((0,ee.Rx)())}))))),unitsConsumed:(0,ee.jt)((0,ee.Rx)()),returnData:(0,ee.jt)((0,ee.AG)((0,ee.dt)({programId:(0,ee.Z_)(),data:(0,ee.bc)([(0,ee.Z_)(),(0,ee.i0)("base64")])})))})),En((0,ee.dt)({byIdentity:(0,ee.IM)((0,ee.Z_)(),(0,ee.IX)((0,ee.Rx)())),range:(0,ee.dt)({firstSlot:(0,ee.Rx)(),lastSlot:(0,ee.Rx)()})})),xn(Pn),xn(Ln),xn(Bn),xn($n),xn(Rn),xn(On),xn((0,ee.Rx)()),En((0,ee.dt)({total:(0,ee.Rx)(),circulating:(0,ee.Rx)(),nonCirculating:(0,ee.Rx)(),nonCirculatingAccounts:(0,ee.IX)(kn)}));const zn=(0,ee.dt)({amount:(0,ee.Z_)(),uiAmount:(0,ee.AG)((0,ee.Rx)()),decimals:(0,ee.Rx)(),uiAmountString:(0,ee.jt)((0,ee.Z_)())}),Un=(En((0,ee.IX)((0,ee.dt)({address:kn,amount:(0,ee.Z_)(),uiAmount:(0,ee.AG)((0,ee.Rx)()),decimals:(0,ee.Rx)(),uiAmountString:(0,ee.jt)((0,ee.Z_)())}))),En((0,ee.IX)((0,ee.dt)({pubkey:kn,account:(0,ee.dt)({executable:(0,ee.O7)(),owner:kn,lamports:(0,ee.Rx)(),data:An,rentEpoch:(0,ee.Rx)()})}))),(0,ee.dt)({program:(0,ee.Z_)(),parsed:(0,ee._4)(),space:(0,ee.Rx)()})),jn=(En((0,ee.IX)((0,ee.dt)({pubkey:kn,account:(0,ee.dt)({executable:(0,ee.O7)(),owner:kn,lamports:(0,ee.Rx)(),data:Un,rentEpoch:(0,ee.Rx)()})}))),En((0,ee.IX)((0,ee.dt)({lamports:(0,ee.Rx)(),address:kn}))),(0,ee.dt)({executable:(0,ee.O7)(),owner:kn,lamports:(0,ee.Rx)(),data:An,rentEpoch:(0,ee.Rx)()})),Yn=((0,ee.dt)({pubkey:kn,account:jn}),(0,ee.oQ)((0,ee.G0)([(0,ee.eE)(a.Buffer),Un]),(0,ee.G0)([Mn,Un]),(t=>Array.isArray(t)?(0,ee.Ue)(t,An):t))),Fn=(0,ee.dt)({executable:(0,ee.O7)(),owner:kn,lamports:(0,ee.Rx)(),data:Yn,rentEpoch:(0,ee.Rx)()}),Wn=((0,ee.dt)({pubkey:kn,account:Fn}),(0,ee.dt)({state:(0,ee.G0)([(0,ee.i0)("active"),(0,ee.i0)("inactive"),(0,ee.i0)("activating"),(0,ee.i0)("deactivating")]),active:(0,ee.Rx)(),inactive:(0,ee.Rx)()}),xn((0,ee.IX)((0,ee.dt)({signature:(0,ee.Z_)(),slot:(0,ee.Rx)(),err:Dn,memo:(0,ee.AG)((0,ee.Z_)()),blockTime:(0,ee.jt)((0,ee.AG)((0,ee.Rx)()))}))),xn((0,ee.IX)((0,ee.dt)({signature:(0,ee.Z_)(),slot:(0,ee.Rx)(),err:Dn,memo:(0,ee.AG)((0,ee.Z_)()),blockTime:(0,ee.jt)((0,ee.AG)((0,ee.Rx)()))}))),(0,ee.dt)({subscription:(0,ee.Rx)(),result:Tn(jn)}),(0,ee.dt)({pubkey:kn,account:jn})),Hn=((0,ee.dt)({subscription:(0,ee.Rx)(),result:Tn(Wn)}),(0,ee.dt)({parent:(0,ee.Rx)(),slot:(0,ee.Rx)(),root:(0,ee.Rx)()})),Kn=((0,ee.dt)({subscription:(0,ee.Rx)(),result:Hn}),(0,ee.G0)([(0,ee.dt)({type:(0,ee.G0)([(0,ee.i0)("firstShredReceived"),(0,ee.i0)("completed"),(0,ee.i0)("optimisticConfirmation"),(0,ee.i0)("root")]),slot:(0,ee.Rx)(),timestamp:(0,ee.Rx)()}),(0,ee.dt)({type:(0,ee.i0)("createdBank"),parent:(0,ee.Rx)(),slot:(0,ee.Rx)(),timestamp:(0,ee.Rx)()}),(0,ee.dt)({type:(0,ee.i0)("frozen"),slot:(0,ee.Rx)(),timestamp:(0,ee.Rx)(),stats:(0,ee.dt)({numTransactionEntries:(0,ee.Rx)(),numSuccessfulTransactions:(0,ee.Rx)(),numFailedTransactions:(0,ee.Rx)(),maxTransactionsPerEntry:(0,ee.Rx)()})}),(0,ee.dt)({type:(0,ee.i0)("dead"),slot:(0,ee.Rx)(),timestamp:(0,ee.Rx)(),err:(0,ee.Z_)()})])),qn=((0,ee.dt)({subscription:(0,ee.Rx)(),result:Kn}),(0,ee.dt)({subscription:(0,ee.Rx)(),result:Tn((0,ee.G0)([Cn,Nn]))}),(0,ee.dt)({subscription:(0,ee.Rx)(),result:(0,ee.Rx)()}),(0,ee.dt)({pubkey:(0,ee.Z_)(),gossip:(0,ee.AG)((0,ee.Z_)()),tpu:(0,ee.AG)((0,ee.Z_)()),rpc:(0,ee.AG)((0,ee.Z_)()),version:(0,ee.AG)((0,ee.Z_)())}),(0,ee.dt)({votePubkey:(0,ee.Z_)(),nodePubkey:(0,ee.Z_)(),activatedStake:(0,ee.Rx)(),epochVoteAccount:(0,ee.O7)(),epochCredits:(0,ee.IX)((0,ee.bc)([(0,ee.Rx)(),(0,ee.Rx)(),(0,ee.Rx)()])),commission:(0,ee.Rx)(),lastVote:(0,ee.Rx)(),rootSlot:(0,ee.AG)((0,ee.Rx)())})),Vn=(xn((0,ee.dt)({current:(0,ee.IX)(qn),delinquent:(0,ee.IX)(qn)})),(0,ee.G0)([(0,ee.i0)("processed"),(0,ee.i0)("confirmed"),(0,ee.i0)("finalized")])),Gn=(0,ee.dt)({slot:(0,ee.Rx)(),confirmations:(0,ee.AG)((0,ee.Rx)()),err:Dn,confirmationStatus:(0,ee.jt)(Vn)}),Zn=(En((0,ee.IX)((0,ee.AG)(Gn))),xn((0,ee.Rx)()),(0,ee.dt)({accountKey:kn,writableIndexes:(0,ee.IX)((0,ee.Rx)()),readonlyIndexes:(0,ee.IX)((0,ee.Rx)())})),Xn=(0,ee.dt)({signatures:(0,ee.IX)((0,ee.Z_)()),message:(0,ee.dt)({accountKeys:(0,ee.IX)((0,ee.Z_)()),header:(0,ee.dt)({numRequiredSignatures:(0,ee.Rx)(),numReadonlySignedAccounts:(0,ee.Rx)(),numReadonlyUnsignedAccounts:(0,ee.Rx)()}),instructions:(0,ee.IX)((0,ee.dt)({accounts:(0,ee.IX)((0,ee.Rx)()),data:(0,ee.Z_)(),programIdIndex:(0,ee.Rx)()})),recentBlockhash:(0,ee.Z_)(),addressTableLookups:(0,ee.jt)((0,ee.IX)(Zn))})}),Jn=(0,ee.dt)({pubkey:kn,signer:(0,ee.O7)(),writable:(0,ee.O7)(),source:(0,ee.jt)((0,ee.G0)([(0,ee.i0)("transaction"),(0,ee.i0)("lookupTable")]))}),Qn=(0,ee.dt)({accountKeys:(0,ee.IX)(Jn),signatures:(0,ee.IX)((0,ee.Z_)())}),tr=(0,ee.dt)({parsed:(0,ee._4)(),program:(0,ee.Z_)(),programId:kn}),er=(0,ee.dt)({accounts:(0,ee.IX)(kn),data:(0,ee.Z_)(),programId:kn}),nr=(0,ee.G0)([er,tr]),rr=(0,ee.G0)([(0,ee.dt)({parsed:(0,ee._4)(),program:(0,ee.Z_)(),programId:(0,ee.Z_)()}),(0,ee.dt)({accounts:(0,ee.IX)((0,ee.Z_)()),data:(0,ee.Z_)(),programId:(0,ee.Z_)()})]),ir=(0,ee.oQ)(nr,rr,(t=>"accounts"in t?(0,ee.Ue)(t,er):(0,ee.Ue)(t,tr))),or=(0,ee.dt)({signatures:(0,ee.IX)((0,ee.Z_)()),message:(0,ee.dt)({accountKeys:(0,ee.IX)(Jn),instructions:(0,ee.IX)(ir),recentBlockhash:(0,ee.Z_)(),addressTableLookups:(0,ee.jt)((0,ee.AG)((0,ee.IX)(Zn)))})}),sr=(0,ee.dt)({accountIndex:(0,ee.Rx)(),mint:(0,ee.Z_)(),owner:(0,ee.jt)((0,ee.Z_)()),uiTokenAmount:zn}),ar=(0,ee.dt)({writable:(0,ee.IX)(kn),readonly:(0,ee.IX)(kn)}),ur=(0,ee.dt)({err:Dn,fee:(0,ee.Rx)(),innerInstructions:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.dt)({index:(0,ee.Rx)(),instructions:(0,ee.IX)((0,ee.dt)({accounts:(0,ee.IX)((0,ee.Rx)()),data:(0,ee.Z_)(),programIdIndex:(0,ee.Rx)()}))})))),preBalances:(0,ee.IX)((0,ee.Rx)()),postBalances:(0,ee.IX)((0,ee.Rx)()),logMessages:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.Z_)()))),preTokenBalances:(0,ee.jt)((0,ee.AG)((0,ee.IX)(sr))),postTokenBalances:(0,ee.jt)((0,ee.AG)((0,ee.IX)(sr))),loadedAddresses:(0,ee.jt)(ar),computeUnitsConsumed:(0,ee.jt)((0,ee.Rx)())}),cr=(0,ee.dt)({err:Dn,fee:(0,ee.Rx)(),innerInstructions:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.dt)({index:(0,ee.Rx)(),instructions:(0,ee.IX)(ir)})))),preBalances:(0,ee.IX)((0,ee.Rx)()),postBalances:(0,ee.IX)((0,ee.Rx)()),logMessages:(0,ee.jt)((0,ee.AG)((0,ee.IX)((0,ee.Z_)()))),preTokenBalances:(0,ee.jt)((0,ee.AG)((0,ee.IX)(sr))),postTokenBalances:(0,ee.jt)((0,ee.AG)((0,ee.IX)(sr))),loadedAddresses:(0,ee.jt)(ar),computeUnitsConsumed:(0,ee.jt)((0,ee.Rx)())}),dr=(0,ee.G0)([(0,ee.i0)(0),(0,ee.i0)("legacy")]),lr=(0,ee.dt)({pubkey:(0,ee.Z_)(),lamports:(0,ee.Rx)(),postBalance:(0,ee.AG)((0,ee.Rx)()),rewardType:(0,ee.AG)((0,ee.Z_)()),commission:(0,ee.jt)((0,ee.AG)((0,ee.Rx)()))}),hr=(xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:Xn,meta:(0,ee.AG)(ur),version:(0,ee.jt)(dr)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:Qn,meta:(0,ee.AG)(ur),version:(0,ee.jt)(dr)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:or,meta:(0,ee.AG)(cr),version:(0,ee.jt)(dr)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:Qn,meta:(0,ee.AG)(cr),version:(0,ee.jt)(dr)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)()),blockHeight:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),transactions:(0,ee.IX)((0,ee.dt)({transaction:Xn,meta:(0,ee.AG)(ur)})),rewards:(0,ee.jt)((0,ee.IX)(lr)),blockTime:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({blockhash:(0,ee.Z_)(),previousBlockhash:(0,ee.Z_)(),parentSlot:(0,ee.Rx)(),signatures:(0,ee.IX)((0,ee.Z_)()),blockTime:(0,ee.AG)((0,ee.Rx)())}))),xn((0,ee.AG)((0,ee.dt)({slot:(0,ee.Rx)(),meta:(0,ee.AG)(ur),blockTime:(0,ee.jt)((0,ee.AG)((0,ee.Rx)())),transaction:Xn,version:(0,ee.jt)(dr)}))),xn((0,ee.AG)((0,ee.dt)({slot:(0,ee.Rx)(),transaction:or,meta:(0,ee.AG)(cr),blockTime:(0,ee.jt)((0,ee.AG)((0,ee.Rx)())),version:(0,ee.jt)(dr)}))),En((0,ee.dt)({blockhash:(0,ee.Z_)(),feeCalculator:(0,ee.dt)({lamportsPerSignature:(0,ee.Rx)()})})),En((0,ee.dt)({blockhash:(0,ee.Z_)(),lastValidBlockHeight:(0,ee.Rx)()})),En((0,ee.O7)()),(0,ee.dt)({slot:(0,ee.Rx)(),numTransactions:(0,ee.Rx)(),numSlots:(0,ee.Rx)(),samplePeriodSecs:(0,ee.Rx)()})),fr=(xn((0,ee.IX)(hr)),En((0,ee.AG)((0,ee.dt)({feeCalculator:(0,ee.dt)({lamportsPerSignature:(0,ee.Rx)()})}))),xn((0,ee.Z_)()),xn((0,ee.Z_)()),(0,ee.dt)({err:Dn,logs:(0,ee.IX)((0,ee.Z_)()),signature:(0,ee.Z_)()}));(0,ee.dt)({result:Tn(fr),subscription:(0,ee.Rx)()});class pr{constructor(t){this._keypair=void 0,this._keypair=t??Re()}static generate(){return new pr(Re())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=Oe(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new pr({publicKey:n,secretKey:t})}static fromSeed(t){const e=Oe(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new pr({publicKey:e,secretKey:n})}get publicKey(){return new Ke(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:Qt.struct([Qt.u32("instruction"),bn("recentSlot"),Qt.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Qt.struct([Qt.u32("instruction")])},ExtendLookupTable:{index:2,layout:Qt.struct([Qt.u32("instruction"),bn(),Qt.seq(Xe(),Qt.offset(Qt.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Qt.struct([Qt.u32("instruction")])},CloseLookupTable:{index:4,layout:Qt.struct([Qt.u32("instruction")])}});new Ke("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:Qt.struct([Qt.u8("instruction"),Qt.u32("units"),Qt.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Qt.struct([Qt.u8("instruction"),Qt.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Qt.struct([Qt.u8("instruction"),Qt.u32("units")])},SetComputeUnitPrice:{index:3,layout:Qt.struct([Qt.u8("instruction"),bn("microLamports")])}});new Ke("ComputeBudget111111111111111111111111111111");const mr=Qt.struct([Qt.u8("numSignatures"),Qt.u8("padding"),Qt.u16("signatureOffset"),Qt.u16("signatureInstructionIndex"),Qt.u16("publicKeyOffset"),Qt.u16("publicKeyInstructionIndex"),Qt.u16("messageDataOffset"),Qt.u16("messageDataSize"),Qt.u16("messageInstructionIndex")]);class gr{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:i}=t;nn(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),nn(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const o=mr.span,s=o+e.length,u=s+r.length,c=a.Buffer.alloc(u+n.length),d=null==i?65535:i;return mr.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:d,publicKeyOffset:o,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,o),c.fill(r,s),c.fill(n,u),new an({keys:[],programId:gr.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;nn(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=pr.fromSecretKey(e),i=t.publicKey.toBytes(),o=Ce(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}gr.programId=new Ke("Ed25519SigVerify111111111111111111111111111"),$e.utils.isValidPrivateKey;const yr=$e.getPublicKey,br=Qt.struct([Qt.u8("numSignatures"),Qt.u16("signatureOffset"),Qt.u8("signatureInstructionIndex"),Qt.u16("ethAddressOffset"),Qt.u8("ethAddressInstructionIndex"),Qt.u16("messageDataOffset"),Qt.u16("messageDataSize"),Qt.u8("messageInstructionIndex"),Qt.blob(20,"ethAddress"),Qt.blob(64,"signature"),Qt.u8("recoveryId")]);class wr{constructor(){}static publicKeyToEthAddress(t){nn(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return a.Buffer.from(ge(ze(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return wr.createInstructionWithEthAddress({ethAddress:wr.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:i,instructionIndex:o=0}=t;let s;s="string"==typeof e?e.startsWith("0x")?a.Buffer.from(e.substr(2),"hex"):a.Buffer.from(e,"hex"):e,nn(20===s.length,`Address must be 20 bytes but received ${s.length} bytes`);const u=12+s.length,c=u+r.length+1,d=a.Buffer.alloc(br.span+n.length);return br.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:o,signature:ze(r),ethAddress:ze(s),recoveryId:i},d),d.fill(ze(n),br.span),new an({keys:[],programId:wr.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;nn(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=ze(e),i=yr(t,!1).slice(1),o=a.Buffer.from(ge(ze(n))),[s,u]=((t,e)=>{const n=$e.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(o,t);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:s,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var _r;wr.programId=new Ke("KeccakSecp256k11111111111111111111111111111");const vr=new Ke("StakeConfig11111111111111111111111111111111");class kr{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}_r=kr,kr.default=new _r(0,0,Ke.default);const Mr=Object.freeze({Initialize:{index:0,layout:Qt.struct([Qt.u32("instruction"),((t="authorized")=>Qt.struct([Xe("staker"),Xe("withdrawer")],t))(),((t="lockup")=>Qt.struct([Qt.ns64("unixTimestamp"),Qt.ns64("epoch"),Xe("custodian")],t))()])},Authorize:{index:1,layout:Qt.struct([Qt.u32("instruction"),Xe("newAuthorized"),Qt.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:Qt.struct([Qt.u32("instruction")])},Split:{index:3,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports")])},Withdraw:{index:4,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports")])},Deactivate:{index:5,layout:Qt.struct([Qt.u32("instruction")])},Merge:{index:7,layout:Qt.struct([Qt.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:Qt.struct([Qt.u32("instruction"),Xe("newAuthorized"),Qt.u32("stakeAuthorizationType"),Je("authoritySeed"),Xe("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Ar{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||kr.default,o=mn(Mr.Initialize,{authorized:{staker:ze(n.staker.toBuffer()),withdrawer:ze(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:ze(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new an(s)}static createAccountWithSeed(t){const e=new un;e.add(_n.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new un;e.add(_n.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=mn(Mr.Delegate);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:hn,isSigner:!1,isWritable:!1},{pubkey:vr,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=mn(Mr.Authorize,{newAuthorized:ze(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new un).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=mn(Mr.AuthorizeWithSeed,{newAuthorized:ze(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:ze(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:cn,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new un).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=mn(Mr.Split,{lamports:i});return new an({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new un;return e.add(_n.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:s}=t,a=new un;return a.add(_n.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),a.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:s}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=mn(Mr.Merge);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:hn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=mn(Mr.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:hn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new un).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=mn(Mr.Deactivate);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}Ar.programId=new Ke("Stake11111111111111111111111111111111111111"),Ar.space=200;const Sr=Object.freeze({InitializeAccount:{index:0,layout:Qt.struct([Qt.u32("instruction"),((t="voteInit")=>Qt.struct([Xe("nodePubkey"),Xe("authorizedVoter"),Xe("authorizedWithdrawer"),Qt.u8("commission")],t))()])},Authorize:{index:1,layout:Qt.struct([Qt.u32("instruction"),Xe("newAuthorized"),Qt.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:Qt.struct([Qt.u32("instruction"),Qt.ns64("lamports")])},AuthorizeWithSeed:{index:10,layout:Qt.struct([Qt.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>Qt.struct([Qt.u32("voteAuthorizationType"),Xe("currentAuthorityDerivedKeyOwnerPubkey"),Je("currentAuthorityDerivedKeySeed"),Xe("newAuthorized")],t))()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class Ir{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=mn(Sr.InitializeAccount,{voteInit:{nodePubkey:ze(r.nodePubkey.toBuffer()),authorizedVoter:ze(r.authorizedVoter.toBuffer()),authorizedWithdrawer:ze(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new an(o)}static createAccount(t){const e=new un;return e.add(_n.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=mn(Sr.Authorize,{newAuthorized:ze(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=mn(Sr.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:ze(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:ze(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:cn,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new un).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=mn(Sr.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return Ir.withdraw(t)}}Ir.programId=new Ke("Vote111111111111111111111111111111111111111"),Ir.space=3731,new Ke("Va1idator1nfo111111111111111111111111111111"),(0,ee.dt)({name:(0,ee.Z_)(),website:(0,ee.jt)((0,ee.Z_)()),details:(0,ee.jt)((0,ee.Z_)()),keybaseUsername:(0,ee.jt)((0,ee.Z_)())}),new Ke("Vote111111111111111111111111111111111111111"),Qt.struct([Xe("nodePubkey"),Xe("authorizedWithdrawer"),Qt.u8("commission"),Qt.nu64(),Qt.seq(Qt.struct([Qt.nu64("slot"),Qt.u32("confirmationCount")]),Qt.offset(Qt.u32(),-8),"votes"),Qt.u8("rootSlotValid"),Qt.nu64("rootSlot"),Qt.nu64(),Qt.seq(Qt.struct([Qt.nu64("epoch"),Xe("authorizedVoter")]),Qt.offset(Qt.u32(),-8),"authorizedVoters"),Qt.struct([Qt.seq(Qt.struct([Xe("authorizedPubkey"),Qt.nu64("epochOfLastAuthorizedSwitch"),Qt.nu64("targetEpoch")]),32,"buf"),Qt.nu64("idx"),Qt.u8("isEmpty")],"priorVoters"),Qt.nu64(),Qt.seq(Qt.struct([Qt.nu64("epoch"),Qt.nu64("credits"),Qt.nu64("prevCredits")]),Qt.offset(Qt.u32(),-8),"epochCredits"),Qt.struct([Qt.nu64("slot"),Qt.nu64("timestamp")],"lastTimestamp")]);for(var xr={},Er={byteLength:function(t){var e=Rr(t),n=e[0],r=e[1];return 3*(n+r)/4-r},toByteArray:function(t){var e,n,r=Rr(t),i=r[0],o=r[1],s=new Br(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=Pr[t.charCodeAt(n)]<<2|Pr[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=Pr[t.charCodeAt(n)]<<10|Pr[t.charCodeAt(n+1)]<<4|Pr[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;sa?a:s+o));return 1===r?(e=t[n-1],i.push(Tr[e>>2]+Tr[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(Tr[e>>10]+Tr[e>>4&63]+Tr[e<<2&63]+"=")),i.join("")}},Tr=[],Pr=[],Br="undefined"!=typeof Uint8Array?Uint8Array:Array,Lr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$r=0;$r<64;++$r)Tr[$r]=Lr[$r],Pr[Lr.charCodeAt($r)]=$r;function Rr(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function Or(t,e,n){for(var r,i,o=[],s=e;s>18&63]+Tr[i>>12&63]+Tr[i>>6&63]+Tr[63&i]);return o.join("")}Pr["-".charCodeAt(0)]=62,Pr["_".charCodeAt(0)]=63;var Dr={read:function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,d=-7,l=n?i-1:0,h=n?-1:1,f=t[e+l];for(l+=h,o=f&(1<<-d)-1,f>>=-d,d+=a;d>0;o=256*o+t[e+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+t[e+l],l+=h,d-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,d=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;t[n+f]=255&s,f+=p,s/=256,c-=8);t[n+f-p]|=128*m}};!function(t){const e=Er,n=Dr,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|f(t,e);let r=o(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(q(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(q(t,ArrayBuffer)||t&&q(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(q(t,SharedArrayBuffer)||t&&q(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);const i=function(t){if(s.isBuffer(t)){const e=0|h(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||V(t.length)?o(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return u(t),o(t<0?0:0|h(t))}function d(t){const e=t.length<0?0:0|h(t.length),n=o(e);for(let r=0;r=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function f(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return E(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return M(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),V(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function M(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(e+=" ... "),""},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,i){if(q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0);const u=Math.min(o,a),c=this.slice(r,i),d=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return _(this,t,e,n);case"base64":return v(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function L(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function $(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function R(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,r,i,o){return e=+e,r>>>=0,o||R(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function D(t,e,r,i,o){return e=+e,r>>>=0,o||R(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Z((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Y(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Y(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Z((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Y(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Y(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||P(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||B(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||B(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Z((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Z((function(t,e=0){return $(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=Z((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Z((function(t,e=0){return $(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function U(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new C.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){j(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||Y(e,t.length-(n+1))}(r,i,o)}function j(t,e){if("number"!=typeof t)throw new C.ERR_INVALID_ARG_TYPE(e,"number",t)}function Y(t,e,n){if(Math.floor(t)!==t)throw j(t,n),new C.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new C.ERR_BUFFER_OUT_OF_BOUNDS;throw new C.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}N("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),N("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),N("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=z(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const F=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function V(t){return t!=t}const G=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?X:t}function X(){throw new Error("BigInt not supported")}}(xr);var Cr=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Nr="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t};function zr(t,e){var n={seen:[],stylize:jr};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Hr(e)?n.showHidden=e:e&&function(t,e){if(!e||!Zr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]]}(n,e),Vr(n.showHidden)&&(n.showHidden=!1),Vr(n.depth)&&(n.depth=2),Vr(n.colors)&&(n.colors=!1),Vr(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Ur),Yr(n,t,n.depth)}function Ur(t,e){var n=zr.styles[e];return n?"["+zr.colors[n][0]+"m"+t+"["+zr.colors[n][1]+"m":t}function jr(t,e){return t}function Yr(t,e,n){if(t.customInspect&&e&&Qr(e.inspect)&&e.inspect!==zr&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return qr(r)||(r=Yr(t,r,n)),r}var i=function(t,e){if(Vr(e))return t.stylize("undefined","undefined");if(qr(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return"number"==typeof e?t.stylize(""+e,"number"):Hr(e)?t.stylize(""+e,"boolean"):Kr(e)?t.stylize("null","null"):void 0}(t,e);if(i)return i;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Jr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Fr(e);if(0===o.length){if(Qr(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Gr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Xr(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Jr(e))return Fr(e)}var u,c,d="",l=!1,h=["{","}"];return u=e,Array.isArray(u)&&(l=!0,h=["[","]"]),Qr(e)&&(d=" [Function"+(e.name?": "+e.name:"")+"]"),Gr(e)&&(d=" "+RegExp.prototype.toString.call(e)),Xr(e)&&(d=" "+Date.prototype.toUTCString.call(e)),Jr(e)&&(d=" "+Fr(e)),0!==o.length||l&&0!=e.length?n<0?Gr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=l?function(t,e,n,r,i){for(var o=[],s=0,a=e.length;s60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(c,d,h)):h[0]+d+h[1]}function Fr(t){return"["+Error.prototype.toString.call(t)+"]"}function Wr(t,e,n,r,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),ni(r,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=Kr(n)?Yr(t,u.value,null):Yr(t,u.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),Vr(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function Hr(t){return"boolean"==typeof t}function Kr(t){return null===t}function qr(t){return"string"==typeof t}function Vr(t){return void 0===t}function Gr(t){return Zr(t)&&"[object RegExp]"===ei(t)}function Zr(t){return"object"==typeof t&&null!==t}function Xr(t){return Zr(t)&&"[object Date]"===ei(t)}function Jr(t){return Zr(t)&&("[object Error]"===ei(t)||t instanceof Error)}function Qr(t){return"function"==typeof t}function ti(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function ei(t){return Object.prototype.toString.call(t)}function ni(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ri(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}}function mi(t,e){return"string"==typeof t?t.length=0;a--)if(u[a]!==c[a])return!1;for(a=u.length-1;a>=0;a--)if(!wi(t[s=u[a]],e[s],n,r))return!1;return!0}(t,e,n,r))}return n?t===e:t==e}function _i(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function vi(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function ki(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&yi(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!t&&i&&!n;if((!t&&Jr(i)&&o&&vi(i,n)||s)&&yi(i,n,"Got unwanted exception"+r),t&&i&&n&&!vi(i,n)||!t&&i)throw i}li.AssertionError=pi,Nr(pi,Error),li.fail=yi,li.ok=bi,li.equal=function t(e,n,r){e!=n&&yi(e,n,r,"==",t)},li.notEqual=function t(e,n,r){e==n&&yi(e,n,r,"!=",t)},li.deepEqual=function t(e,n,r){wi(e,n,!1)||yi(e,n,r,"deepEqual",t)},li.deepStrictEqual=function t(e,n,r){wi(e,n,!0)||yi(e,n,r,"deepStrictEqual",t)},li.notDeepEqual=function t(e,n,r){wi(e,n,!1)&&yi(e,n,r,"notDeepEqual",t)},li.notDeepStrictEqual=function t(e,n,r){wi(e,n,!0)&&yi(e,n,r,"notDeepStrictEqual",t)},li.strictEqual=function t(e,n,r){e!==n&&yi(e,n,r,"===",t)},li.notStrictEqual=function t(e,n,r){e===n&&yi(e,n,r,"!==",t)},li.throws=function(t,e,n){ki(!0,t,e,n)},li.doesNotThrow=function(t,e,n){ki(!1,t,e,n)},li.ifError=function(t){if(t)throw t};var Mi={};class Ai{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function Si(t,e){return e.property?t+"["+e.property+"]":t}Mi.Layout=Ai,Mi.nameWithProperty=Si,Mi.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Ai))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class Ii extends Ai{isCount(){throw new Error("ExternalLayout is abstract")}}class xi extends Ii{constructor(t,e){if(void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class Ei extends Ii{constructor(t,e,n){if(!(t instanceof Ai))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Ti||this.layout instanceof Pi}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class Ti extends Ai{constructor(t,e){if(super(t,e),6t+r.encode(i,e,n+t)),0);return this.count instanceof Ii&&this.count.encode(t.length,e,n),i}}class Hi extends Ai{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof Ai),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class Ki{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class qi extends Ki{constructor(t,e){if(!(t instanceof Ii&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class Vi extends Ai{constructor(t,e,n){const r=t instanceof Ti||t instanceof Pi;if(r)t=new qi(new Ei(t));else if(t instanceof Ii&&t.isCount())t=new qi(t);else if(!(t instanceof Ki))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof Ai))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new Gi(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return xr.Buffer.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Gi extends Ai{constructor(t,e,n,r){if(!(t instanceof Vi))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof Ai))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Zi(t){return 0>t&&(t+=4294967296),t}class Xi extends Ai{constructor(t,e,n){if(!(t instanceof Ti||t instanceof Pi))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Zi(t&this.valueMask))throw new TypeError(Si("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Zi(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof Ii&&(r=t.length),!xr.Buffer.isBuffer(t)||r!==t.length)throw new TypeError(Si("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof Ii&&this.length.encode(r,e,n),r}}class eo extends Ai{constructor(t){super(-1,t)}getSpan(t,e){if(!xr.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}class no extends Ai{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!xr.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}class ro extends Ai{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}Mi.ExternalLayout=Ii,Mi.GreedyCount=xi,Mi.OffsetLayout=Ei,Mi.UInt=Ti,Mi.UIntBE=Pi,Mi.Int=Bi,Mi.IntBE=Li,Mi.Float=Ui,Mi.FloatBE=ji,Mi.Double=Yi,Mi.DoubleBE=Fi,Mi.Sequence=Wi,Mi.Structure=Hi,Mi.UnionDiscriminator=Ki,Mi.UnionLayoutDiscriminator=qi,Mi.Union=Vi,Mi.VariantLayout=Gi,Mi.BitStructure=Xi,Mi.BitField=Ji,Mi.Boolean=Qi,Mi.Blob=to,Mi.CString=eo,Mi.UTF8=no,Mi.Constant=ro,Mi.greedy=(t,e)=>new xi(t,e),Mi.offset=(t,e,n)=>new Ei(t,e,n);var io=Mi.u8=t=>new Ti(1,t);Mi.u16=t=>new Ti(2,t),Mi.u24=t=>new Ti(3,t);var oo=Mi.u32=t=>new Ti(4,t);Mi.u40=t=>new Ti(5,t),Mi.u48=t=>new Ti(6,t),Mi.nu64=t=>new Di(t),Mi.u16be=t=>new Pi(2,t),Mi.u24be=t=>new Pi(3,t),Mi.u32be=t=>new Pi(4,t),Mi.u40be=t=>new Pi(5,t),Mi.u48be=t=>new Pi(6,t),Mi.nu64be=t=>new Ci(t),Mi.s8=t=>new Bi(1,t),Mi.s16=t=>new Bi(2,t),Mi.s24=t=>new Bi(3,t),Mi.s32=t=>new Bi(4,t),Mi.s40=t=>new Bi(5,t),Mi.s48=t=>new Bi(6,t),Mi.ns64=t=>new Ni(t),Mi.s16be=t=>new Li(2,t),Mi.s24be=t=>new Li(3,t),Mi.s32be=t=>new Li(4,t),Mi.s40be=t=>new Li(5,t),Mi.s48be=t=>new Li(6,t),Mi.ns64be=t=>new zi(t),Mi.f32=t=>new Ui(t),Mi.f32be=t=>new ji(t),Mi.f64=t=>new Yi(t),Mi.f64be=t=>new Fi(t);var so=Mi.struct=(t,e,n)=>new Hi(t,e,n);Mi.bits=(t,e,n)=>new Xi(t,e,n),Mi.seq=(t,e,n)=>new Wi(t,e,n),Mi.union=(t,e,n)=>new Vi(t,e,n),Mi.unionLayoutDiscriminator=(t,e)=>new qi(t,e);var ao=Mi.blob=(t,e)=>new to(t,e);Mi.cstr=t=>new eo(t),Mi.utf8=(t,e)=>new no(t,e),Mi.const=(t,e)=>new ro(t,e);const uo=(t="publicKey")=>ao(32,t),co=(t="uint64")=>ao(8,t);function lo(t,e,n,...r){return fn(e,n,r,{skipPreflight:!1})}const ho=new Ke("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),fo=new Ke("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),po="Failed to find account",mo="Invalid account owner";function go(t){return xr.Buffer.from(t.toBuffer())}class yo extends(s()){toBuffer(){const t=super.toArray().reverse(),e=xr.Buffer.from(t);if(8===e.length)return e;li(e.length<8,"u64 too large");const n=xr.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){return li(8===t.length,`Invalid buffer length: ${t.length}`),new yo([...t].reverse().map((t=>`00${t.toString(16)}`.slice(-2))).join(""),16)}}function bo(t){return"publicKey"in t}const wo={MintTokens:0,FreezeAccount:1,AccountOwner:2,CloseAccount:3},_o=new Ke("So11111111111111111111111111111111111111112"),vo=so([oo("mintAuthorityOption"),uo("mintAuthority"),co("supply"),io("decimals"),io("isInitialized"),oo("freezeAuthorityOption"),uo("freezeAuthority")]),ko=so([uo("mint"),uo("owner"),co("amount"),oo("delegateOption"),uo("delegate"),io("state"),oo("isNativeOption"),co("isNative"),co("delegatedAmount"),oo("closeAuthorityOption"),uo("closeAuthority")]),Mo=so([io("m"),io("n"),io("is_initialized"),uo("signer1"),uo("signer2"),uo("signer3"),uo("signer4"),uo("signer5"),uo("signer6"),uo("signer7"),uo("signer8"),uo("signer9"),uo("signer10"),uo("signer11")]);class Ao{constructor(t,e,n,r){(0,i.Z)(this,"connection",void 0),(0,i.Z)(this,"publicKey",void 0),(0,i.Z)(this,"programId",void 0),(0,i.Z)(this,"associatedProgramId",void 0),(0,i.Z)(this,"payer",void 0),Object.assign(this,{connection:t,publicKey:e,programId:n,payer:r,associatedProgramId:fo})}static async getMinBalanceRentForExemptMint(t){return await t.getMinimumBalanceForRentExemption(vo.span)}static async getMinBalanceRentForExemptAccount(t){return await t.getMinimumBalanceForRentExemption(ko.span)}static async getMinBalanceRentForExemptMultisig(t){return await t.getMinimumBalanceForRentExemption(Mo.span)}static async createMint(t,e,n,r,i,o){const s=pr.generate(),a=new Ao(t,s.publicKey,o,e),u=await Ao.getMinBalanceRentForExemptMint(t),c=new un;return c.add(_n.createAccount({fromPubkey:e.publicKey,newAccountPubkey:s.publicKey,lamports:u,space:vo.span,programId:o})),c.add(Ao.createInitMintInstruction(o,s.publicKey,i,n,r)),await lo(0,t,c,e,s),a}async createAccount(t){const e=await Ao.getMinBalanceRentForExemptAccount(this.connection),n=pr.generate(),r=new un;r.add(_n.createAccount({fromPubkey:this.payer.publicKey,newAccountPubkey:n.publicKey,lamports:e,space:ko.span,programId:this.programId}));const i=this.publicKey;return r.add(Ao.createInitAccountInstruction(this.programId,i,n.publicKey,t)),await lo(0,this.connection,r,this.payer,n),n.publicKey}async createAssociatedTokenAccount(t){const e=await Ao.getAssociatedTokenAddress(this.associatedProgramId,this.programId,this.publicKey,t);return this.createAssociatedTokenAccountInternal(t,e)}async createAssociatedTokenAccountInternal(t,e){return await lo(0,this.connection,(new un).add(Ao.createAssociatedTokenAccountInstruction(this.associatedProgramId,this.programId,this.publicKey,e,t,this.payer.publicKey)),this.payer),e}async getOrCreateAssociatedAccountInfo(t){const e=await Ao.getAssociatedTokenAddress(this.associatedProgramId,this.programId,this.publicKey,t);try{return await this.getAccountInfo(e)}catch(n){if(n.message===po||n.message===mo){try{await this.createAssociatedTokenAccountInternal(t,e)}catch(t){}return await this.getAccountInfo(e)}throw n}}static async createWrappedNativeAccount(t,e,n,r,i){const o=await Ao.getMinBalanceRentForExemptAccount(t),s=pr.generate(),a=new un;return a.add(_n.createAccount({fromPubkey:r.publicKey,newAccountPubkey:s.publicKey,lamports:o,space:ko.span,programId:e})),a.add(_n.transfer({fromPubkey:r.publicKey,toPubkey:s.publicKey,lamports:i})),a.add(Ao.createInitAccountInstruction(e,_o,s.publicKey,n)),await lo(0,t,a,r,s),s.publicKey}async createMultisig(t,e){const n=pr.generate(),r=await Ao.getMinBalanceRentForExemptMultisig(this.connection),i=new un;i.add(_n.createAccount({fromPubkey:this.payer.publicKey,newAccountPubkey:n.publicKey,lamports:r,space:Mo.span,programId:this.programId}));let o=[{pubkey:n.publicKey,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1}];e.forEach((t=>o.push({pubkey:t,isSigner:!1,isWritable:!1})));const s=so([io("instruction"),io("m")]),a=xr.Buffer.alloc(s.span);return s.encode({instruction:2,m:t},a),i.add({keys:o,programId:this.programId,data:a}),await lo(0,this.connection,i,this.payer,n),n.publicKey}async getMintInfo(){const t=await this.connection.getAccountInfo(this.publicKey);if(null===t)throw new Error("Failed to find mint account");if(!t.owner.equals(this.programId))throw new Error(`Invalid mint owner: ${JSON.stringify(t.owner)}`);if(t.data.length!=vo.span)throw new Error("Invalid mint size");const e=xr.Buffer.from(t.data),n=vo.decode(e);return 0===n.mintAuthorityOption?n.mintAuthority=null:n.mintAuthority=new Ke(n.mintAuthority),n.supply=yo.fromBuffer(n.supply),n.isInitialized=0!=n.isInitialized,0===n.freezeAuthorityOption?n.freezeAuthority=null:n.freezeAuthority=new Ke(n.freezeAuthority),n}async getAccountInfo(t,e){const n=await this.connection.getAccountInfo(t,e);if(null===n)throw new Error(po);if(!n.owner.equals(this.programId))throw new Error(mo);if(n.data.length!=ko.span)throw new Error("Invalid account size");const r=xr.Buffer.from(n.data),i=ko.decode(r);if(i.address=t,i.mint=new Ke(i.mint),i.owner=new Ke(i.owner),i.amount=yo.fromBuffer(i.amount),0===i.delegateOption?(i.delegate=null,i.delegatedAmount=new yo):(i.delegate=new Ke(i.delegate),i.delegatedAmount=yo.fromBuffer(i.delegatedAmount)),i.isInitialized=0!==i.state,i.isFrozen=2===i.state,1===i.isNativeOption?(i.rentExemptReserve=yo.fromBuffer(i.isNative),i.isNative=!0):(i.rentExemptReserve=null,i.isNative=!1),0===i.closeAuthorityOption?i.closeAuthority=null:i.closeAuthority=new Ke(i.closeAuthority),!i.mint.equals(this.publicKey))throw new Error(`Invalid account mint: ${JSON.stringify(i.mint)} !== ${JSON.stringify(this.publicKey)}`);return i}async getMultisigInfo(t){const e=await this.connection.getAccountInfo(t);if(null===e)throw new Error("Failed to find multisig");if(!e.owner.equals(this.programId))throw new Error("Invalid multisig owner");if(e.data.length!=Mo.span)throw new Error("Invalid multisig size");const n=xr.Buffer.from(e.data),r=Mo.decode(n);return r.signer1=new Ke(r.signer1),r.signer2=new Ke(r.signer2),r.signer3=new Ke(r.signer3),r.signer4=new Ke(r.signer4),r.signer5=new Ke(r.signer5),r.signer6=new Ke(r.signer6),r.signer7=new Ke(r.signer7),r.signer8=new Ke(r.signer8),r.signer9=new Ke(r.signer9),r.signer10=new Ke(r.signer10),r.signer11=new Ke(r.signer11),r}async transfer(t,e,n,r,i){let o,s;return bo(n)?(o=n.publicKey,s=[n]):(o=n,s=r),await lo("Transfer",this.connection,(new un).add(Ao.createTransferInstruction(this.programId,t,e,o,r,i)),this.payer,...s)}async approve(t,e,n,r,i){let o,s;bo(n)?(o=n.publicKey,s=[n]):(o=n,s=r),await lo("Approve",this.connection,(new un).add(Ao.createApproveInstruction(this.programId,t,e,o,r,i)),this.payer,...s)}async revoke(t,e,n){let r,i;bo(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await lo("Revoke",this.connection,(new un).add(Ao.createRevokeInstruction(this.programId,t,r,n)),this.payer,...i)}async setAuthority(t,e,n,r,i){let o,s;bo(r)?(o=r.publicKey,s=[r]):(o=r,s=i),await lo("SetAuthority",this.connection,(new un).add(Ao.createSetAuthorityInstruction(this.programId,t,e,n,o,i)),this.payer,...s)}async mintTo(t,e,n,r){let i,o;bo(e)?(i=e.publicKey,o=[e]):(i=e,o=n),await lo("MintTo",this.connection,(new un).add(Ao.createMintToInstruction(this.programId,this.publicKey,t,i,n,r)),this.payer,...o)}async burn(t,e,n,r){let i,o;bo(e)?(i=e.publicKey,o=[e]):(i=e,o=n),await lo("Burn",this.connection,(new un).add(Ao.createBurnInstruction(this.programId,this.publicKey,t,i,n,r)),this.payer,...o)}async closeAccount(t,e,n,r){let i,o;bo(n)?(i=n.publicKey,o=[n]):(i=n,o=r),await lo("CloseAccount",this.connection,(new un).add(Ao.createCloseAccountInstruction(this.programId,t,e,i,r)),this.payer,...o)}async freezeAccount(t,e,n){let r,i;bo(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await lo("FreezeAccount",this.connection,(new un).add(Ao.createFreezeAccountInstruction(this.programId,t,this.publicKey,r,n)),this.payer,...i)}async thawAccount(t,e,n){let r,i;bo(e)?(r=e.publicKey,i=[e]):(r=e,i=n),await lo("ThawAccount",this.connection,(new un).add(Ao.createThawAccountInstruction(this.programId,t,this.publicKey,r,n)),this.payer,...i)}async transferChecked(t,e,n,r,i,o){let s,a;return bo(n)?(s=n.publicKey,a=[n]):(s=n,a=r),await lo("TransferChecked",this.connection,(new un).add(Ao.createTransferCheckedInstruction(this.programId,t,this.publicKey,e,s,r,i,o)),this.payer,...a)}async approveChecked(t,e,n,r,i,o){let s,a;bo(n)?(s=n.publicKey,a=[n]):(s=n,a=r),await lo("ApproveChecked",this.connection,(new un).add(Ao.createApproveCheckedInstruction(this.programId,t,this.publicKey,e,s,r,i,o)),this.payer,...a)}async mintToChecked(t,e,n,r,i){let o,s;bo(e)?(o=e.publicKey,s=[e]):(o=e,s=n),await lo("MintToChecked",this.connection,(new un).add(Ao.createMintToCheckedInstruction(this.programId,this.publicKey,t,o,n,r,i)),this.payer,...s)}async burnChecked(t,e,n,r,i){let o,s;bo(e)?(o=e.publicKey,s=[e]):(o=e,s=n),await lo("BurnChecked",this.connection,(new un).add(Ao.createBurnCheckedInstruction(this.programId,this.publicKey,t,o,n,r,i)),this.payer,...s)}async syncNative(t){await lo(0,this.connection,(new un).add(Ao.createSyncNativeInstruction(this.programId,t)),this.payer)}static createInitMintInstruction(t,e,n,r,i){let o=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1}];const s=so([io("instruction"),io("decimals"),uo("mintAuthority"),io("option"),uo("freezeAuthority")]);let a=xr.Buffer.alloc(1024);{const t=s.encode({instruction:0,decimals:n,mintAuthority:go(r),option:null===i?0:1,freezeAuthority:go(i||new Ke(0))},a);a=a.slice(0,t)}return new an({keys:o,programId:t,data:a})}static createInitAccountInstruction(t,e,n,r){const i=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1}],o=so([io("instruction")]),s=xr.Buffer.alloc(o.span);return o.encode({instruction:1},s),new an({keys:i,programId:t,data:s})}static createTransferInstruction(t,e,n,r,i,o){const s=so([io("instruction"),co("amount")]),a=xr.Buffer.alloc(s.span);s.encode({instruction:3,amount:new yo(o).toBuffer()},a);let u=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?u.push({pubkey:r,isSigner:!0,isWritable:!1}):(u.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createApproveInstruction(t,e,n,r,i,o){const s=so([io("instruction"),co("amount")]),a=xr.Buffer.alloc(s.span);s.encode({instruction:4,amount:new yo(o).toBuffer()},a);let u=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?u.push({pubkey:r,isSigner:!0,isWritable:!1}):(u.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createRevokeInstruction(t,e,n,r){const i=so([io("instruction")]),o=xr.Buffer.alloc(i.span);i.encode({instruction:5},o);let s=[{pubkey:e,isSigner:!1,isWritable:!0}];return 0===r.length?s.push({pubkey:n,isSigner:!0,isWritable:!1}):(s.push({pubkey:n,isSigner:!1,isWritable:!1}),r.forEach((t=>s.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:s,programId:t,data:o})}static createSetAuthorityInstruction(t,e,n,r,i,o){const s=so([io("instruction"),io("authorityType"),io("option"),uo("newAuthority")]);let a=xr.Buffer.alloc(1024);{const t=s.encode({instruction:6,authorityType:wo[r],option:null===n?0:1,newAuthority:go(n||new Ke(0))},a);a=a.slice(0,t)}let u=[{pubkey:e,isSigner:!1,isWritable:!0}];return 0===o.length?u.push({pubkey:i,isSigner:!0,isWritable:!1}):(u.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createMintToInstruction(t,e,n,r,i,o){const s=so([io("instruction"),co("amount")]),a=xr.Buffer.alloc(s.span);s.encode({instruction:7,amount:new yo(o).toBuffer()},a);let u=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?u.push({pubkey:r,isSigner:!0,isWritable:!1}):(u.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createBurnInstruction(t,e,n,r,i,o){const s=so([io("instruction"),co("amount")]),a=xr.Buffer.alloc(s.span);s.encode({instruction:8,amount:new yo(o).toBuffer()},a);let u=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}];return 0===i.length?u.push({pubkey:r,isSigner:!0,isWritable:!1}):(u.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>u.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:u,programId:t,data:a})}static createCloseAccountInstruction(t,e,n,r,i){const o=so([io("instruction")]),s=xr.Buffer.alloc(o.span);o.encode({instruction:9},s);let a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?a.push({pubkey:r,isSigner:!0,isWritable:!1}):(a.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>a.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:a,programId:t,data:s})}static createFreezeAccountInstruction(t,e,n,r,i){const o=so([io("instruction")]),s=xr.Buffer.alloc(o.span);o.encode({instruction:10},s);let a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?a.push({pubkey:r,isSigner:!0,isWritable:!1}):(a.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>a.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:a,programId:t,data:s})}static createThawAccountInstruction(t,e,n,r,i){const o=so([io("instruction")]),s=xr.Buffer.alloc(o.span);o.encode({instruction:11},s);let a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}];return 0===i.length?a.push({pubkey:r,isSigner:!0,isWritable:!1}):(a.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>a.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:a,programId:t,data:s})}static createTransferCheckedInstruction(t,e,n,r,i,o,s,a){const u=so([io("instruction"),co("amount"),io("decimals")]),c=xr.Buffer.alloc(u.span);u.encode({instruction:12,amount:new yo(s).toBuffer(),decimals:a},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!0}];return 0===o.length?d.push({pubkey:i,isSigner:!0,isWritable:!1}):(d.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:d,programId:t,data:c})}static createApproveCheckedInstruction(t,e,n,r,i,o,s,a){const u=so([io("instruction"),co("amount"),io("decimals")]),c=xr.Buffer.alloc(u.span);u.encode({instruction:13,amount:new yo(s).toBuffer(),decimals:a},c);let d=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1}];return 0===o.length?d.push({pubkey:i,isSigner:!0,isWritable:!1}):(d.push({pubkey:i,isSigner:!1,isWritable:!1}),o.forEach((t=>d.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:d,programId:t,data:c})}static createMintToCheckedInstruction(t,e,n,r,i,o,s){const a=so([io("instruction"),co("amount"),io("decimals")]),u=xr.Buffer.alloc(a.span);a.encode({instruction:14,amount:new yo(o).toBuffer(),decimals:s},u);let c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:c,programId:t,data:u})}static createBurnCheckedInstruction(t,e,n,r,i,o,s){const a=so([io("instruction"),co("amount"),io("decimals")]),u=xr.Buffer.alloc(a.span);a.encode({instruction:15,amount:new yo(o).toBuffer(),decimals:s},u);let c=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}];return 0===i.length?c.push({pubkey:r,isSigner:!0,isWritable:!1}):(c.push({pubkey:r,isSigner:!1,isWritable:!1}),i.forEach((t=>c.push({pubkey:t.publicKey,isSigner:!0,isWritable:!1})))),new an({keys:c,programId:t,data:u})}static createSyncNativeInstruction(t,e){const n=so([io("instruction")]),r=xr.Buffer.alloc(n.span);return n.encode({instruction:17},r),new an({keys:[{pubkey:e,isSigner:!1,isWritable:!0}],programId:t,data:r})}static async getAssociatedTokenAddress(t,e,n,r,i=!1){if(!i&&!Ke.isOnCurve(r.toBuffer()))throw new Error(`Owner cannot sign: ${r.toString()}`);return(await Ke.findProgramAddress([r.toBuffer(),e.toBuffer(),n.toBuffer()],t))[0]}static createAssociatedTokenAccountInstruction(t,e,n,r,i,o){const s=xr.Buffer.alloc(0);let a=[{pubkey:o,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:_n.programId,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1}];return new an({keys:a,programId:t,data:s})}}},48990:(t,e,n)=>{"use strict";n(48764).Buffer;var r=n(64836),i=(r(n(64687)),r(n(17156)),r(n(18698)),r(n(56690)),r(n(89728)),r(n(61655)),r(n(94993)),r(n(73808)),n(26729));n(78340);i.EventEmitter},46299:(t,e,n)=>{"use strict";var r=n(64836),i=r(n(56690)),o=r(n(89728)),s=r(n(61655)),a=r(n(94993)),u=r(n(73808));n(26729).EventEmitter},78340:(t,e,n)=>{"use strict";var r=n(64836);Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDataPack=void 0,e.createError=function(t,e){var n={code:t,message:s.get(t)||"Internal Server Error"};return e&&(n.data=e),n};var i=r(n(56690)),o=r(n(89728)),s=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),a=function(){function t(){(0,i.default)(this,t)}return(0,o.default)(t,[{key:"encode",value:function(t){return JSON.stringify(t)}},{key:"decode",value:function(t){return JSON.parse(t)}}]),t}();e.DefaultDataPack=a},73591:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolContext=void 0;const i=n(78845),o=r(n(92220)),s=n(57752),a=n(51986),u={createWrappedSolAccountMethod:"keypair",allowPDAOwnerAddress:!1};class c{static from(t,e,n,r=(0,s.buildDefaultAccountFetcher)(t),a,u={}){const d=new i.AnchorProvider(t,e,{commitment:u.userDefaultConfirmCommitment||"confirmed",preflightCommitment:u.userDefaultConfirmCommitment||"confirmed"}),l=new i.Program(o.default,n,d);return new c(d,d.wallet,l,r,a,u)}static fromWorkspace(t,e,n=(0,s.buildDefaultAccountFetcher)(t.connection),r,i={}){return new c(t,t.wallet,e,n,r,i)}static withProvider(t,e,n=(0,s.buildDefaultAccountFetcher)(t.connection),r,a={}){const u=new i.Program(o.default,e,t);return new c(t,t.wallet,u,n,r,a)}constructor(t,e,n,r,i,o={}){this.connection=t.connection,this.wallet=e,this.program=n,this.provider=t,this.fetcher=r,this.lookupTableFetcher=i,this.opts=o,this.txBuilderOpts=(0,a.contextOptionsToBuilderOptions)(this.opts),this.accountResolverOpts=o.accountResolverOptions??u}}e.WhirlpoolContext=c},37392:(t,e)=>{"use strict";var n,r,i,o;Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolsError=e.RouteQueryErrorCode=e.SwapErrorCode=e.TokenErrorCode=e.MathErrorCode=void 0,function(t){t.MultiplicationOverflow="MultiplicationOverflow",t.MulDivOverflow="MulDivOverflow",t.MultiplicationShiftRightOverflow="MultiplicationShiftRightOverflow",t.DivideByZero="DivideByZero"}(n||(e.MathErrorCode=n={})),function(t){t.TokenMaxExceeded="TokenMaxExceeded",t.TokenMinSubceeded="TokenMinSubceeded"}(r||(e.TokenErrorCode=r={})),function(t){t.InvalidDevFeePercentage="InvalidDevFeePercentage",t.InvalidSqrtPriceLimitDirection="InvalidSqrtPriceLimitDirection",t.SqrtPriceOutOfBounds="SqrtPriceOutOfBounds",t.ZeroTradableAmount="ZeroTradableAmount",t.AmountOutBelowMinimum="AmountOutBelowMinimum",t.AmountInAboveMaximum="AmountInAboveMaximum",t.TickArrayCrossingAboveMax="TickArrayCrossingAboveMax",t.TickArrayIndexNotInitialized="TickArrayIndexNotInitialized",t.TickArraySequenceInvalid="TickArraySequenceInvalid"}(i||(e.SwapErrorCode=i={})),function(t){t.RouteDoesNotExist="RouteDoesNotExist",t.TradeAmountTooHigh="TradeAmountTooHigh",t.ZeroInputAmount="ZeroInputAmount",t.General="General"}(o||(e.RouteQueryErrorCode=o={}));class s extends Error{constructor(t,e,n){super(t),this.message=t,this.errorCode=e,this.stack=n}static isWhirlpoolsErrorCode(t,e){return t instanceof s&&t.errorCode===e}}e.WhirlpoolsError=s},7496:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.PositionImpl=void 0;const i=n(66259),o=n(29955),s=n(18245),a=r(n(26018)),u=n(62902),c=n(41786),d=n(48231),l=n(74808),h=n(25367),f=n(93018),p=n(51986);e.PositionImpl=class{constructor(t,e,n,r,i,o){this.ctx=t,this.address=e,this.data=n,this.whirlpoolData=r,this.lowerTickArrayData=i,this.upperTickArrayData=o}getAddress(){return this.address}getData(){return this.data}getWhirlpoolData(){return this.whirlpoolData}getLowerTickData(){return l.TickArrayUtil.getTickFromArray(this.lowerTickArrayData,this.data.tickLowerIndex,this.whirlpoolData.tickSpacing)}getUpperTickData(){return l.TickArrayUtil.getTickFromArray(this.upperTickArrayData,this.data.tickUpperIndex,this.whirlpoolData.tickSpacing)}async refreshData(){return await this.refresh(),this.data}async increaseLiquidity(t,e=!0,n,r,s){const a=n?i.AddressUtil.toPubKey(n):this.ctx.wallet.publicKey,d=r?i.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,h=s?i.AddressUtil.toPubKey(s):this.ctx.wallet.publicKey,p=await this.ctx.fetcher.getPool(this.data.whirlpool,c.IGNORE_CACHE);if(!p)throw new Error("Unable to fetch whirlpool for this position.");const m=await f.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,p,c.IGNORE_CACHE),g=new i.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);let y,b;if(e){const[e,n]=await(0,i.resolveOrCreateATAs)(this.ctx.connection,a,[{tokenMint:p.tokenMintA,wrappedSolAmountIn:t.tokenMaxA},{tokenMint:p.tokenMintB,wrappedSolAmountIn:t.tokenMaxB}],(()=>this.ctx.fetcher.getAccountRentExempt()),h,void 0,this.ctx.accountResolverOpts.allowPDAOwnerAddress,this.ctx.accountResolverOpts.createWrappedSolAccountMethod),{address:r,...o}=e,{address:s,...u}=n;y=r,b=s,g.addInstruction(o),g.addInstruction(u)}else y=(0,o.getAssociatedTokenAddressSync)(p.tokenMintA,a,this.ctx.accountResolverOpts.allowPDAOwnerAddress,m.tokenMintWithProgramA.tokenProgram),b=(0,o.getAssociatedTokenAddressSync)(p.tokenMintB,a,this.ctx.accountResolverOpts.allowPDAOwnerAddress,m.tokenMintWithProgramB.tokenProgram);const w=(0,o.getAssociatedTokenAddressSync)(this.data.positionMint,d,this.ctx.accountResolverOpts.allowPDAOwnerAddress),_={...t,whirlpool:this.data.whirlpool,position:this.address,positionTokenAccount:w,tokenOwnerAccountA:y,tokenOwnerAccountB:b,tokenVaultA:p.tokenVaultA,tokenVaultB:p.tokenVaultB,tickArrayLower:l.PDAUtil.getTickArray(this.ctx.program.programId,this.data.whirlpool,l.TickUtil.getStartTickIndex(this.data.tickLowerIndex,p.tickSpacing)).publicKey,tickArrayUpper:l.PDAUtil.getTickArray(this.ctx.program.programId,this.data.whirlpool,l.TickUtil.getStartTickIndex(this.data.tickUpperIndex,p.tickSpacing)).publicKey,positionAuthority:d},v=f.TokenExtensionUtil.isV2IxRequiredPool(m)?(0,u.increaseLiquidityV2Ix)(this.ctx.program,{..._,tokenMintA:p.tokenMintA,tokenMintB:p.tokenMintB,tokenProgramA:m.tokenMintWithProgramA.tokenProgram,tokenProgramB:m.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,m.tokenMintWithProgramA,_.tokenOwnerAccountA,_.tokenVaultA,_.positionAuthority),tokenTransferHookAccountsB:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,m.tokenMintWithProgramB,_.tokenOwnerAccountB,_.tokenVaultB,_.positionAuthority)}):(0,u.increaseLiquidityIx)(this.ctx.program,_);return g.addInstruction(v),g}async decreaseLiquidity(t,e=!0,n,r,s){const a=n?i.AddressUtil.toPubKey(n):this.ctx.wallet.publicKey,d=r?i.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,h=s?i.AddressUtil.toPubKey(s):this.ctx.wallet.publicKey,p=await this.ctx.fetcher.getPool(this.data.whirlpool,c.IGNORE_CACHE);if(!p)throw new Error("Unable to fetch whirlpool for this position.");const m=await f.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,p,c.IGNORE_CACHE),g=new i.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);let y,b;if(e){const[t,e]=await(0,i.resolveOrCreateATAs)(this.ctx.connection,a,[{tokenMint:p.tokenMintA},{tokenMint:p.tokenMintB}],(()=>this.ctx.fetcher.getAccountRentExempt()),h,void 0,this.ctx.accountResolverOpts.allowPDAOwnerAddress,this.ctx.accountResolverOpts.createWrappedSolAccountMethod),{address:n,...r}=t,{address:o,...s}=e;y=n,b=o,g.addInstruction(r),g.addInstruction(s)}else y=(0,o.getAssociatedTokenAddressSync)(p.tokenMintA,a,this.ctx.accountResolverOpts.allowPDAOwnerAddress,m.tokenMintWithProgramA.tokenProgram),b=(0,o.getAssociatedTokenAddressSync)(p.tokenMintB,a,this.ctx.accountResolverOpts.allowPDAOwnerAddress,m.tokenMintWithProgramB.tokenProgram);const w={...t,whirlpool:this.data.whirlpool,position:this.address,positionTokenAccount:(0,o.getAssociatedTokenAddressSync)(this.data.positionMint,d,this.ctx.accountResolverOpts.allowPDAOwnerAddress),tokenOwnerAccountA:y,tokenOwnerAccountB:b,tokenVaultA:p.tokenVaultA,tokenVaultB:p.tokenVaultB,tickArrayLower:l.PDAUtil.getTickArray(this.ctx.program.programId,this.data.whirlpool,l.TickUtil.getStartTickIndex(this.data.tickLowerIndex,p.tickSpacing)).publicKey,tickArrayUpper:l.PDAUtil.getTickArray(this.ctx.program.programId,this.data.whirlpool,l.TickUtil.getStartTickIndex(this.data.tickUpperIndex,p.tickSpacing)).publicKey,positionAuthority:d},_=f.TokenExtensionUtil.isV2IxRequiredPool(m)?(0,u.decreaseLiquidityV2Ix)(this.ctx.program,{...w,tokenMintA:p.tokenMintA,tokenMintB:p.tokenMintB,tokenProgramA:m.tokenMintWithProgramA.tokenProgram,tokenProgramB:m.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,m.tokenMintWithProgramA,w.tokenVaultA,w.tokenOwnerAccountA,w.whirlpool),tokenTransferHookAccountsB:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,m.tokenMintWithProgramB,w.tokenVaultB,w.tokenOwnerAccountB,w.whirlpool)}):(0,u.decreaseLiquidityIx)(this.ctx.program,w);return g.addInstruction(_),g}async collectFees(t=!0,e,n,r,s,d=c.PREFER_CACHE){const[l,p,m]=i.AddressUtil.toPubKeys([n??this.ctx.wallet.publicKey,r??this.ctx.wallet.publicKey,s??this.ctx.wallet.publicKey]),g=await this.ctx.fetcher.getPool(this.data.whirlpool,d);if(!g)throw new Error(`Unable to fetch whirlpool (${this.data.whirlpool}) for this position (${this.address}).`);const y=await f.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,g,c.IGNORE_CACHE);let b=new i.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);const w=await this.ctx.fetcher.getAccountRentExempt();let _={...e};if(!e){const t=(0,h.getTokenMintsFromWhirlpools)([g],h.TokenMintTypes.POOL_ONLY),{ataTokenAddresses:e,resolveAtaIxs:n}=await(0,h.resolveAtaForMints)(this.ctx,{mints:t.mintMap,accountExemption:w,receiver:l,payer:m});if(b.addInstructions(n),t.hasNativeMint){let{address:t,...n}=i.TokenUtil.createWrappedNativeAccountInstruction(l,i.ZERO,w,m,l,this.ctx.accountResolverOpts.createWrappedSolAccountMethod);e[o.NATIVE_MINT.toBase58()]=t,b.addInstruction(n)}_={...e}}const v=_[g.tokenMintA.toBase58()];(0,a.default)(!!v,`No owner token account provided for wallet ${l.toBase58()} for token A ${g.tokenMintA.toBase58()} `);const k=_[g.tokenMintB.toBase58()];(0,a.default)(!!k,`No owner token account provided for wallet ${l.toBase58()} for token B ${g.tokenMintB.toBase58()} `);const M=(0,o.getAssociatedTokenAddressSync)(this.data.positionMint,p,this.ctx.accountResolverOpts.allowPDAOwnerAddress);if(t&&!this.data.liquidity.isZero()){const t=await this.updateFeesAndRewards();b.addInstruction(t)}const A={whirlpool:this.data.whirlpool,position:this.address,positionTokenAccount:M,tokenOwnerAccountA:i.AddressUtil.toPubKey(v),tokenOwnerAccountB:i.AddressUtil.toPubKey(k),tokenVaultA:g.tokenVaultA,tokenVaultB:g.tokenVaultB,positionAuthority:p},S=f.TokenExtensionUtil.isV2IxRequiredPool(y)?(0,u.collectFeesV2Ix)(this.ctx.program,{...A,tokenMintA:g.tokenMintA,tokenMintB:g.tokenMintB,tokenProgramA:y.tokenMintWithProgramA.tokenProgram,tokenProgramB:y.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,y.tokenMintWithProgramA,A.tokenVaultA,A.tokenOwnerAccountA,A.whirlpool),tokenTransferHookAccountsB:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,y.tokenMintWithProgramB,A.tokenVaultB,A.tokenOwnerAccountB,A.whirlpool)}):(0,u.collectFeesIx)(this.ctx.program,A);return b.addInstruction(S),b}async collectRewards(t,e=!0,n,r,d,m,g=c.IGNORE_CACHE){const[y,b,w]=i.AddressUtil.toPubKeys([r??this.ctx.wallet.publicKey,d??this.ctx.wallet.publicKey,m??this.ctx.wallet.publicKey]),_=await this.ctx.fetcher.getPool(this.data.whirlpool,g);if(!_)throw new Error(`Unable to fetch whirlpool(${this.data.whirlpool}) for this position(${this.address}).`);const v=_.rewardInfos.filter((t=>l.PoolUtil.isRewardInitialized(t))),k=await f.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,_,c.IGNORE_CACHE);let M;if(n)M={},Object.entries(n).forEach((([t,e])=>{e&&(M[t]={address:i.AddressUtil.toPubKey(e),instructions:[],cleanupInstructions:[],signers:[],tokenProgram:s.PublicKey.default})}));else{const t=await this.ctx.fetcher.getAccountRentExempt(),e=(0,h.getTokenMintsFromWhirlpools)([_],h.TokenMintTypes.REWARD_ONLY);M=(0,p.convertListToMap)(await(0,i.resolveOrCreateATAs)(this.ctx.connection,y,e.mintMap.map((t=>({tokenMint:t}))),(async()=>t),w,!0,this.ctx.accountResolverOpts.allowPDAOwnerAddress),e.mintMap.map((t=>t.toBase58())))}const A=new p.MultipleTransactionBuilderFactoryWithAccountResolver(this.ctx,M,y,w),S=(0,o.getAssociatedTokenAddressSync)(this.data.positionMint,b,this.ctx.accountResolverOpts.allowPDAOwnerAddress);e&&!this.data.liquidity.isZero()&&await A.addInstructions((async()=>[await this.updateFeesAndRewards()]));for(let e=0;et.toString()===n.mint.toBase58())))break;await A.addInstructions((async t=>{const r=t(n.mint.toBase58());(0,a.default)(!!r,`No owner token account provided for wallet ${y.toBase58()} for reward ${e} token ${n.mint.toBase58()} `);const o={whirlpool:this.data.whirlpool,position:this.address,positionTokenAccount:S,rewardIndex:e,rewardOwnerAccount:i.AddressUtil.toPubKey(r),rewardVault:n.vault,positionAuthority:b};return[f.TokenExtensionUtil.isV2IxRequiredReward(k,e)?(0,u.collectRewardV2Ix)(this.ctx.program,{...o,rewardMint:n.mint,rewardTokenProgram:k.rewardTokenMintsWithProgram[e].tokenProgram,rewardTransferHookAccounts:await f.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,k.rewardTokenMintsWithProgram[e],o.rewardVault,o.rewardOwnerAccount,o.whirlpool)}):(0,u.collectRewardIx)(this.ctx.program,o)]}))}return A.build()}async refresh(){const t=await this.ctx.fetcher.getPosition(this.address,c.IGNORE_CACHE);t&&(this.data=t);const e=await this.ctx.fetcher.getPool(this.data.whirlpool,c.IGNORE_CACHE);e&&(this.whirlpoolData=e);const[n,r]=await(0,d.getTickArrayDataForPosition)(this.ctx,this.data,this.whirlpoolData,c.IGNORE_CACHE);n&&(this.lowerTickArrayData=n),r&&(this.upperTickArrayData=r)}async updateFeesAndRewards(){const t=await this.ctx.fetcher.getPool(this.data.whirlpool);if(!t)throw new Error(`Unable to fetch whirlpool(${this.data.whirlpool}) for this position(${this.address}).`);const[e,n]=[this.data.tickLowerIndex,this.data.tickUpperIndex].map((e=>l.PDAUtil.getTickArrayFromTickIndex(e,t.tickSpacing,this.data.whirlpool,this.ctx.program.programId)));return(0,u.updateFeesAndRewardsIx)(this.ctx.program,{whirlpool:this.data.whirlpool,position:this.address,tickArrayLower:e.publicKey,tickArrayUpper:n.publicKey})}}},13464:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getTokenVaultAccountInfos=e.getRewardInfos=e.getTokenMintInfos=void 0;const i=r(n(13550)),o=n(40273);async function s(t,e,n){const r={...e,initialized:!1,vaultAmount:new i.default(0)};if(o.PoolUtil.isRewardInitialized(e)){const o=await t.getTokenInfo(e.vault,n);if(!o)throw new Error(`Unable to fetch TokenAccountInfo for vault - ${e.vault}`);r.initialized=!0,r.vaultAmount=new i.default(o.amount.toString())}return r}e.getTokenMintInfos=async function(t,e,n){const r=e.tokenMintA,i=await t.getMintInfo(r,n);if(!i)throw new Error(`Unable to fetch MintInfo for mint - ${r}`);const o=e.tokenMintB,s=await t.getMintInfo(o,n);if(!s)throw new Error(`Unable to fetch MintInfo for mint - ${o}`);return[{mint:r,...i},{mint:o,...s}]},e.getRewardInfos=async function(t,e,n){const r=[];for(const i of e.rewardInfos)r.push(await s(t,i,n));return r},e.getTokenVaultAccountInfos=async function(t,e,n){const r=e.tokenVaultA,i=await t.getTokenInfo(r,n);if(!i)throw new Error(`Unable to fetch TokenAccountInfo for vault - ${r}`);const o=e.tokenVaultB,s=await t.getTokenInfo(o,n);if(!s)throw new Error(`Unable to fetch TokenAccountInfo for vault - ${o}`);return[i,s]}},4263:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolClientImpl=void 0;const i=n(66259),o=n(18245),s=r(n(26018)),a=n(62902),u=n(84533),c=n(19503),d=n(41786),l=n(94138),h=n(48231),f=n(74808),p=n(7496),m=n(13464),g=n(96040),y=n(93018);e.WhirlpoolClientImpl=class{constructor(t){this.ctx=t}getContext(){return this.ctx}getFetcher(){return this.ctx.fetcher}getRouter(t){return l.WhirlpoolRouterBuilder.buildWithPools(this.ctx,t)}async getPool(t,e=d.PREFER_CACHE){const n=await this.ctx.fetcher.getPool(t,e);if(!n)throw new Error(`Unable to fetch Whirlpool at address at ${t}`);const r=await(0,m.getTokenMintInfos)(this.ctx.fetcher,n,e),o=await(0,m.getTokenVaultAccountInfos)(this.ctx.fetcher,n,e),s=await(0,m.getRewardInfos)(this.ctx.fetcher,n,e);return new g.WhirlpoolImpl(this.ctx,i.AddressUtil.toPubKey(t),r[0],r[1],o[0],o[1],s,n)}async getPools(t,e=d.PREFER_CACHE){const n=Array.from((await this.ctx.fetcher.getPools(t,e)).values()).filter((t=>!!t));if(n.length!==t.length)throw new Error(`Unable to fetch all Whirlpools at addresses ${t}`);const r=new Set,o=new Set;n.forEach((t=>{r.add(t.tokenMintA.toBase58()),r.add(t.tokenMintB.toBase58()),o.add(t.tokenVaultA.toBase58()),o.add(t.tokenVaultB.toBase58()),t.rewardInfos.forEach((t=>{f.PoolUtil.isRewardInitialized(t)&&o.add(t.vault.toBase58())}))})),await this.ctx.fetcher.getMintInfos(Array.from(r),e),await this.ctx.fetcher.getTokenInfos(Array.from(o),e);const s=[];for(let e=0;et?.whirlpool.toBase58())).flatMap((t=>t||[]));await this.ctx.fetcher.getPools(r,e);const i=new Set;await Promise.all(n.map((async t=>{if(t){const e=await this.ctx.fetcher.getPool(t.whirlpool,d.PREFER_CACHE);if(e){const n=f.PDAUtil.getTickArrayFromTickIndex(t.tickLowerIndex,e.tickSpacing,t.whirlpool,this.ctx.program.programId).publicKey,r=f.PDAUtil.getTickArrayFromTickIndex(t.tickUpperIndex,e.tickSpacing,t.whirlpool,this.ctx.program.programId).publicKey;i.add(n.toBase58()),i.add(r.toBase58())}}}))),await this.ctx.fetcher.getTickArrays(Array.from(i),d.IGNORE_CACHE);const o=await Promise.all(t.map((async t=>{try{return[t,await this.getPosition(t,d.PREFER_CACHE)]}catch{return[t,null]}})));return Object.fromEntries(o)}async createPool(t,e,n,r,u,l,h=d.PREFER_CACHE){(0,s.default)(f.TickUtil.checkTickInBounds(u),"initialTick is out of bounds."),(0,s.default)(f.TickUtil.isTickInitializable(u,r),`initial tick ${u} is not an initializable tick for tick-spacing ${r}`);const p=f.PoolUtil.orderMints(e,n).map((t=>t.toString()));(0,s.default)(p[0]===e.toString(),"Token order needs to be flipped to match the canonical ordering (i.e. sorted on the byte repr. of the mint pubkeys)");const m=await this.ctx.fetcher.getMintInfos([e,n],h),g={...y.NO_TOKEN_EXTENSION_CONTEXT,tokenMintWithProgramA:m.get(e.toString()),tokenMintWithProgramB:m.get(n.toString())};t=i.AddressUtil.toPubKey(t);const b=f.PDAUtil.getFeeTier(this.ctx.program.programId,t,r).publicKey,w=f.PriceMath.tickIndexToSqrtPriceX64(u),_=o.Keypair.generate(),v=o.Keypair.generate(),k=f.PDAUtil.getWhirlpool(this.ctx.program.programId,t,new o.PublicKey(e),new o.PublicKey(n),r),M=await this.ctx.fetcher.getFeeTier(b,h);(0,s.default)(!!M,`Fee tier for ${r} doesn't exist`);const A=new i.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts),S=f.PDAUtil.getTokenBadge(this.ctx.program.programId,t,i.AddressUtil.toPubKey(e)).publicKey,I=f.PDAUtil.getTokenBadge(this.ctx.program.programId,t,i.AddressUtil.toPubKey(n)).publicKey,x={initSqrtPrice:w,whirlpoolsConfig:t,whirlpoolPda:k,tokenMintA:new o.PublicKey(e),tokenMintB:new o.PublicKey(n),tokenVaultAKeypair:_,tokenVaultBKeypair:v,feeTierKey:b,tickSpacing:r,funder:new o.PublicKey(l)},E=y.TokenExtensionUtil.isV2IxRequiredPool(g)?c.WhirlpoolIx.initializePoolV2Ix(this.ctx.program,{...x,tokenProgramA:g.tokenMintWithProgramA.tokenProgram,tokenProgramB:g.tokenMintWithProgramB.tokenProgram,tokenBadgeA:S,tokenBadgeB:I}):c.WhirlpoolIx.initializePoolIx(this.ctx.program,x),T=f.TickUtil.getStartTickIndex(u,r),P=f.PDAUtil.getTickArray(this.ctx.program.programId,k.publicKey,T);return A.addInstruction(E),A.addInstruction((0,a.initTickArrayIx)(this.ctx.program,{startTick:T,tickArrayPda:P,whirlpool:k.publicKey,funder:i.AddressUtil.toPubKey(l)})),{poolKey:k.publicKey,tx:A}}async collectFeesAndRewardsForPositions(t,e){const n=this.ctx.wallet.publicKey;return(0,u.collectAllForPositionAddressesTxns)(this.ctx,{positions:t,receiver:n,positionAuthority:n,positionOwner:n,payer:n},e)}async collectProtocolFeesForPools(t){return(0,u.collectProtocolFees)(this.ctx,t)}}},96040:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolImpl=void 0;const i=n(78845),o=n(66259),s=n(29955),a=n(18245),u=r(n(26018)),c=n(62902),d=n(41786),l=n(27122),h=n(48231),f=n(74808),p=n(25367),m=n(7496),g=n(13464),y=n(51986),b=n(93018),w=n(19503);e.WhirlpoolImpl=class{constructor(t,e,n,r,i,o,s,a){this.ctx=t,this.address=e,this.tokenAInfo=n,this.tokenBInfo=r,this.tokenVaultAInfo=i,this.tokenVaultBInfo=o,this.rewardInfos=s,this.data=a}getAddress(){return this.address}getData(){return this.data}getTokenAInfo(){return this.tokenAInfo}getTokenBInfo(){return this.tokenBInfo}getTokenVaultAInfo(){return this.tokenVaultAInfo}getTokenVaultBInfo(){return this.tokenVaultBInfo}getRewardInfos(){return this.rewardInfos}async refreshData(){return await this.refresh(),this.data}async openPosition(t,e,n,r,i,s){return await this.refresh(),this.getOpenPositionWithOptMetadataTx(t,e,n,r?o.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,i?o.AddressUtil.toPubKey(i):this.ctx.wallet.publicKey,!1,s)}async openPositionWithMetadata(t,e,n,r,i,s){return await this.refresh(),this.getOpenPositionWithOptMetadataTx(t,e,n,r?o.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,i?o.AddressUtil.toPubKey(i):this.ctx.wallet.publicKey,!0,s)}async initTickArrayForTicks(t,e,n=d.IGNORE_CACHE){const r=await f.TickArrayUtil.getUninitializedArraysPDAs(t,this.ctx.program.programId,this.address,this.data.tickSpacing,this.ctx.fetcher,n);if(!r.length)return null;const i=new o.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);return r.forEach((t=>{i.addInstruction((0,c.initTickArrayIx)(this.ctx.program,{startTick:t.startIndex,tickArrayPda:t.pda,whirlpool:this.address,funder:e?o.AddressUtil.toPubKey(e):this.ctx.provider.wallet.publicKey}))})),i}async closePosition(t,e,n,r,i){await this.refresh();const s=r?o.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,a=n?o.AddressUtil.toPubKey(n):this.ctx.wallet.publicKey,u=i?o.AddressUtil.toPubKey(i):this.ctx.wallet.publicKey;return this.getClosePositionIx(o.AddressUtil.toPubKey(t),e,a,s,u)}async swap(t,e){const n=e?o.AddressUtil.toPubKey(e):this.ctx.wallet.publicKey;return(0,c.swapAsync)(this.ctx,{swapInput:t,whirlpool:this,wallet:n},d.IGNORE_CACHE)}async swapWithDevFees(t,e,n,r){const i=n?o.AddressUtil.toPubKey(n):this.ctx.wallet.publicKey,s=r?o.AddressUtil.toPubKey(r):this.ctx.wallet.publicKey,a=new o.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts);if(!t.devFeeAmount.eq(o.ZERO)){const n=t.aToB===t.amountSpecifiedIsInput?this.getTokenAInfo():this.getTokenBInfo();a.addInstruction(await o.TokenUtil.createSendTokensToWalletInstruction(this.ctx.connection,i,e,n.mint,n.decimals,t.devFeeAmount,(()=>this.ctx.fetcher.getAccountRentExempt()),s,this.ctx.accountResolverOpts.allowPDAOwnerAddress))}const u=await(0,c.swapAsync)(this.ctx,{swapInput:t,whirlpool:this,wallet:i},d.IGNORE_CACHE);return a.addInstruction(u.compressIx(!0)),a}async getOpenPositionWithOptMetadataTx(t,e,n,r,l,h=!1,p){(0,u.default)(f.TickUtil.checkTickInBounds(t),"tickLower is out of bounds."),(0,u.default)(f.TickUtil.checkTickInBounds(e),"tickUpper is out of bounds.");const{liquidityAmount:m,tokenMaxA:g,tokenMaxB:y}=n;(0,u.default)(m.gt(new i.BN(0)),"liquidity must be greater than zero");const w=await this.ctx.fetcher.getPool(this.address,d.PREFER_CACHE);if(!w)throw new Error(`Whirlpool not found: ${(0,i.translateAddress)(this.address).toBase58()}`);const _=await b.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,w,d.IGNORE_CACHE);(0,u.default)(f.TickUtil.isTickInitializable(t,w.tickSpacing),`lower tick ${t} is not an initializable tick for tick-spacing ${w.tickSpacing}`),(0,u.default)(f.TickUtil.isTickInitializable(e,w.tickSpacing),`upper tick ${e} is not an initializable tick for tick-spacing ${w.tickSpacing}`);const v=a.Keypair.generate(),k=p??v.publicKey,M=f.PDAUtil.getPosition(this.ctx.program.programId,k),A=f.PDAUtil.getPositionMetadata(k),S=(0,s.getAssociatedTokenAddressSync)(k,r,this.ctx.accountResolverOpts.allowPDAOwnerAddress),I=new o.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts),x=(h?c.openPositionWithMetadataIx:c.openPositionIx)(this.ctx.program,{funder:l,owner:r,positionPda:M,metadataPda:A,positionMintAddress:k,positionTokenAccount:S,whirlpool:this.address,tickLowerIndex:t,tickUpperIndex:e});I.addInstruction(x),void 0===p&&I.addSigner(v);const[E,T]=await(0,o.resolveOrCreateATAs)(this.ctx.connection,r,[{tokenMint:w.tokenMintA,wrappedSolAmountIn:g},{tokenMint:w.tokenMintB,wrappedSolAmountIn:y}],(()=>this.ctx.fetcher.getAccountRentExempt()),l,void 0,this.ctx.accountResolverOpts.allowPDAOwnerAddress,this.ctx.accountResolverOpts.createWrappedSolAccountMethod),{address:P,...B}=E,{address:L,...$}=T;I.addInstruction(B),I.addInstruction($);const R=f.PDAUtil.getTickArrayFromTickIndex(t,this.data.tickSpacing,this.address,this.ctx.program.programId),O=f.PDAUtil.getTickArrayFromTickIndex(e,this.data.tickSpacing,this.address,this.ctx.program.programId),D={liquidityAmount:m,tokenMaxA:g,tokenMaxB:y,whirlpool:this.address,positionAuthority:r,position:M.publicKey,positionTokenAccount:S,tokenOwnerAccountA:P,tokenOwnerAccountB:L,tokenVaultA:w.tokenVaultA,tokenVaultB:w.tokenVaultB,tickArrayLower:R.publicKey,tickArrayUpper:O.publicKey},C=b.TokenExtensionUtil.isV2IxRequiredPool(_)?(0,c.increaseLiquidityV2Ix)(this.ctx.program,{...D,tokenMintA:w.tokenMintA,tokenMintB:w.tokenMintB,tokenProgramA:_.tokenMintWithProgramA.tokenProgram,tokenProgramB:_.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,_.tokenMintWithProgramA,D.tokenOwnerAccountA,D.tokenVaultA,D.positionAuthority),tokenTransferHookAccountsB:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,_.tokenMintWithProgramB,D.tokenOwnerAccountB,D.tokenVaultB,D.positionAuthority)}):(0,c.increaseLiquidityIx)(this.ctx.program,D);return I.addInstruction(C),{positionMint:k,tx:I}}async getClosePositionIx(t,e,n,r,i){const a=await this.ctx.fetcher.getPosition(t,d.IGNORE_CACHE);if(!a)throw new Error(`Position not found: ${t.toBase58()}`);const g=this.data;(0,u.default)(a.whirlpool.equals(this.address),`Position ${t.toBase58()} is not a position for Whirlpool ${this.address.toBase58()}`);const _=(0,s.getAssociatedTokenAddressSync)(a.positionMint,r,this.ctx.accountResolverOpts.allowPDAOwnerAddress),v=await this.ctx.fetcher.getAccountRentExempt(),k=(new o.TransactionBuilder(this.ctx.provider.connection,this.ctx.provider.wallet,this.ctx.txBuilderOpts),f.PDAUtil.getTickArrayFromTickIndex(a.tickLowerIndex,g.tickSpacing,a.whirlpool,this.ctx.program.programId).publicKey),M=f.PDAUtil.getTickArrayFromTickIndex(a.tickUpperIndex,g.tickSpacing,a.whirlpool,this.ctx.program.programId).publicKey,[A,S]=await(0,h.getTickArrayDataForPosition)(this.ctx,a,g,d.IGNORE_CACHE);(0,u.default)(!!A,`Tick array ${k} expected to be initialized for whirlpool ${this.address}`),(0,u.default)(!!S,`Tick array ${M} expected to be initialized for whirlpool ${this.address}`);const I=await b.TokenExtensionUtil.buildTokenExtensionContext(this.ctx.fetcher,g,d.IGNORE_CACHE),x=new m.PositionImpl(this.ctx,t,a,g,A,S),E=x.getLowerTickData(),T=x.getUpperTickData(),P=(0,l.collectFeesQuote)({position:a,whirlpool:g,tickLower:E,tickUpper:T,tokenExtensionCtx:I}),B=(0,l.collectRewardsQuote)({position:a,whirlpool:g,tickLower:E,tickUpper:T,tokenExtensionCtx:I}),L=P.feeOwedA.gtn(0)||P.feeOwedB.gtn(0);(0,u.default)(this.data.rewardInfos.length===B.rewardOwed.length,"Rewards quote does not match reward infos length");const $=a.liquidity.gtn(0),R=this.data.rewardInfos.filter(((t,e)=>(B.rewardOwed[e]??o.ZERO).gtn(0)||(B.transferFee.deductedFromRewardOwed[e]??o.ZERO).gtn(0))).map((t=>t.mint)),O=R.length>0;let D=p.TokenMintTypes.ALL;!$&&!L||O?$||L||!O||(D=p.TokenMintTypes.REWARD_ONLY):D=p.TokenMintTypes.POOL_ONLY;const C=(0,p.getTokenMintsFromWhirlpools)([g],D),N=(0,y.convertListToMap)(await(0,o.resolveOrCreateATAs)(this.ctx.connection,n,C.mintMap.map((t=>({tokenMint:t}))),(async()=>v),i,!0,this.ctx.accountResolverOpts.allowPDAOwnerAddress,this.ctx.accountResolverOpts.createWrappedSolAccountMethod),C.mintMap.map((t=>t.toBase58()))),z=new y.MultipleTransactionBuilderFactoryWithAccountResolver(this.ctx,N,n,i);if($&&await z.addInstructions((async n=>{const i=n(g.tokenMintA.toBase58()),o=n(g.tokenMintB.toBase58()),s={...(0,l.decreaseLiquidityQuoteByLiquidityWithParams)({liquidity:a.liquidity,slippageTolerance:e,sqrtPrice:g.sqrtPrice,tickCurrentIndex:g.tickCurrentIndex,tickLowerIndex:a.tickLowerIndex,tickUpperIndex:a.tickUpperIndex,tokenExtensionCtx:I}),whirlpool:a.whirlpool,positionAuthority:r,position:t,positionTokenAccount:_,tokenOwnerAccountA:i,tokenOwnerAccountB:o,tokenVaultA:g.tokenVaultA,tokenVaultB:g.tokenVaultB,tickArrayLower:k,tickArrayUpper:M};return[b.TokenExtensionUtil.isV2IxRequiredPool(I)?w.WhirlpoolIx.decreaseLiquidityV2Ix(this.ctx.program,{...s,tokenMintA:g.tokenMintA,tokenMintB:g.tokenMintB,tokenProgramA:I.tokenMintWithProgramA.tokenProgram,tokenProgramB:I.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.tokenMintWithProgramA,s.tokenVaultA,s.tokenOwnerAccountA,s.whirlpool),tokenTransferHookAccountsB:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.tokenMintWithProgramB,s.tokenVaultB,s.tokenOwnerAccountB,s.whirlpool)}):w.WhirlpoolIx.decreaseLiquidityIx(this.ctx.program,s)]})),L&&await z.addInstructions((async e=>{const n=e(g.tokenMintA.toBase58()),i=e(g.tokenMintB.toBase58()),o={whirlpool:a.whirlpool,position:t,positionAuthority:r,positionTokenAccount:_,tokenOwnerAccountA:n,tokenOwnerAccountB:i,tokenVaultA:g.tokenVaultA,tokenVaultB:g.tokenVaultB};return[b.TokenExtensionUtil.isV2IxRequiredPool(I)?w.WhirlpoolIx.collectFeesV2Ix(this.ctx.program,{...o,tokenMintA:I.tokenMintWithProgramA.address,tokenMintB:I.tokenMintWithProgramB.address,tokenProgramA:I.tokenMintWithProgramA.tokenProgram,tokenProgramB:I.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.tokenMintWithProgramA,o.tokenVaultA,o.tokenOwnerAccountA,o.whirlpool),tokenTransferHookAccountsB:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.tokenMintWithProgramB,o.tokenVaultB,o.tokenOwnerAccountB,o.whirlpool)}):w.WhirlpoolIx.collectFeesIx(this.ctx.program,o)]})),O)for(let e=0;e{const i=n(R[e].toBase58()),o={whirlpool:a.whirlpool,position:t,positionAuthority:r,positionTokenAccount:_,rewardIndex:e,rewardOwnerAccount:i,rewardVault:g.rewardInfos[e].vault};return[b.TokenExtensionUtil.isV2IxRequiredReward(I,e)?w.WhirlpoolIx.collectRewardV2Ix(this.ctx.program,{...o,rewardMint:I.rewardTokenMintsWithProgram[e].address,rewardTokenProgram:I.rewardTokenMintsWithProgram[e].tokenProgram,rewardTransferHookAccounts:await b.TokenExtensionUtil.getExtraAccountMetasForTransferHook(this.ctx.connection,I.rewardTokenMintsWithProgram[e],o.rewardVault,o.rewardOwnerAccount,o.whirlpool)}):w.WhirlpoolIx.collectRewardIx(this.ctx.program,o)]}));return await z.addInstructions((async()=>[(0,c.closePositionIx)(this.ctx.program,{positionAuthority:r,receiver:n,positionTokenAccount:_,position:t,positionMint:a.positionMint})])),z.build()}async refresh(){const t=await this.ctx.fetcher.getPool(this.address,d.IGNORE_CACHE);if(t){const e=await(0,g.getRewardInfos)(this.ctx.fetcher,t,d.IGNORE_CACHE),[n,r]=await(0,g.getTokenVaultAccountInfos)(this.ctx.fetcher,t,d.IGNORE_CACHE);this.data=t,this.tokenVaultAInfo=n,this.tokenVaultBInfo=r,this.rewardInfos=e}}}},40273:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(n(93776));i(n(73591),e),i(n(7496),e),i(n(19503),e),i(n(57752),e),i(n(54274),e),i(n(27122),e),i(n(94138),e),i(n(37917),e),i(n(26168),e),i(n(74808),e),i(n(63273),e),s.default.set({precision:40,toExpPos:40,toExpNeg:-20,rounding:1})},65664:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.closeBundledPositionIx=void 0,e.closeBundledPositionIx=function(t,e){const{bundledPosition:n,positionBundle:r,positionBundleTokenAccount:i,positionBundleAuthority:o,bundleIndex:s,receiver:a}=e;return{instructions:[t.instruction.closeBundledPosition(s,{accounts:{bundledPosition:n,positionBundle:r,positionBundleTokenAccount:i,positionBundleAuthority:o,receiver:a}})],cleanupInstructions:[],signers:[]}}},67236:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.closePositionIx=void 0;const r=n(29955);e.closePositionIx=function(t,e){const{positionAuthority:n,receiver:i,position:o,positionMint:s,positionTokenAccount:a}=e;return{instructions:[t.instruction.closePosition({accounts:{positionAuthority:n,receiver:i,position:o,positionMint:s,positionTokenAccount:a,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},42851:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectFeesIx=void 0;const r=n(29955);e.collectFeesIx=function(t,e){const{whirlpool:n,positionAuthority:i,position:o,positionTokenAccount:s,tokenOwnerAccountA:a,tokenOwnerAccountB:u,tokenVaultA:c,tokenVaultB:d}=e;return{instructions:[t.instruction.collectFees({accounts:{whirlpool:n,positionAuthority:i,position:o,positionTokenAccount:s,tokenOwnerAccountA:a,tokenOwnerAccountB:u,tokenVaultA:c,tokenVaultB:d,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},76300:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectProtocolFeesIx=void 0;const r=n(29955);e.collectProtocolFeesIx=function(t,e){const{whirlpoolsConfig:n,whirlpool:i,collectProtocolFeesAuthority:o,tokenVaultA:s,tokenVaultB:a,tokenOwnerAccountA:u,tokenOwnerAccountB:c}=e;return{instructions:[t.instruction.collectProtocolFees({accounts:{whirlpoolsConfig:n,whirlpool:i,collectProtocolFeesAuthority:o,tokenVaultA:s,tokenVaultB:a,tokenDestinationA:u,tokenDestinationB:c,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},63621:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectRewardIx=void 0;const r=n(29955);e.collectRewardIx=function(t,e){const{whirlpool:n,positionAuthority:i,position:o,positionTokenAccount:s,rewardOwnerAccount:a,rewardVault:u,rewardIndex:c}=e;return{instructions:[t.instruction.collectReward(c,{accounts:{whirlpool:n,positionAuthority:i,position:o,positionTokenAccount:s,rewardOwnerAccount:a,rewardVault:u,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},37970:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectAllForPositionsTxns=e.collectAllForPositionAddressesTxns=void 0;const r=n(66259),i=n(29955),o=n(18245),s=n(19503),a=n(41786),u=n(74808),c=n(51986),d=n(25367),l=n(85204),h=n(93018);async function f(t,e){const{positions:n,receiver:o,positionAuthority:s,positionOwner:l,payer:h}=e,f=o??t.wallet.publicKey,m=s??t.wallet.publicKey,g=l??t.wallet.publicKey,y=h??t.wallet.publicKey,b=Object.entries(n);if(0===b.length)return[];const w=b.map((([,t])=>t.whirlpool.toBase58())),_=await t.fetcher.getPools(w,a.PREFER_CACHE),v=(0,d.getTokenMintsFromWhirlpools)(Array.from(_.values())),k=await t.fetcher.getAccountRentExempt();await t.fetcher.getMintInfos(v.mintMap);const M=(0,c.convertListToMap)(await(0,r.resolveOrCreateATAs)(t.connection,f,v.mintMap.map((t=>({tokenMint:t}))),(async()=>k),y,!0,t.accountResolverOpts.allowPDAOwnerAddress,t.accountResolverOpts.createWrappedSolAccountMethod),v.mintMap.map((t=>t.toBase58()))),A=await t.connection.getLatestBlockhash(),S=[],I=[];b.forEach((([t,e])=>{const n=_.get(e.whirlpool.toBase58());if(!n)throw new Error(`Unable to process positionMint ${e.positionMint.toBase58()} - unable to derive whirlpool ${e.whirlpool.toBase58()}`);I.push({collectionType:"fee",positionAddr:t,position:e,whirlpool:n}),n.rewardInfos.forEach(((r,i)=>{u.PoolUtil.isRewardInitialized(r)&&I.push({collectionType:"reward",rewardIndex:i,positionAddr:t,position:e,whirlpool:n})}))}));let x=0,E=null,T=null,P=null,B=!1;for(;x{t&&(s[e]=t)})),f(t,{positions:s,...i})},e.collectAllForPositionsTxns=f;const p=async(t,e,n,c,d,f,p)=>{const m=[],{whirlpool:g,liquidity:y,tickLowerIndex:b,tickUpperIndex:w,positionMint:_,rewardInfos:v}=e.position,k=e.whirlpool,{tickSpacing:M}=k,A=k.tokenMintA.toBase58(),S=k.tokenMintB.toBase58(),I=await h.TokenExtensionUtil.buildTokenExtensionContext(t.fetcher,k,a.PREFER_CACHE),x=(0,i.getAssociatedTokenAddressSync)(_,c,t.accountResolverOpts.allowPDAOwnerAddress);if(y.eq(r.ZERO)||n||m.push((0,l.updateFeesAndRewardsIx)(t.program,{position:new o.PublicKey(e.positionAddr),whirlpool:g,tickArrayLower:u.PDAUtil.getTickArray(t.program.programId,g,u.TickUtil.getStartTickIndex(b,M)).publicKey,tickArrayUpper:u.PDAUtil.getTickArray(t.program.programId,g,u.TickUtil.getStartTickIndex(w,M)).publicKey})),"fee"===e.collectionType){p.has(A)||(m.push(f[A]),p.add(A)),p.has(S)||(m.push(f[S]),p.add(S));const n={whirlpool:g,position:new o.PublicKey(e.positionAddr),positionAuthority:d,positionTokenAccount:x,tokenOwnerAccountA:f[A].address,tokenOwnerAccountB:f[S].address,tokenVaultA:k.tokenVaultA,tokenVaultB:k.tokenVaultB};m.push(h.TokenExtensionUtil.isV2IxRequiredPool(I)?s.WhirlpoolIx.collectFeesV2Ix(t.program,{...n,tokenMintA:I.tokenMintWithProgramA.address,tokenMintB:I.tokenMintWithProgramB.address,tokenProgramA:I.tokenMintWithProgramA.tokenProgram,tokenProgramB:I.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await h.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,I.tokenMintWithProgramA,n.tokenVaultA,n.tokenOwnerAccountA,n.whirlpool),tokenTransferHookAccountsB:await h.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,I.tokenMintWithProgramB,n.tokenVaultB,n.tokenOwnerAccountB,n.whirlpool)}):s.WhirlpoolIx.collectFeesIx(t.program,n))}else{const n=e.rewardIndex,r=k.rewardInfos[n],i=r.mint.toBase58();p.has(i)||(m.push(f[i]),p.add(i));const a={whirlpool:g,position:new o.PublicKey(e.positionAddr),positionAuthority:d,positionTokenAccount:x,rewardIndex:n,rewardOwnerAccount:f[i].address,rewardVault:r.vault};m.push(h.TokenExtensionUtil.isV2IxRequiredReward(I,n)?s.WhirlpoolIx.collectRewardV2Ix(t.program,{...a,rewardMint:I.rewardTokenMintsWithProgram[n].address,rewardTokenProgram:I.rewardTokenMintsWithProgram[n].tokenProgram,rewardTransferHookAccounts:await h.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,I.rewardTokenMintsWithProgram[n],a.rewardVault,a.rewardOwnerAccount,a.whirlpool)}):s.WhirlpoolIx.collectRewardIx(t.program,a))}return m}},73984:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectProtocolFees=void 0;const r=n(66259),i=n(29955),o=n(18245),s=n(41786),a=n(25367),u=n(76300),c=n(93018),d=n(90115);e.collectProtocolFees=async function(t,e){const n=t.wallet.publicKey,l=t.wallet.publicKey,h=Array.from((await t.fetcher.getPools(e,s.PREFER_CACHE)).values()),f=(0,a.getTokenMintsFromWhirlpools)(h,a.TokenMintTypes.POOL_ONLY).mintMap;await t.fetcher.getMintInfos(f);const p=await t.fetcher.getAccountRentExempt(),{ataTokenAddresses:m,resolveAtaIxs:g}=await(0,a.resolveAtaForMints)(t,{mints:f,accountExemption:p,receiver:n,payer:l}),y=await t.connection.getLatestBlockhash();let b=new r.TransactionBuilder(t.connection,t.wallet,t.txBuilderOpts).addInstructions(g);const w=[];for(const o of e){const e=await t.fetcher.getPool(o);if(!e)throw new Error(`Pool not found: ${o}`);const l=await t.fetcher.getConfig(e.whirlpoolsConfig);if(!l)throw new Error(`Config not found: ${e.whirlpoolsConfig}`);if(l.collectProtocolFeesAuthority.toBase58()!==t.wallet.publicKey.toBase58())throw new Error("Wallet is not the collectProtocolFeesAuthority");const h=r.TokenUtil.isNativeMint(e.tokenMintA)||r.TokenUtil.isNativeMint(e.tokenMintB),f=!!m[i.NATIVE_MINT.toBase58()];h&&!f&&(0,a.addNativeMintHandlingIx)(b,m,n,p,t.accountResolverOpts.createWrappedSolAccountMethod);const g=await c.TokenExtensionUtil.buildTokenExtensionContext(t.fetcher,e,s.PREFER_CACHE),y={whirlpoolsConfig:e.whirlpoolsConfig,whirlpool:r.AddressUtil.toPubKey(o),tokenVaultA:e.tokenVaultA,tokenVaultB:e.tokenVaultB,tokenOwnerAccountA:m[e.tokenMintA.toBase58()],tokenOwnerAccountB:m[e.tokenMintB.toBase58()],collectProtocolFeesAuthority:l.collectProtocolFeesAuthority};w.push(c.TokenExtensionUtil.isV2IxRequiredPool(g)?(0,d.collectProtocolFeesV2Ix)(t.program,{...y,tokenMintA:g.tokenMintWithProgramA.address,tokenMintB:g.tokenMintWithProgramB.address,tokenProgramA:g.tokenMintWithProgramA.tokenProgram,tokenProgramB:g.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await c.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,g.tokenMintWithProgramA,y.tokenVaultA,y.tokenOwnerAccountA,y.whirlpool),tokenTransferHookAccountsB:await c.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,g.tokenMintWithProgramB,y.tokenVaultB,y.tokenOwnerAccountB,y.whirlpool)}):(0,u.collectProtocolFeesIx)(t.program,y))}b.addInstructions(w);const _=await b.txnSize({latestBlockhash:y});if(_>o.PACKET_DATA_SIZE)throw new Error(`Transaction size is too large: ${_}`);return b}},84533:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(37970),e),i(n(73984),e),i(n(9599),e)},9599:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.swapAsync=void 0;const r=n(66259),i=n(40273),o=n(76191),s=n(93018),a=n(90115);e.swapAsync=async function(t,e,n){const{wallet:u,whirlpool:c,swapInput:d}=e,{aToB:l,amount:h}=d,f=new r.TransactionBuilder(t.connection,t.wallet,t.txBuilderOpts),p=[d.tickArray0,d.tickArray1,d.tickArray2];let m=await i.TickArrayUtil.getUninitializedArraysString(p,t.fetcher,n);if(m)throw new Error(`TickArray addresses - [${m}] need to be initialized.`);const g=c.getData(),[y,b]=await(0,r.resolveOrCreateATAs)(t.connection,u,[{tokenMint:g.tokenMintA,wrappedSolAmountIn:l?h:r.ZERO},{tokenMint:g.tokenMintB,wrappedSolAmountIn:l?r.ZERO:h}],(()=>t.fetcher.getAccountRentExempt()),void 0,!0,t.accountResolverOpts.allowPDAOwnerAddress,t.accountResolverOpts.createWrappedSolAccountMethod),{address:w,..._}=y,{address:v,...k}=b;f.addInstructions([_,k]);const M=l?w:v,A=l?v:w,S=await s.TokenExtensionUtil.buildTokenExtensionContext(t.fetcher,g),I=i.SwapUtils.getSwapParamsFromQuote(d,t,c,M,A,u);return f.addInstruction(s.TokenExtensionUtil.isV2IxRequiredPool(S)?(0,a.swapV2Ix)(t.program,{...I,tokenMintA:S.tokenMintWithProgramA.address,tokenMintB:S.tokenMintWithProgramB.address,tokenProgramA:S.tokenMintWithProgramA.tokenProgram,tokenProgramB:S.tokenMintWithProgramB.tokenProgram,tokenTransferHookAccountsA:await s.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,S.tokenMintWithProgramA,I.aToB?I.tokenOwnerAccountA:I.tokenVaultA,I.aToB?I.tokenVaultA:I.tokenOwnerAccountA,I.aToB?I.tokenAuthority:I.whirlpool),tokenTransferHookAccountsB:await s.TokenExtensionUtil.getExtraAccountMetasForTransferHook(t.connection,S.tokenMintWithProgramB,I.aToB?I.tokenVaultB:I.tokenOwnerAccountB,I.aToB?I.tokenOwnerAccountB:I.tokenVaultB,I.aToB?I.whirlpool:I.tokenAuthority)}):(0,o.swapIx)(t.program,I))}},37542:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getSwapFromRoute=void 0;const i=n(66259),o=n(29955),s=n(18245),a=r(n(13550)),u=n(40273),c=n(41786),d=n(79468),l=n(51986),h=n(76191),f=n(37771);function p(t,e){const{hopQuotes:n}=t;if(1===n.length)return{...t,hopQuotes:[{...n[0],quote:{...n[0].quote,...u.SwapUtils.calculateSwapAmountsFromQuote(n[0].quote.amount,n[0].quote.estimatedAmountIn,n[0].quote.estimatedAmountOut,e,n[0].quote.amountSpecifiedIsInput)}}]};if(2===t.hopQuotes.length){const n=t.hopQuotes[0],r=t.hopQuotes[1],i=n.quote.amountSpecifiedIsInput;let o={...t};return o.hopQuotes=i?[o.hopQuotes[0],{...r,quote:{...r.quote,otherAmountThreshold:(0,d.adjustForSlippage)(r.quote.estimatedAmountOut,e,!1)}}]:[{...n,quote:{...n.quote,otherAmountThreshold:(0,d.adjustForSlippage)(n.quote.estimatedAmountIn,e,!0)}},o.hopQuotes[1]],o}return t}e.getSwapFromRoute=async function(t,e,n=c.PREFER_CACHE,r=new i.TransactionBuilder(t.connection,t.wallet,(0,l.contextOptionsToBuilderOptions)(t.opts))){const{route:d,wallet:m,resolvedAtaAccounts:g,slippage:y}=e,b=new Set,w=new Set,_=[];let v=!1,k=new a.default(0);function M(t,e){t===o.NATIVE_MINT.toBase58()?(v=!0,k=k.add(e)):b.add(t)}for(let t=0;tnew s.PublicKey(t))),l=d.map((e=>(0,o.getAssociatedTokenAddressSync)(e,t,u)));return(await r(l)).forEach(((e,r)=>{const s=l[r];let u;if(e){if(!e.owner.equals(t))throw new Error(`ATA with change of ownership detected: ${s.toBase58()}`);u={address:s,...i.EMPTY_INSTRUCTION}}else{const e=d[r],i=[(0,o.createAssociatedTokenAccountInstruction)(a,s,t,e)];let c=[];n.has(e.toBase58())&&(c=[(0,o.createCloseAccountInstruction)(s,t,t)]),u={address:s,instructions:i,cleanupInstructions:c,signers:[]}}c[d[r].toBase58()]={tokenProgram:o.TOKEN_PROGRAM_ID,...u}})),c}(m,b,w,(e=>null!=g?Promise.resolve(e.map((t=>g.find((e=>e.address?.toBase58()===t.toBase58()))))):t.fetcher.getTokenInfos(e,n).then((t=>Array.from(t.values())))),void 0,t.accountResolverOpts.allowPDAOwnerAddress),I=Object.values(S);if(v){const e=i.TokenUtil.createWrappedNativeAccountInstruction(m,k,await t.fetcher.getAccountRentExempt(),void 0,void 0,t.accountResolverOpts.createWrappedSolAccountMethod);r.addInstruction(e),S[o.NATIVE_MINT.toBase58()]=e}r.addInstructions(I);const x=d.subRoutes.map((t=>p(t,y)));for(let e=0;e{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decreaseLiquidityIx=void 0;const r=n(29955);e.decreaseLiquidityIx=function(t,e){const{liquidityAmount:n,tokenMinA:i,tokenMinB:o,whirlpool:s,positionAuthority:a,position:u,positionTokenAccount:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tickArrayLower:p,tickArrayUpper:m}=e;return{instructions:[t.instruction.decreaseLiquidity(n,i,o,{accounts:{whirlpool:s,tokenProgram:r.TOKEN_PROGRAM_ID,positionAuthority:a,position:u,positionTokenAccount:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tickArrayLower:p,tickArrayUpper:m}})],cleanupInstructions:[],signers:[]}}},23895:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.deletePositionBundleIx=void 0;const r=n(29955);e.deletePositionBundleIx=function(t,e){const{owner:n,positionBundle:i,positionBundleMint:o,positionBundleTokenAccount:s,receiver:a}=e;return{instructions:[t.instruction.deletePositionBundle({accounts:{positionBundle:i,positionBundleMint:o,positionBundleTokenAccount:s,positionBundleOwner:n,receiver:a,tokenProgram:r.TOKEN_PROGRAM_ID}})],cleanupInstructions:[],signers:[]}}},84284:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.increaseLiquidityIx=void 0;const r=n(29955);e.increaseLiquidityIx=function(t,e){const{liquidityAmount:n,tokenMaxA:i,tokenMaxB:o,whirlpool:s,positionAuthority:a,position:u,positionTokenAccount:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tickArrayLower:p,tickArrayUpper:m}=e;return{instructions:[t.instruction.increaseLiquidity(n,i,o,{accounts:{whirlpool:s,tokenProgram:r.TOKEN_PROGRAM_ID,positionAuthority:a,position:u,positionTokenAccount:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tickArrayLower:p,tickArrayUpper:m}})],cleanupInstructions:[],signers:[]}}},62902:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(65664),e),i(n(67236),e),i(n(42851),e),i(n(76300),e),i(n(63621),e),i(n(84533),e),i(n(54214),e),i(n(23895),e),i(n(84284),e),i(n(73483),e),i(n(20539),e),i(n(76255),e),i(n(74121),e),i(n(62314),e),i(n(23722),e),i(n(24833),e),i(n(30125),e),i(n(43582),e),i(n(54614),e),i(n(71822),e),i(n(3124),e),i(n(32655),e),i(n(88484),e),i(n(99195),e),i(n(7526),e),i(n(70786),e),i(n(72286),e),i(n(76191),e),i(n(37771),e),i(n(85204),e),i(n(90115),e)},73483:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializeConfigIx=void 0;const r=n(18245);e.initializeConfigIx=function(t,e){const{feeAuthority:n,collectProtocolFeesAuthority:i,rewardEmissionsSuperAuthority:o,defaultProtocolFeeRate:s,funder:a}=e;return{instructions:[t.instruction.initializeConfig(n,i,o,s,{accounts:{config:e.whirlpoolsConfigKeypair.publicKey,funder:a,systemProgram:r.SystemProgram.programId}})],cleanupInstructions:[],signers:[e.whirlpoolsConfigKeypair]}}},20539:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializeFeeTierIx=void 0;const r=n(18245);e.initializeFeeTierIx=function(t,e){const{feeTierPda:n,whirlpoolsConfig:i,tickSpacing:o,feeAuthority:s,defaultFeeRate:a,funder:u}=e;return{instructions:[t.instruction.initializeFeeTier(o,a,{accounts:{config:i,feeTier:n.publicKey,feeAuthority:s,funder:u,systemProgram:r.SystemProgram.programId}})],cleanupInstructions:[],signers:[]}}},76255:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializePoolIx=void 0;const r=n(29955),i=n(18245);e.initializePoolIx=function(t,e){const{initSqrtPrice:n,tokenMintA:o,tokenMintB:s,whirlpoolsConfig:a,whirlpoolPda:u,feeTierKey:c,tokenVaultAKeypair:d,tokenVaultBKeypair:l,tickSpacing:h,funder:f}=e,p={whirlpoolBump:u.bump};return{instructions:[t.instruction.initializePool(p,h,n,{accounts:{whirlpoolsConfig:a,tokenMintA:o,tokenMintB:s,funder:f,whirlpool:u.publicKey,tokenVaultA:d.publicKey,tokenVaultB:l.publicKey,feeTier:c,tokenProgram:r.TOKEN_PROGRAM_ID,systemProgram:i.SystemProgram.programId,rent:i.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[d,l]}}},74121:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.initializePositionBundleWithMetadataIx=e.initializePositionBundleIx=void 0;const s=o(n(78845)),a=n(29955),u=n(18245),c=n(40273);e.initializePositionBundleIx=function(t,e){const{owner:n,positionBundlePda:r,positionBundleMintKeypair:i,positionBundleTokenAccount:o,funder:c}=e;return{instructions:[t.instruction.initializePositionBundle({accounts:{positionBundle:r.publicKey,positionBundleMint:i.publicKey,positionBundleTokenAccount:o,positionBundleOwner:n,funder:c,associatedTokenProgram:a.ASSOCIATED_TOKEN_PROGRAM_ID,tokenProgram:a.TOKEN_PROGRAM_ID,systemProgram:u.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[i]}},e.initializePositionBundleWithMetadataIx=function(t,e){const{owner:n,positionBundlePda:r,positionBundleMintKeypair:i,positionBundleTokenAccount:o,positionBundleMetadataPda:d,funder:l}=e;return{instructions:[t.instruction.initializePositionBundleWithMetadata({accounts:{positionBundle:r.publicKey,positionBundleMint:i.publicKey,positionBundleMetadata:d.publicKey,positionBundleTokenAccount:o,positionBundleOwner:n,funder:l,associatedTokenProgram:a.ASSOCIATED_TOKEN_PROGRAM_ID,tokenProgram:a.TOKEN_PROGRAM_ID,systemProgram:u.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY,metadataProgram:c.METADATA_PROGRAM_ADDRESS,metadataUpdateAuth:c.WHIRLPOOL_NFT_UPDATE_AUTH}})],cleanupInstructions:[],signers:[i]}}},62314:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeRewardIx=void 0;const s=o(n(78845)),a=n(29955),u=n(18245);e.initializeRewardIx=function(t,e){const{rewardAuthority:n,funder:r,whirlpool:i,rewardMint:o,rewardVaultKeypair:c,rewardIndex:d}=e;return{instructions:[t.instruction.initializeReward(d,{accounts:{rewardAuthority:n,funder:r,whirlpool:i,rewardMint:o,rewardVault:c.publicKey,tokenProgram:a.TOKEN_PROGRAM_ID,systemProgram:u.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[c]}}},23722:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.initTickArrayIx=void 0;const s=o(n(78845));e.initTickArrayIx=function(t,e){const{whirlpool:n,funder:r,tickArrayPda:i}=e;return{instructions:[t.instruction.initializeTickArray(e.startTick,{accounts:{whirlpool:n,funder:r,tickArray:i.publicKey,systemProgram:s.web3.SystemProgram.programId}})],cleanupInstructions:[],signers:[]}}},24833:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.openBundledPositionIx=void 0;const s=o(n(78845)),a=n(18245);e.openBundledPositionIx=function(t,e){const{whirlpool:n,bundledPositionPda:r,positionBundle:i,positionBundleTokenAccount:o,positionBundleAuthority:u,bundleIndex:c,tickLowerIndex:d,tickUpperIndex:l,funder:h}=e;return{instructions:[t.instruction.openBundledPosition(c,d,l,{accounts:{bundledPosition:r.publicKey,positionBundle:i,positionBundleTokenAccount:o,positionBundleAuthority:u,whirlpool:n,funder:h,systemProgram:a.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[]}}},30125:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.openPositionWithMetadataIx=e.openPositionIx=void 0;const r=n(40273),i=n(70706);e.openPositionIx=function(t,e){const{positionPda:n,tickLowerIndex:r,tickUpperIndex:o}=e,s={positionBump:n.bump};return{instructions:[t.instruction.openPosition(s,r,o,{accounts:(0,i.openPositionAccounts)(e)})],cleanupInstructions:[],signers:[]}},e.openPositionWithMetadataIx=function(t,e){const{positionPda:n,metadataPda:o,tickLowerIndex:s,tickUpperIndex:a}=e,u={positionBump:n.bump,metadataBump:o.bump};return{instructions:[t.instruction.openPositionWithMetadata(u,s,a,{accounts:{...(0,i.openPositionAccounts)(e),positionMetadataAccount:o.publicKey,metadataProgram:r.METADATA_PROGRAM_ADDRESS,metadataUpdateAuth:r.WHIRLPOOL_NFT_UPDATE_AUTH}})],cleanupInstructions:[],signers:[]}}},43582:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setCollectProtocolFeesAuthorityIx=void 0,e.setCollectProtocolFeesAuthorityIx=function(t,e){const{whirlpoolsConfig:n,collectProtocolFeesAuthority:r,newCollectProtocolFeesAuthority:i}=e;return{instructions:[t.instruction.setCollectProtocolFeesAuthority({accounts:{whirlpoolsConfig:n,collectProtocolFeesAuthority:r,newCollectProtocolFeesAuthority:i}})],cleanupInstructions:[],signers:[]}}},54614:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setDefaultFeeRateIx=void 0;const r=n(74808);e.setDefaultFeeRateIx=function(t,e){const{whirlpoolsConfig:n,feeAuthority:i,tickSpacing:o,defaultFeeRate:s}=e,a=r.PDAUtil.getFeeTier(t.programId,n,o);return{instructions:[t.instruction.setDefaultFeeRate(s,{accounts:{whirlpoolsConfig:n,feeTier:a.publicKey,feeAuthority:i}})],cleanupInstructions:[],signers:[]}}},71822:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setDefaultProtocolFeeRateIx=void 0,e.setDefaultProtocolFeeRateIx=function(t,e){const{whirlpoolsConfig:n,feeAuthority:r,defaultProtocolFeeRate:i}=e;return{instructions:[t.instruction.setDefaultProtocolFeeRate(i,{accounts:{whirlpoolsConfig:n,feeAuthority:r}})],cleanupInstructions:[],signers:[]}}},3124:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setFeeAuthorityIx=void 0,e.setFeeAuthorityIx=function(t,e){const{whirlpoolsConfig:n,feeAuthority:r,newFeeAuthority:i}=e;return{instructions:[t.instruction.setFeeAuthority({accounts:{whirlpoolsConfig:n,feeAuthority:r,newFeeAuthority:i}})],cleanupInstructions:[],signers:[]}}},32655:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setFeeRateIx=void 0,e.setFeeRateIx=function(t,e){const{whirlpoolsConfig:n,whirlpool:r,feeAuthority:i,feeRate:o}=e;return{instructions:[t.instruction.setFeeRate(o,{accounts:{whirlpoolsConfig:n,whirlpool:r,feeAuthority:i}})],cleanupInstructions:[],signers:[]}}},88484:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setProtocolFeeRateIx=void 0,e.setProtocolFeeRateIx=function(t,e){const{whirlpoolsConfig:n,whirlpool:r,feeAuthority:i,protocolFeeRate:o}=e;return{instructions:[t.instruction.setProtocolFeeRate(o,{accounts:{whirlpoolsConfig:n,whirlpool:r,feeAuthority:i}})],cleanupInstructions:[],signers:[]}}},99195:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardAuthorityBySuperAuthorityIx=void 0,e.setRewardAuthorityBySuperAuthorityIx=function(t,e){const{whirlpoolsConfig:n,whirlpool:r,rewardEmissionsSuperAuthority:i,newRewardAuthority:o,rewardIndex:s}=e;return{instructions:[t.instruction.setRewardAuthorityBySuperAuthority(s,{accounts:{whirlpoolsConfig:n,whirlpool:r,rewardEmissionsSuperAuthority:i,newRewardAuthority:o}})],cleanupInstructions:[],signers:[]}}},7526:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardAuthorityIx=void 0,e.setRewardAuthorityIx=function(t,e){const{whirlpool:n,rewardAuthority:r,newRewardAuthority:i,rewardIndex:o}=e;return{instructions:[t.instruction.setRewardAuthority(o,{accounts:{whirlpool:n,rewardAuthority:r,newRewardAuthority:i}})],cleanupInstructions:[],signers:[]}}},70786:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardEmissionsIx=void 0,e.setRewardEmissionsIx=function(t,e){const{rewardAuthority:n,whirlpool:r,rewardIndex:i,rewardVaultKey:o,emissionsPerSecondX64:s}=e;return{instructions:[t.instruction.setRewardEmissions(i,s,{accounts:{rewardAuthority:n,whirlpool:r,rewardVault:o}})],cleanupInstructions:[],signers:[]}}},72286:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardEmissionsSuperAuthorityIx=void 0,e.setRewardEmissionsSuperAuthorityIx=function(t,e){const{whirlpoolsConfig:n,rewardEmissionsSuperAuthority:r,newRewardEmissionsSuperAuthority:i}=e;return{instructions:[t.instruction.setRewardEmissionsSuperAuthority({accounts:{whirlpoolsConfig:n,rewardEmissionsSuperAuthority:r,newRewardEmissionsSuperAuthority:i}})],cleanupInstructions:[],signers:[]}}},76191:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.swapIx=void 0;const r=n(29955);e.swapIx=function(t,e){const{amount:n,otherAmountThreshold:i,sqrtPriceLimit:o,amountSpecifiedIsInput:s,aToB:a,whirlpool:u,tokenAuthority:c,tokenOwnerAccountA:d,tokenVaultA:l,tokenOwnerAccountB:h,tokenVaultB:f,tickArray0:p,tickArray1:m,tickArray2:g,oracle:y}=e;return{instructions:[t.instruction.swap(n,i,o,s,a,{accounts:{tokenProgram:r.TOKEN_PROGRAM_ID,tokenAuthority:c,whirlpool:u,tokenOwnerAccountA:d,tokenVaultA:l,tokenOwnerAccountB:h,tokenVaultB:f,tickArray0:p,tickArray1:m,tickArray2:g,oracle:y}})],cleanupInstructions:[],signers:[]}}},37771:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.twoHopSwapIx=void 0;const r=n(29955);e.twoHopSwapIx=function(t,e){const{amount:n,otherAmountThreshold:i,amountSpecifiedIsInput:o,aToBOne:s,aToBTwo:a,sqrtPriceLimitOne:u,sqrtPriceLimitTwo:c,whirlpoolOne:d,whirlpoolTwo:l,tokenAuthority:h,tokenOwnerAccountOneA:f,tokenVaultOneA:p,tokenOwnerAccountOneB:m,tokenVaultOneB:g,tokenOwnerAccountTwoA:y,tokenVaultTwoA:b,tokenOwnerAccountTwoB:w,tokenVaultTwoB:_,tickArrayOne0:v,tickArrayOne1:k,tickArrayOne2:M,tickArrayTwo0:A,tickArrayTwo1:S,tickArrayTwo2:I,oracleOne:x,oracleTwo:E}=e;return{instructions:[t.instruction.twoHopSwap(n,i,o,s,a,u,c,{accounts:{tokenProgram:r.TOKEN_PROGRAM_ID,tokenAuthority:h,whirlpoolOne:d,whirlpoolTwo:l,tokenOwnerAccountOneA:f,tokenVaultOneA:p,tokenOwnerAccountOneB:m,tokenVaultOneB:g,tokenOwnerAccountTwoA:y,tokenVaultTwoA:b,tokenOwnerAccountTwoB:w,tokenVaultTwoB:_,tickArrayOne0:v,tickArrayOne1:k,tickArrayOne2:M,tickArrayTwo0:A,tickArrayTwo1:S,tickArrayTwo2:I,oracleOne:x,oracleTwo:E}})],cleanupInstructions:[],signers:[]}}},85204:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.updateFeesAndRewardsIx=void 0,e.updateFeesAndRewardsIx=function(t,e){const{whirlpool:n,position:r,tickArrayLower:i,tickArrayUpper:o}=e;return{instructions:[t.instruction.updateFeesAndRewards({accounts:{whirlpool:n,position:r,tickArrayLower:i,tickArrayUpper:o}})],cleanupInstructions:[],signers:[]}}},99110:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectFeesV2Ix=void 0;const r=n(40273),i=n(60605);e.collectFeesV2Ix=function(t,e){const{whirlpool:n,positionAuthority:o,position:s,positionTokenAccount:a,tokenMintA:u,tokenMintB:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tokenTransferHookAccountsA:p,tokenTransferHookAccountsB:m,tokenProgramA:g,tokenProgramB:y}=e,[b,w]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,p).addSlice(i.RemainingAccountsType.TransferHookB,m).build();return{instructions:[t.instruction.collectFeesV2(b,{accounts:{whirlpool:n,positionAuthority:o,position:s,positionTokenAccount:a,tokenMintA:u,tokenMintB:c,tokenOwnerAccountA:d,tokenOwnerAccountB:l,tokenVaultA:h,tokenVaultB:f,tokenProgramA:g,tokenProgramB:y,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:w})],cleanupInstructions:[],signers:[]}}},20628:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectProtocolFeesV2Ix=void 0;const r=n(40273),i=n(60605);e.collectProtocolFeesV2Ix=function(t,e){const{whirlpoolsConfig:n,whirlpool:o,collectProtocolFeesAuthority:s,tokenMintA:a,tokenMintB:u,tokenVaultA:c,tokenVaultB:d,tokenTransferHookAccountsA:l,tokenTransferHookAccountsB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenProgramA:m,tokenProgramB:g}=e,[y,b]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,l).addSlice(i.RemainingAccountsType.TransferHookB,h).build();return{instructions:[t.instruction.collectProtocolFeesV2(y,{accounts:{whirlpoolsConfig:n,whirlpool:o,collectProtocolFeesAuthority:s,tokenMintA:a,tokenMintB:u,tokenVaultA:c,tokenVaultB:d,tokenDestinationA:f,tokenDestinationB:p,tokenProgramA:m,tokenProgramB:g,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:b})],cleanupInstructions:[],signers:[]}}},48893:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectRewardV2Ix=void 0;const r=n(40273),i=n(60605);e.collectRewardV2Ix=function(t,e){const{whirlpool:n,positionAuthority:o,position:s,positionTokenAccount:a,rewardMint:u,rewardOwnerAccount:c,rewardVault:d,rewardTransferHookAccounts:l,rewardIndex:h,rewardTokenProgram:f}=e,[p,m]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookReward,l).build();return{instructions:[t.instruction.collectRewardV2(h,p,{accounts:{whirlpool:n,positionAuthority:o,position:s,positionTokenAccount:a,rewardMint:u,rewardOwnerAccount:c,rewardVault:d,rewardTokenProgram:f,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:m})],cleanupInstructions:[],signers:[]}}},28110:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decreaseLiquidityV2Ix=void 0;const r=n(40273),i=n(60605);e.decreaseLiquidityV2Ix=function(t,e){const{liquidityAmount:n,tokenMinA:o,tokenMinB:s,whirlpool:a,positionAuthority:u,position:c,positionTokenAccount:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenVaultA:m,tokenVaultB:g,tokenTransferHookAccountsA:y,tokenTransferHookAccountsB:b,tokenProgramA:w,tokenProgramB:_,tickArrayLower:v,tickArrayUpper:k}=e,[M,A]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,y).addSlice(i.RemainingAccountsType.TransferHookB,b).build();return{instructions:[t.instruction.decreaseLiquidityV2(n,o,s,M,{accounts:{whirlpool:a,positionAuthority:u,position:c,positionTokenAccount:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenVaultA:m,tokenVaultB:g,tokenProgramA:w,tokenProgramB:_,tickArrayLower:v,tickArrayUpper:k,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:A})],cleanupInstructions:[],signers:[]}}},96555:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.deleteTokenBadgeIx=void 0,e.deleteTokenBadgeIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,tokenBadgeAuthority:i,tokenMint:o,tokenBadge:s,receiver:a}=e;return{instructions:[t.instruction.deleteTokenBadge({accounts:{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,tokenBadgeAuthority:i,tokenMint:o,tokenBadge:s,receiver:a}})],cleanupInstructions:[],signers:[]}}},29582:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.increaseLiquidityV2Ix=void 0;const r=n(40273),i=n(60605);e.increaseLiquidityV2Ix=function(t,e){const{liquidityAmount:n,tokenMaxA:o,tokenMaxB:s,whirlpool:a,positionAuthority:u,position:c,positionTokenAccount:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenVaultA:m,tokenVaultB:g,tokenTransferHookAccountsA:y,tokenTransferHookAccountsB:b,tokenProgramA:w,tokenProgramB:_,tickArrayLower:v,tickArrayUpper:k}=e,[M,A]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,y).addSlice(i.RemainingAccountsType.TransferHookB,b).build();return{instructions:[t.instruction.increaseLiquidityV2(n,o,s,M,{accounts:{whirlpool:a,positionAuthority:u,position:c,positionTokenAccount:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenOwnerAccountB:p,tokenVaultA:m,tokenVaultB:g,tokenProgramA:w,tokenProgramB:_,tickArrayLower:v,tickArrayUpper:k,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:A})],cleanupInstructions:[],signers:[]}}},90115:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(99110),e),i(n(20628),e),i(n(48893),e),i(n(28110),e),i(n(29582),e),i(n(45805),e),i(n(81522),e),i(n(51965),e),i(n(63486),e),i(n(73826),e),i(n(38310),e),i(n(64439),e),i(n(82982),e),i(n(82607),e),i(n(96555),e)},38310:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializeConfigExtensionIx=void 0;const r=n(18245);e.initializeConfigExtensionIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtensionPda:i,funder:o,feeAuthority:s}=e;return{instructions:[t.instruction.initializeConfigExtension({accounts:{config:n,configExtension:i.publicKey,funder:o,feeAuthority:s,systemProgram:r.SystemProgram.programId}})],cleanupInstructions:[],signers:[]}}},45805:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializePoolV2Ix=void 0;const r=n(18245);e.initializePoolV2Ix=function(t,e){const{initSqrtPrice:n,tokenMintA:i,tokenMintB:o,tokenBadgeA:s,tokenBadgeB:a,tokenProgramA:u,tokenProgramB:c,whirlpoolsConfig:d,whirlpoolPda:l,feeTierKey:h,tokenVaultAKeypair:f,tokenVaultBKeypair:p,tickSpacing:m,funder:g}=e;return{instructions:[t.instruction.initializePoolV2(m,n,{accounts:{whirlpoolsConfig:d,tokenMintA:i,tokenMintB:o,tokenBadgeA:s,tokenBadgeB:a,funder:g,whirlpool:l.publicKey,tokenVaultA:f.publicKey,tokenVaultB:p.publicKey,feeTier:h,systemProgram:r.SystemProgram.programId,tokenProgramA:u,tokenProgramB:c,rent:r.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[f,p]}}},81522:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeRewardV2Ix=void 0;const s=o(n(78845)),a=n(18245);e.initializeRewardV2Ix=function(t,e){const{rewardAuthority:n,funder:r,whirlpool:i,rewardMint:o,rewardTokenBadge:u,rewardVaultKeypair:c,rewardIndex:d,rewardTokenProgram:l}=e;return{instructions:[t.instruction.initializeRewardV2(d,{accounts:{rewardAuthority:n,funder:r,whirlpool:i,rewardMint:o,rewardTokenBadge:u,rewardVault:c.publicKey,rewardTokenProgram:l,systemProgram:a.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY}})],cleanupInstructions:[],signers:[c]}}},82607:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initializeTokenBadgeIx=void 0;const r=n(18245);e.initializeTokenBadgeIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtension:i,tokenBadgeAuthority:o,tokenMint:s,tokenBadgePda:a,funder:u}=e;return{instructions:[t.instruction.initializeTokenBadge({accounts:{whirlpoolsConfig:n,whirlpoolsConfigExtension:i,tokenBadgeAuthority:o,tokenMint:s,tokenBadge:a.publicKey,funder:u,systemProgram:r.SystemProgram.programId}})],cleanupInstructions:[],signers:[]}}},64439:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setConfigExtensionAuthorityIx=void 0,e.setConfigExtensionAuthorityIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,configExtensionAuthority:i,newConfigExtensionAuthority:o}=e;return{instructions:[t.instruction.setConfigExtensionAuthority({accounts:{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,configExtensionAuthority:i,newConfigExtensionAuthority:o}})],cleanupInstructions:[],signers:[]}}},51965:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRewardEmissionsV2Ix=void 0,e.setRewardEmissionsV2Ix=function(t,e){const{rewardAuthority:n,whirlpool:r,rewardIndex:i,rewardVaultKey:o,emissionsPerSecondX64:s}=e;return{instructions:[t.instruction.setRewardEmissionsV2(i,s,{accounts:{rewardAuthority:n,whirlpool:r,rewardVault:o}})],cleanupInstructions:[],signers:[]}}},82982:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setTokenBadgeAuthorityIx=void 0,e.setTokenBadgeAuthorityIx=function(t,e){const{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,configExtensionAuthority:i,newTokenBadgeAuthority:o}=e;return{instructions:[t.instruction.setTokenBadgeAuthority({accounts:{whirlpoolsConfig:n,whirlpoolsConfigExtension:r,configExtensionAuthority:i,newTokenBadgeAuthority:o}})],cleanupInstructions:[],signers:[]}}},63486:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.swapV2Ix=void 0;const r=n(37917),i=n(60605);e.swapV2Ix=function(t,e){const{amount:n,otherAmountThreshold:o,sqrtPriceLimit:s,amountSpecifiedIsInput:a,aToB:u,whirlpool:c,tokenAuthority:d,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenVaultA:p,tokenOwnerAccountB:m,tokenVaultB:g,tokenTransferHookAccountsA:y,tokenTransferHookAccountsB:b,tokenProgramA:w,tokenProgramB:_,tickArray0:v,tickArray1:k,tickArray2:M,oracle:A}=e,[S,I]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookA,y).addSlice(i.RemainingAccountsType.TransferHookB,b).build();return{instructions:[t.instruction.swapV2(n,o,s,a,u,S,{accounts:{tokenProgramA:w,tokenProgramB:_,memoProgram:r.MEMO_PROGRAM_ADDRESS,tokenAuthority:d,whirlpool:c,tokenMintA:l,tokenMintB:h,tokenOwnerAccountA:f,tokenVaultA:p,tokenOwnerAccountB:m,tokenVaultB:g,tickArray0:v,tickArray1:k,tickArray2:M,oracle:A},remainingAccounts:I})],cleanupInstructions:[],signers:[]}}},73826:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.twoHopSwapV2Ix=void 0;const r=n(37917),i=n(60605);e.twoHopSwapV2Ix=function(t,e){const{amount:n,otherAmountThreshold:o,amountSpecifiedIsInput:s,aToBOne:a,aToBTwo:u,sqrtPriceLimitOne:c,sqrtPriceLimitTwo:d,whirlpoolOne:l,whirlpoolTwo:h,tokenMintInput:f,tokenMintIntermediate:p,tokenMintOutput:m,tokenProgramInput:g,tokenProgramIntermediate:y,tokenProgramOutput:b,tokenVaultOneInput:w,tokenVaultOneIntermediate:_,tokenVaultTwoIntermediate:v,tokenVaultTwoOutput:k,tokenAuthority:M,tokenTransferHookAccountsInput:A,tokenTransferHookAccountsIntermediate:S,tokenTransferHookAccountsOutput:I,tokenOwnerAccountInput:x,tokenOwnerAccountOutput:E,tickArrayOne0:T,tickArrayOne1:P,tickArrayOne2:B,tickArrayTwo0:L,tickArrayTwo1:$,tickArrayTwo2:R,oracleOne:O,oracleTwo:D}=e,[C,N]=(new i.RemainingAccountsBuilder).addSlice(i.RemainingAccountsType.TransferHookInput,A).addSlice(i.RemainingAccountsType.TransferHookIntermediate,S).addSlice(i.RemainingAccountsType.TransferHookOutput,I).build();return{instructions:[t.instruction.twoHopSwapV2(n,o,s,a,u,c,d,C,{accounts:{whirlpoolOne:l,whirlpoolTwo:h,tokenMintInput:f,tokenMintIntermediate:p,tokenMintOutput:m,tokenProgramInput:g,tokenProgramIntermediate:y,tokenProgramOutput:b,tokenOwnerAccountInput:x,tokenVaultOneInput:w,tokenVaultOneIntermediate:_,tokenVaultTwoIntermediate:v,tokenVaultTwoOutput:k,tokenOwnerAccountOutput:E,tokenAuthority:M,tickArrayOne0:T,tickArrayOne1:P,tickArrayOne2:B,tickArrayTwo0:L,tickArrayTwo1:$,tickArrayTwo2:R,oracleOne:O,oracleTwo:D,memoProgram:r.MEMO_PROGRAM_ADDRESS},remainingAccounts:N})],cleanupInstructions:[],signers:[]}}},19503:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolIx=void 0;const s=o(n(62902));e.WhirlpoolIx=class{static initializeConfigIx(t,e){return s.initializeConfigIx(t,e)}static initializeFeeTierIx(t,e){return s.initializeFeeTierIx(t,e)}static initializePoolIx(t,e){return s.initializePoolIx(t,e)}static initializeRewardIx(t,e){return s.initializeRewardIx(t,e)}static initTickArrayIx(t,e){return s.initTickArrayIx(t,e)}static openPositionIx(t,e){return s.openPositionIx(t,e)}static openPositionWithMetadataIx(t,e){return s.openPositionWithMetadataIx(t,e)}static increaseLiquidityIx(t,e){return s.increaseLiquidityIx(t,e)}static decreaseLiquidityIx(t,e){return s.decreaseLiquidityIx(t,e)}static closePositionIx(t,e){return s.closePositionIx(t,e)}static swapIx(t,e){return s.swapIx(t,e)}static twoHopSwapIx(t,e){return s.twoHopSwapIx(t,e)}static updateFeesAndRewardsIx(t,e){return s.updateFeesAndRewardsIx(t,e)}static collectFeesIx(t,e){return s.collectFeesIx(t,e)}static collectProtocolFeesIx(t,e){return s.collectProtocolFeesIx(t,e)}static collectRewardIx(t,e){return s.collectRewardIx(t,e)}static setCollectProtocolFeesAuthorityIx(t,e){return s.setCollectProtocolFeesAuthorityIx(t,e)}static setDefaultFeeRateIx(t,e){return s.setDefaultFeeRateIx(t,e)}static setDefaultProtocolFeeRateIx(t,e){return s.setDefaultProtocolFeeRateIx(t,e)}static setFeeAuthorityIx(t,e){return s.setFeeAuthorityIx(t,e)}static setFeeRateIx(t,e){return s.setFeeRateIx(t,e)}static setProtocolFeeRateIx(t,e){return s.setProtocolFeeRateIx(t,e)}static setRewardAuthorityBySuperAuthorityIx(t,e){return s.setRewardAuthorityBySuperAuthorityIx(t,e)}static setRewardAuthorityIx(t,e){return s.setRewardAuthorityIx(t,e)}static setRewardEmissionsIx(t,e){return s.setRewardEmissionsIx(t,e)}static setRewardEmissionsSuperAuthorityIx(t,e){return s.setRewardEmissionsSuperAuthorityIx(t,e)}static initializePositionBundleIx(t,e){return s.initializePositionBundleIx(t,e)}static initializePositionBundleWithMetadataIx(t,e){return s.initializePositionBundleWithMetadataIx(t,e)}static deletePositionBundleIx(t,e){return s.deletePositionBundleIx(t,e)}static openBundledPositionIx(t,e){return s.openBundledPositionIx(t,e)}static closeBundledPositionIx(t,e){return s.closeBundledPositionIx(t,e)}static collectFeesV2Ix(t,e){return s.collectFeesV2Ix(t,e)}static collectProtocolFeesV2Ix(t,e){return s.collectProtocolFeesV2Ix(t,e)}static collectRewardV2Ix(t,e){return s.collectRewardV2Ix(t,e)}static decreaseLiquidityV2Ix(t,e){return s.decreaseLiquidityV2Ix(t,e)}static increaseLiquidityV2Ix(t,e){return s.increaseLiquidityV2Ix(t,e)}static initializePoolV2Ix(t,e){return s.initializePoolV2Ix(t,e)}static initializeRewardV2Ix(t,e){return s.initializeRewardV2Ix(t,e)}static setRewardEmissionsV2Ix(t,e){return s.setRewardEmissionsV2Ix(t,e)}static swapV2Ix(t,e){return s.swapV2Ix(t,e)}static twoHopSwapV2Ix(t,e){return s.twoHopSwapV2Ix(t,e)}static initializeConfigExtensionIx(t,e){return s.initializeConfigExtensionIx(t,e)}static setConfigExtensionAuthorityIx(t,e){return s.setConfigExtensionAuthorityIx(t,e)}static setTokenBadgeAuthorityIx(t,e){return s.setTokenBadgeAuthorityIx(t,e)}static initializeTokenBadgeIx(t,e){return s.initializeTokenBadgeIx(t,e)}static deleteTokenBadgeIx(t,e){return s.deleteTokenBadgeIx(t,e)}}},74498:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolAccountFetcher=e.buildDefaultAccountFetcher=void 0;const r=n(66259),i=n(29955),o=n(57752),s=n(69261);e.buildDefaultAccountFetcher=t=>new a(t,new r.SimpleAccountFetcher(t,o.DEFAULT_WHIRLPOOL_RETENTION_POLICY));class a{constructor(t,e){this.connection=t,this.fetcher=e,this._epochInfoNextFetchTime=0}async getAccountRentExempt(t=!1){return this._accountRentExempt&&!t||(this._accountRentExempt=await this.connection.getMinimumBalanceForRentExemption(i.AccountLayout.span)),this._accountRentExempt}async getEpoch(t=!1){if(!this._epochInfo||Date.now()>=this._epochInfoNextFetchTime||t){const t=await this.connection.getEpochInfo(),e=Math.max(t.slotsInEpoch-t.slotIndex,0),n=Date.now()+320*e;this._epochInfo=t,this._epochInfoNextFetchTime=n}return this._epochInfo.epoch}getPool(t,e){return this.fetcher.getAccount(t,s.ParsableWhirlpool,e)}getPools(t,e){return this.fetcher.getAccounts(t,s.ParsableWhirlpool,e)}getPosition(t,e){return this.fetcher.getAccount(t,s.ParsablePosition,e)}getPositions(t,e){return this.fetcher.getAccounts(t,s.ParsablePosition,e)}getTickArray(t,e){return this.fetcher.getAccount(t,s.ParsableTickArray,e)}getTickArrays(t,e){return this.fetcher.getAccountsAsArray(t,s.ParsableTickArray,e)}getFeeTier(t,e){return this.fetcher.getAccount(t,s.ParsableFeeTier,e)}getFeeTiers(t,e){return this.fetcher.getAccounts(t,s.ParsableFeeTier,e)}getTokenInfo(t,e){return this.fetcher.getAccount(t,r.ParsableTokenAccountInfo,e)}getTokenInfos(t,e){return this.fetcher.getAccounts(t,r.ParsableTokenAccountInfo,e)}getMintInfo(t,e){return this.fetcher.getAccount(t,r.ParsableMintInfo,e)}getMintInfos(t,e){return this.fetcher.getAccounts(t,r.ParsableMintInfo,e)}getConfig(t,e){return this.fetcher.getAccount(t,s.ParsableWhirlpoolsConfig,e)}getConfigs(t,e){return this.fetcher.getAccounts(t,s.ParsableWhirlpoolsConfig,e)}getPositionBundle(t,e){return this.fetcher.getAccount(t,s.ParsablePositionBundle,e)}getPositionBundles(t,e){return this.fetcher.getAccounts(t,s.ParsablePositionBundle,e)}getConfigExtension(t,e){return this.fetcher.getAccount(t,s.ParsableWhirlpoolsConfigExtension,e)}getConfigExtensions(t,e){return this.fetcher.getAccounts(t,s.ParsableWhirlpoolsConfigExtension,e)}getTokenBadge(t,e){return this.fetcher.getAccount(t,s.ParsableTokenBadge,e)}getTokenBadges(t,e){return this.fetcher.getAccounts(t,s.ParsableTokenBadge,e)}populateCache(t,e,n=Date.now()){this.fetcher.populateAccounts(t,e,n)}}e.WhirlpoolAccountFetcher=a},36926:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PREFER_CACHE=e.IGNORE_CACHE=e.DEFAULT_WHIRLPOOL_RETENTION_POLICY=void 0,e.DEFAULT_WHIRLPOOL_RETENTION_POLICY=new Map([]),e.IGNORE_CACHE={maxAge:0},e.PREFER_CACHE={maxAge:Number.POSITIVE_INFINITY}},22862:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getAllWhirlpoolAccountsForConfig=void 0;const i=n(66259),o=r(n(26018)),s=n(37917),a=n(69261);e.getAllWhirlpoolAccountsForConfig=async function({connection:t,programId:e,configId:n}){const r=[{dataSize:(0,s.getAccountSize)(s.AccountName.Whirlpool)},{memcmp:s.WHIRLPOOL_CODER.memcmp(s.AccountName.Whirlpool,i.AddressUtil.toPubKey(n).toBuffer())}],u=await t.getProgramAccounts(i.AddressUtil.toPubKey(e),{filters:r}),c=[];return u.forEach((({pubkey:t,account:e})=>{const n=a.ParsableWhirlpool.parse(t,e);(0,o.default)(!!n,`could not parse whirlpool: ${t.toBase58()}`),c.push([i.AddressUtil.toString(t),n])})),new Map(c.map((([t,e])=>[i.AddressUtil.toString(t),e])))}},41786:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(74498),e),i(n(36926),e),i(n(22862),e)},57752:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(41786),e),i(n(69261),e)},69261:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.ParsableTokenBadge=e.ParsableWhirlpoolsConfigExtension=e.ParsablePositionBundle=e.ParsableFeeTier=e.ParsableTickArray=e.ParsablePosition=e.ParsableWhirlpool=e.ParsableWhirlpoolsConfig=void 0;const a=n(78845),u=n(66259),c=s(n(92220)),d=n(37917);let l=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.WhirlpoolsConfig,e)}catch(t){return console.error(`error while parsing WhirlpoolsConfig: ${t}`),null}}};e.ParsableWhirlpoolsConfig=l,e.ParsableWhirlpoolsConfig=l=o([(0,u.staticImplements)()],l);let h=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.Whirlpool,e)}catch(t){return console.error(`error while parsing Whirlpool: ${t}`),null}}};e.ParsableWhirlpool=h,e.ParsableWhirlpool=h=o([(0,u.staticImplements)()],h);let f=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.Position,e)}catch(t){return console.error(`error while parsing Position: ${t}`),null}}};e.ParsablePosition=f,e.ParsablePosition=f=o([(0,u.staticImplements)()],f);let p=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.TickArray,e)}catch(t){return console.error(`error while parsing TickArray: ${t}`),null}}};e.ParsableTickArray=p,e.ParsableTickArray=p=o([(0,u.staticImplements)()],p);let m=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.FeeTier,e)}catch(t){return console.error(`error while parsing FeeTier: ${t}`),null}}};e.ParsableFeeTier=m,e.ParsableFeeTier=m=o([(0,u.staticImplements)()],m);let g=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.PositionBundle,e)}catch(t){return console.error(`error while parsing PositionBundle: ${t}`),null}}};e.ParsablePositionBundle=g,e.ParsablePositionBundle=g=o([(0,u.staticImplements)()],g);let y=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.WhirlpoolsConfigExtension,e)}catch(t){return console.error(`error while parsing WhirlpoolsConfigExtension: ${t}`),null}}};e.ParsableWhirlpoolsConfigExtension=y,e.ParsableWhirlpoolsConfigExtension=y=o([(0,u.staticImplements)()],y);let b=class{constructor(){}static parse(t,e){if(!e?.data)return null;try{return _(d.AccountName.TokenBadge,e)}catch(t){return console.error(`error while parsing TokenBadge: ${t}`),null}}};e.ParsableTokenBadge=b,e.ParsableTokenBadge=b=o([(0,u.staticImplements)()],b);const w=new a.BorshAccountsCoder(c);function _(t,e){const n=e.data;if(a.BorshAccountsCoder.accountDiscriminator(t).compare(n.slice(0,8)))return console.error("incorrect account name during parsing"),null;try{return w.decode(t,n)}catch(t){return console.error("unknown account name during parsing"),null}}},36074:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.convertAmount=e.isSubset=e.calculatePricesForQuoteToken=void 0;const i=n(66259),o=r(n(93776)),s=n(54274),a=n(51476),u=n(74808),c=n(93018);function d(t,e){const n=t.tokenMintA.toBase58(),r=t.tokenMintB.toBase58();if(!(n in e)||!(r in e))throw new Error("Missing token decimals");return u.PriceMath.sqrtPriceX64ToPrice(t.sqrtPrice,e[n],e[r])}e.calculatePricesForQuoteToken=function(t,e,n,r,l,h,f){const p=function(t,e){const n=new Map;return Object.entries(e).forEach((([e,r])=>{const o=r.tokenMintA.toBase58(),s=r.tokenMintB.toBase58();if(r.liquidity.isZero())return;if(!r.tokenMintA.equals(t)&&!r.tokenMintB.equals(t))return;const a=r.tokenMintA.equals(t)?s:o,u=n.get(a);u&&!r.liquidity.gt(u.pool.liquidity)||n.set(a,{address:i.AddressUtil.toPubKey(e),pool:r})})),Object.fromEntries(n)}(e,n);return Object.fromEntries(t.map((t=>{const n=i.AddressUtil.toPubKey(t);if(n.equals(e))return[n.toBase58(),new o.default(1)];const[m,g]=u.PoolUtil.orderMints(n,e),y=i.AddressUtil.toPubKey(g).equals(e),b=y?m:g,w=p[i.AddressUtil.toString(b)];if(void 0===w)return[n.toBase58(),null];const{pool:_,address:v}=w,k=function(t,e,n,r,i=s.defaultGetPricesConfig){const{programId:o}=i;return u.SwapUtils.getTickArrayPublicKeys(t.tickCurrentIndex,t.tickSpacing,n,o,e).map((t=>({address:t,data:r[t.toBase58()]})))}(_,v,y,r,h),M=function(t,e,n,r,s){const{amountOut:l,priceImpactThreshold:h}=r;let f,p,m,g;try{({estimatedAmountIn:f}=(0,a.swapQuoteWithParams)({whirlpoolData:t,aToB:n,amountSpecifiedIsInput:!1,tokenAmount:l,otherAmountThreshold:u.SwapUtils.getDefaultOtherAmountThreshold(!1),sqrtPriceLimit:u.SwapUtils.getDefaultSqrtPriceLimit(n),tickArrays:e,tokenExtensionCtx:c.NO_TOKEN_EXTENSION_CONTEXT},i.Percentage.fromDecimal(new o.default(0))))}catch(t){return!1}n?(p=d(t,s),m=s[t.tokenMintA.toBase58()],g=s[t.tokenMintB.toBase58()]):(p=d(t,s).pow(-1),m=s[t.tokenMintB.toBase58()],g=s[t.tokenMintA.toBase58()]);const y=i.DecimalUtil.fromBN(l,g),b=i.DecimalUtil.fromBN(f,m),w=y.div(p).mul(h).toDecimalPlaces(m);return b.lte(w)}(_,k,y,f,l);if(!M)return[n.toBase58(),null];const A=d(_,l),S=y?A:A.pow(-1);return[n.toBase58(),S]})))},e.isSubset=function(t,e){return t.every((t=>e.includes(t)))},e.convertAmount=function(t,e,n,r){return i.DecimalUtil.toBN(i.DecimalUtil.fromBN(t,n).div(e),r)}},54274:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultGetPricesThresholdConfig=e.defaultGetPricesConfig=e.defaultQuoteTokens=void 0;const s=n(18245),a=o(n(13550)),u=n(37917),c=n(47178);i(n(65360),e),e.defaultQuoteTokens=[c.TOKEN_MINTS.USDC,c.TOKEN_MINTS.SOL,c.TOKEN_MINTS.mSOL,c.TOKEN_MINTS.stSOL].map((t=>new s.PublicKey(t))),e.defaultGetPricesConfig={quoteTokens:e.defaultQuoteTokens,tickSpacings:u.ORCA_SUPPORTED_TICK_SPACINGS,programId:u.ORCA_WHIRLPOOL_PROGRAM_ID,whirlpoolsConfig:u.ORCA_WHIRLPOOLS_CONFIG},e.defaultGetPricesThresholdConfig={amountOut:new a.default(1e9),priceImpactThreshold:1.05}},65360:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PriceModuleUtils=e.PriceModule=void 0;const r=n(66259),i=n(18245),o=n(54274),s=n(41786),a=n(74808),u=n(51986),c=n(36074);class d{static async fetchTokenPricesByMints(t,e,n=o.defaultGetPricesConfig,r=o.defaultGetPricesThresholdConfig,i=s.IGNORE_CACHE,a={}){const u=a?.poolMap?a?.poolMap:await l.fetchPoolDataFromMints(t,e,n,i),c=a?.tickArrayMap?a.tickArrayMap:await l.fetchTickArraysForPools(t,u,n,i),h=a?.decimalsMap?a.decimalsMap:await l.fetchDecimalsForMints(t,e,s.PREFER_CACHE);return d.calculateTokenPrices(e,{poolMap:u,tickArrayMap:c,decimalsMap:h},n,r)}static async fetchTokenPricesByPools(t,e,n=o.defaultGetPricesConfig,i=o.defaultGetPricesThresholdConfig,a=s.IGNORE_CACHE){const c=Array.from((await t.getPools(e,a)).values()),[h,f]=(0,u.filterNullObjects)(c,e),p=(0,u.convertListToMap)(h,r.AddressUtil.toStrings(f)),m=await l.fetchTickArraysForPools(t,p,n,a),g=Array.from(Object.values(p).reduce(((t,e)=>(t.add(e.tokenMintA.toBase58()),t.add(e.tokenMintB.toBase58()),t)),new Set)),y=await l.fetchDecimalsForMints(t,g,s.PREFER_CACHE);return d.calculateTokenPrices(g,{poolMap:p,tickArrayMap:m,decimalsMap:y},n,i)}static calculateTokenPrices(t,e,n=o.defaultGetPricesConfig,i=o.defaultGetPricesThresholdConfig){const{poolMap:s,decimalsMap:a,tickArrayMap:u}=e,d=r.AddressUtil.toStrings(t);if(!(0,c.isSubset)(n.quoteTokens.map((t=>r.AddressUtil.toString(t))),d.map((t=>t))))throw new Error("Quote tokens must be in mints array");const l=Object.fromEntries(d.map((t=>[t,null]))),h=n.quoteTokens.slice();let f=t.slice();for(;h.length>0&&f.length>0;){const t=h.shift();if(!t)throw new Error("Unreachable: remainingQuoteTokens is an empty array");let e;if(t.equals(n.quoteTokens[0]))e=i.amountOut;else{const r=t.toBase58(),o=l[r];if(!o)throw new Error(`Quote token - ${r} must have a price against the first quote token`);e=(0,c.convertAmount)(i.amountOut,o,a[n.quoteTokens[0].toBase58()],a[r])}const o=(0,c.calculatePricesForQuoteToken)(f,t,s,u,a,n,{amountOut:e,priceImpactThreshold:i.priceImpactThreshold}),d=l[t.toBase58()]||o[t.toBase58()];f.forEach((t=>{const e=r.AddressUtil.toString(t),n=o[e];null!=n&&null!=d&&(l[e]=n.mul(d))})),f=f.filter((t=>null==l[r.AddressUtil.toString(t)]))}return l}}e.PriceModule=d;class l{static async fetchPoolDataFromMints(t,e,n=o.defaultGetPricesConfig,i=s.IGNORE_CACHE){const{quoteTokens:c,tickSpacings:d,programId:l,whirlpoolsConfig:h}=n,f=e.map((t=>d.map((e=>c.map((n=>{const[i,o]=a.PoolUtil.orderMints(t,n);return a.PDAUtil.getWhirlpool(l,h,r.AddressUtil.toPubKey(i),r.AddressUtil.toPubKey(o),e).publicKey.toBase58()})))).flat())).flat(),p=Array.from((await t.getPools(f,i)).values()),[m,g]=(0,u.filterNullObjects)(p,f);return(0,u.convertListToMap)(m,g)}static async fetchTickArraysForPools(t,e,n=o.defaultGetPricesConfig,r=s.IGNORE_CACHE){const{programId:c}=n,d=t=>{const e=n.quoteTokens.findIndex((e=>e.equals(t)));return-1===e?n.quoteTokens.length:e},l=new Set;Object.entries(e).forEach((([t,e])=>{const n=d(e.tokenMintA),r=d(e.tokenMintB);if(n===r)return;const o=n>r;a.SwapUtils.getTickArrayPublicKeys(e.tickCurrentIndex,e.tickSpacing,o,c,new i.PublicKey(t)).forEach((t=>l.add(t.toBase58())))}));const h=Array.from(l),f=await t.getTickArrays(h,r),[p,m]=(0,u.filterNullObjects)(f,h);return(0,u.convertListToMap)(p,m)}static async fetchDecimalsForMints(t,e,n=s.IGNORE_CACHE){return Array.from((await t.getMintInfos(e,n)).values()).reduce(((t,n,i)=>{const o=r.AddressUtil.toString(e[i]);if(!n)throw new Error(`Mint account does not exist: ${o}`);return t[o]=n.decimals,t}),{})}}e.PriceModuleUtils=l},39313:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.collectFeesQuote=void 0;const r=n(66259),i=n(93018);e.collectFeesQuote=function(t){const{whirlpool:e,position:n,tickLower:o,tickUpper:s,tokenExtensionCtx:a}=t,{tickCurrentIndex:u,feeGrowthGlobalA:c,feeGrowthGlobalB:d}=e,{tickLowerIndex:l,tickUpperIndex:h,liquidity:f,feeOwedA:p,feeOwedB:m,feeGrowthCheckpointA:g,feeGrowthCheckpointB:y}=n,{feeGrowthOutsideA:b,feeGrowthOutsideB:w}=o,{feeGrowthOutsideA:_,feeGrowthOutsideB:v}=s;let k=null,M=null;u{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.swapQuoteByInputTokenWithDevFees=void 0;const r=n(37392),i=n(51476);e.swapQuoteByInputTokenWithDevFees=async function(t,e,n,o,s,a,u,c){if(u.toDecimal().greaterThanOrEqualTo(1))throw new r.WhirlpoolsError("Provided devFeePercentage must be less than 100%",r.SwapErrorCode.InvalidDevFeePercentage);const d=n.mul(u.numerator).div(u.denominator),l=await(0,i.swapQuoteByInputToken)(t,e,n.sub(d),o,s,a,c);return{...l,amountSpecifiedIsInput:!0,estimatedAmountIn:l.estimatedAmountIn.add(d),estimatedFeeAmount:l.estimatedFeeAmount.add(d),estimatedSwapFeeAmount:l.estimatedFeeAmount,devFeeAmount:d}}},1001:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.increaseLiquidityQuoteByInputTokenWithParams=e.increaseLiquidityQuoteByInputToken=e.increaseLiquidityQuoteByLiquidityWithParams=e.increaseLiquidityQuoteByInputTokenWithParamsUsingPriceSlippage=e.increaseLiquidityQuoteByInputTokenUsingPriceSlippage=void 0;const i=n(66259),o=r(n(13550)),s=r(n(26018)),a=n(79468),u=n(74808),c=n(93018);function d(t){(0,s.default)(u.TickUtil.checkTickInBounds(t.tickLowerIndex),"tickLowerIndex is out of bounds."),(0,s.default)(u.TickUtil.checkTickInBounds(t.tickUpperIndex),"tickUpperIndex is out of bounds."),(0,s.default)(t.inputTokenMint.equals(t.tokenMintA)||t.inputTokenMint.equals(t.tokenMintB),`input token mint ${t.inputTokenMint.toBase58()} does not match any tokens in the provided pool.`);const e=function(t){const{inputTokenMint:e,inputTokenAmount:n,tickLowerIndex:r,tickUpperIndex:o,sqrtPrice:d,tokenExtensionCtx:l}=t;if((0,s.default)(r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.twoHopSwapQuoteFromSwapQuotes=void 0,e.twoHopSwapQuoteFromSwapQuotes=function(t,e){const n=t.amountSpecifiedIsInput;let[r,i]=n?[t.amount,e.otherAmountThreshold]:[e.amount,t.otherAmountThreshold];return{amount:r,otherAmountThreshold:i,amountSpecifiedIsInput:n,aToBOne:t.aToB,aToBTwo:e.aToB,sqrtPriceLimitOne:t.sqrtPriceLimit,sqrtPriceLimitTwo:e.sqrtPriceLimit,tickArrayOne0:t.tickArray0,tickArrayOne1:t.tickArray1,tickArrayOne2:t.tickArray2,tickArrayTwo0:e.tickArray0,tickArrayTwo1:e.tickArray1,tickArrayTwo2:e.tickArray2,swapOneEstimates:{...t},swapTwoEstimates:{...e}}}},93909:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.computeSwap=void 0;const i=n(66259),o=r(n(13550)),s=n(37917),a=n(1922),u=n(74808);function c(t,e,n){const r=u.PriceMath.tickIndexToSqrtPriceX64(t);return{nextTickPrice:r,nextSqrtPriceLimit:n?o.default.max(e,r):o.default.min(e,r)}}function d(t,e,n,r,a){let u=r,c=a,d=t;if(e>0){let t=function(t,e){return t.mul(new o.default(e).div(s.PROTOCOL_FEE_RATE_MUL_VALUE))}(d,e);d=d.sub(t),u=u.add(r)}if(n.gt(i.ZERO)){const t=d.shln(64).div(n);c=c.add(t)}return{nextProtocolFee:u,nextFeeGrowthGlobalInput:c}}function l(t,e,n){return n?e.sub(t):e.add(t)}e.computeSwap=function(t,e,n,r,s,h){let f=n,p=i.ZERO,m=t.sqrtPrice,g=t.liquidity,y=t.tickCurrentIndex,b=i.ZERO;const w=t.feeRate,_=t.protocolFeeRate;let v=new o.default(0),k=h?t.feeGrowthGlobalA:t.feeGrowthGlobalB;for(;f.gt(i.ZERO)&&!r.eq(m);){let{nextIndex:t}=e.findNextInitializedTickIndex(y),{nextTickPrice:n,nextSqrtPriceLimit:i}=c(t,r,h);const o=(0,a.computeSwapStep)(f,w,g,m,i,s,h);b=b.add(o.feeAmount),s?(f=f.sub(o.amountIn),f=f.sub(o.feeAmount),p=p.add(o.amountOut)):(f=f.sub(o.amountOut),p=p.add(o.amountIn),p=p.add(o.feeAmount));let{nextProtocolFee:M,nextFeeGrowthGlobalInput:A}=d(o.feeAmount,_,g,v,k);if(v=M,k=A,o.nextPrice.eq(n)){const n=e.getTick(t);n.initialized&&(g=l(n.liquidityNet,g,h)),y=h?t-1:t}else y=u.PriceMath.sqrtPriceX64ToTickIndex(o.nextPrice);m=o.nextPrice}let{amountA:M,amountB:A}=function(t,e,n,r,i){return r===i?{amountA:t.sub(e),amountB:n}:{amountA:n,amountB:t.sub(e)}}(n,f,p,h,s);return{amountA:M,amountB:A,nextTickIndex:y,nextSqrtPrice:m,totalFeeAmount:b}}},99671:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.simulateSwap=void 0;const r=n(78845),i=n(66259),o=n(37392),s=n(37917),a=n(93909),u=n(6113),c=n(93018);e.simulateSwap=function(t){const{aToB:e,whirlpoolData:n,tickArrays:d,tokenAmount:l,sqrtPriceLimit:h,otherAmountThreshold:f,amountSpecifiedIsInput:p,tokenExtensionCtx:m}=t;if(h.gt(new r.BN(s.MAX_SQRT_PRICE))||h.lt(new r.BN(s.MIN_SQRT_PRICE)))throw new o.WhirlpoolsError("Provided SqrtPriceLimit is out of bounds.",o.SwapErrorCode.SqrtPriceOutOfBounds);if(e&&h.gt(n.sqrtPrice)||!e&&h.lt(n.sqrtPrice))throw new o.WhirlpoolsError("Provided SqrtPriceLimit is in the opposite direction of the trade.",o.SwapErrorCode.InvalidSqrtPriceLimitDirection);if(l.eq(i.ZERO))throw new o.WhirlpoolsError("Provided tokenAmount is zero.",o.SwapErrorCode.ZeroTradableAmount);const g=new u.TickArraySequence(d,n.tickSpacing,e);if(!g.isValidTickArray0(n.tickCurrentIndex))throw new o.WhirlpoolsError("TickArray at index 0 does not contain the Whirlpool current tick index.",o.SwapErrorCode.TickArraySequenceInvalid);if(p){const t=c.TokenExtensionUtil.calculateTransferFeeExcludedAmount(l,e?m.tokenMintWithProgramA:m.tokenMintWithProgramB,m.currentEpoch);if(t.amount.eq(i.ZERO))throw new o.WhirlpoolsError("Provided tokenAmount is virtually zero due to transfer fee.",o.SwapErrorCode.ZeroTradableAmount);const r=(0,a.computeSwap)(n,g,t.amount,h,p,e),u=c.TokenExtensionUtil.calculateTransferFeeExcludedAmount(e?r.amountB:r.amountA,e?m.tokenMintWithProgramB:m.tokenMintWithProgramA,m.currentEpoch);if(u.amount.lt(f))throw new o.WhirlpoolsError("Quoted amount for the other token is below the otherAmountThreshold.",o.SwapErrorCode.AmountOutBelowMinimum);const d=(e?r.amountA:r.amountB).eq(t.amount)?{isFeeIncludedAmount:!0,amount:l,fee:t.fee}:c.TokenExtensionUtil.calculateTransferFeeIncludedAmount(e?r.amountA:r.amountB,e?m.tokenMintWithProgramA:m.tokenMintWithProgramB,m.currentEpoch),y=g.getNumOfTouchedArrays();if(y>s.MAX_SWAP_TICK_ARRAYS)throw new o.WhirlpoolsError(`Input amount causes the quote to traverse more than the allowable amount of tick-arrays ${y}`,o.SwapErrorCode.TickArrayCrossingAboveMax);const b=g.getTouchedArrays(s.MAX_SWAP_TICK_ARRAYS);return{estimatedAmountIn:d.amount,estimatedAmountOut:u.amount,estimatedEndTickIndex:r.nextTickIndex,estimatedEndSqrtPrice:r.nextSqrtPrice,estimatedFeeAmount:r.totalFeeAmount,transferFee:{deductingFromEstimatedAmountIn:d.fee,deductedFromEstimatedAmountOut:u.fee},amount:l,amountSpecifiedIsInput:p,aToB:e,otherAmountThreshold:f,sqrtPriceLimit:h,tickArray0:b[0],tickArray1:b[1],tickArray2:b[2]}}const y=c.TokenExtensionUtil.calculateTransferFeeIncludedAmount(l,e?m.tokenMintWithProgramB:m.tokenMintWithProgramA,m.currentEpoch),b=(0,a.computeSwap)(n,g,y.amount,h,p,e),w=c.TokenExtensionUtil.calculateTransferFeeIncludedAmount(e?b.amountA:b.amountB,e?m.tokenMintWithProgramA:m.tokenMintWithProgramB,m.currentEpoch);if(w.amount.gt(f))throw new o.WhirlpoolsError("Quoted amount for the other token is above the otherAmountThreshold.",o.SwapErrorCode.AmountInAboveMaximum);const _=c.TokenExtensionUtil.calculateTransferFeeExcludedAmount(e?b.amountB:b.amountA,e?m.tokenMintWithProgramB:m.tokenMintWithProgramA,m.currentEpoch),v=g.getNumOfTouchedArrays();if(v>s.MAX_SWAP_TICK_ARRAYS)throw new o.WhirlpoolsError(`Input amount causes the quote to traverse more than the allowable amount of tick-arrays ${v}`,o.SwapErrorCode.TickArrayCrossingAboveMax);const k=g.getTouchedArrays(s.MAX_SWAP_TICK_ARRAYS);return{estimatedAmountIn:w.amount,estimatedAmountOut:_.amount,estimatedEndTickIndex:b.nextTickIndex,estimatedEndSqrtPrice:b.nextSqrtPrice,estimatedFeeAmount:b.totalFeeAmount,transferFee:{deductingFromEstimatedAmountIn:w.fee,deductedFromEstimatedAmountOut:_.fee},amount:l,amountSpecifiedIsInput:p,aToB:e,otherAmountThreshold:f,sqrtPriceLimit:h,tickArray0:k[0],tickArray1:k[1],tickArray2:k[2]}}},37581:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TickArrayIndex=void 0;const r=n(37917);class i{static fromTickIndex(t,e){const n=Math.floor(Math.floor(t/e)/r.TICK_ARRAY_SIZE);let o=Math.floor(t%(e*r.TICK_ARRAY_SIZE)/e);return o<0&&(o=r.TICK_ARRAY_SIZE+o),new i(n,o,e)}constructor(t,e,n){if(this.arrayIndex=t,this.offsetIndex=e,this.tickSpacing=n,e>=r.TICK_ARRAY_SIZE)throw new Error("Invalid offsetIndex - value has to be smaller than TICK_ARRAY_SIZE");if(e<0)throw new Error("Invalid offsetIndex - value is smaller than 0");if(n<0)throw new Error("Invalid tickSpacing - value is less than 0")}toTickIndex(){return this.arrayIndex*r.TICK_ARRAY_SIZE*this.tickSpacing+this.offsetIndex*this.tickSpacing}toNextInitializableTickIndex(){return i.fromTickIndex(this.toTickIndex()+this.tickSpacing,this.tickSpacing)}toPrevInitializableTickIndex(){return i.fromTickIndex(this.toTickIndex()-this.tickSpacing,this.tickSpacing)}}e.TickArrayIndex=i},6113:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TickArraySequence=void 0;const r=n(37392),i=n(37917),o=n(37581);e.TickArraySequence=class{constructor(t,e,n){if(this.tickSpacing=e,this.aToB=n,!t[0]||!t[0].data)throw new Error("TickArray index 0 must be initialized");this.sequence=[];for(const e of t){if(!e||!e.data)break;this.sequence.push({address:e.address,data:e.data})}this.touchedArrays=[...Array(this.sequence.length).fill(!1)],this.startArrayIndex=o.TickArrayIndex.fromTickIndex(this.sequence[0].data.startTickIndex,this.tickSpacing).arrayIndex}isValidTickArray0(t){const e=this.aToB?0:this.tickSpacing,n=this.sequence[0].data;return this.checkIfIndexIsInTickArrayRange(n.startTickIndex,t+e)}getNumOfTouchedArrays(){return this.touchedArrays.filter((t=>!!t)).length}getTouchedArrays(t){let e=this.touchedArrays.reduce(((t,e,n)=>(e&&t.push(this.sequence[n].address),t)),[]);if(0===e.length)return[];const n=t-e.length;return n>0&&(e=e.concat(Array(n).fill(e[e.length-1]))),e}getTick(t){const e=o.TickArrayIndex.fromTickIndex(t,this.tickSpacing);if(!this.isArrayIndexInBounds(e,this.aToB))throw new Error("Provided tick index is out of bounds for this sequence.");const n=this.getLocalArrayIndex(e.arrayIndex,this.aToB),i=this.sequence[n].data;if(this.touchedArrays[n]=!0,!i)throw new r.WhirlpoolsError(`TickArray at index ${n} is not initialized.`,r.SwapErrorCode.TickArrayIndexNotInitialized);if(!this.checkIfIndexIsInTickArrayRange(i.startTickIndex,t))throw new r.WhirlpoolsError(`TickArray at index ${n} is unexpected for this sequence.`,r.SwapErrorCode.TickArraySequenceInvalid);return i.ticks[e.offsetIndex]}findNextInitializedTickIndex(t){const e=this.aToB?t:t+this.tickSpacing;let n=o.TickArrayIndex.fromTickIndex(e,this.tickSpacing);if(!this.isArrayIndexInBounds(n,this.aToB))throw new r.WhirlpoolsError(`Swap input value traversed too many arrays. Out of bounds at attempt to traverse tick index - ${n.toTickIndex()}.`,r.SwapErrorCode.TickArraySequenceInvalid);for(;this.isArrayIndexInBounds(n,this.aToB);){const t=this.getTick(n.toTickIndex());if(t.initialized)return{nextIndex:n.toTickIndex(),nextTickData:t};n=this.aToB?n.toPrevInitializableTickIndex():n.toNextInitializableTickIndex()}return{nextIndex:Math.max(Math.min(this.aToB?n.toTickIndex()+this.tickSpacing:n.toTickIndex()-1,i.MAX_TICK_INDEX),i.MIN_TICK_INDEX),nextTickData:null}}getLocalArrayIndex(t,e){return e?this.startArrayIndex-t:t-this.startArrayIndex}isArrayIndexInBounds(t,e){const n=this.getLocalArrayIndex(t.arrayIndex,e),r=this.sequence.length;return n>=0&&n=t&&et.whirlpool)),r),c=i.AddressUtil.toPubKey(e),d=t.map((t=>{const{whirlpool:e,tokenAmount:n,tradeTokenMint:r,amountSpecifiedIsInput:a}=t,c=u.get(i.AddressUtil.toString(e)),d=i.AddressUtil.toPubKey(r),l=s.PoolUtil.getTokenType(c,d);return(0,o.default)(!!l,"swapTokenMint does not match any tokens on this pool"),{whirlpoolData:c,tokenAmount:n,aToB:s.SwapUtils.getSwapDirection(c,d,a)===s.SwapDirection.AtoB,tickCurrentIndex:c.tickCurrentIndex,tickSpacing:c.tickSpacing,whirlpoolAddress:i.AddressUtil.toPubKey(e),amountSpecifiedIsInput:a}})),l=await s.SwapUtils.getBatchTickArrays(c,n,d,r);return d.map(((t,e)=>{const{whirlpoolData:n,tokenAmount:r,aToB:i,amountSpecifiedIsInput:o}=t;return{whirlpoolData:n,tokenAmount:r,aToB:i,amountSpecifiedIsInput:o,sqrtPriceLimit:s.SwapUtils.getDefaultSqrtPriceLimit(i),otherAmountThreshold:s.SwapUtils.getDefaultOtherAmountThreshold(o),tickArrays:l[e],tokenExtensionCtx:a.NO_TOKEN_EXTENSION_CONTEXT}}))}},50303:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getBestRoutesFromQuoteMap=void 0;const i=r(n(13550)),o=n(39634);function s(t){const e=t[100];return e?e.filter((t=>1==t.calculatedEdgeQuotes.length)).map((t=>{const e=t.calculatedEdgeQuotes[0];return{quotes:[t],splitPercent:100,totalIn:e.amountIn,totalOut:e.amountOut}})).flatMap((t=>t||[])):[]}function a(t,e,n,r){let s=function(t,e){let n=[];return u(t,e,{quotes:[],splitPercent:0,totalIn:new i.default(0),totalOut:new i.default(0)},n),n}(t,r);const a=c(e);return s.length<=n?s.sort(a):((0,o.kSmallestPartition)(s,n,0,s.length-1,a),s.slice(0,n).sort(a))}function u(t,e,n,r){const{splitPercent:i,quotes:o}=n,s=Object.keys(t).map((t=>Number(t)));for(let a=s.length-1;a>=0;a--){const c=s[a],d=i+c,l=o.length>0&&c>o[o.length-1].splitPercent;if(d>100||l)continue;const h=t[c];for(let i=0;io.some((e=>e.edgesPoolAddrs.some((e=>-1!==e.indexOf(t))))))))continue;const a={quotes:[...o,s],splitPercent:d,totalIn:n.totalIn.add(s.amountIn),totalOut:n.totalOut.add(s.amountOut)},l=h.slice(i+1);100===d?r.push(a):o.length+1!=e&&u({...t,[c]:l},e,a,r)}}}function c(t){return t?d:l}function d(t,e){return e.totalOut.cmp(t.totalOut)}function l(t,e){return t.totalIn.cmp(e.totalIn)}e.getBestRoutesFromQuoteMap=function(t,e,n){const{numTopRoutes:r,maxSplits:i}=n;return[...a(t,e,r,i),...s(t)].sort(c(e)).map((t=>{const{quotes:e,totalIn:n,totalOut:r}=t;return{subRoutes:e.map((t=>function(t){const{calculatedEdgeQuotes:e,path:n,splitPercent:r,amountIn:i,amountOut:o}=t;return{path:n,splitPercent:r,amountIn:i,amountOut:o,hopQuotes:e}}(t))),totalAmountIn:n,totalAmountOut:r}}))}},94138:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(71736),e),i(n(31126),e)},71736:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolRouterBuilder=void 0;const r=n(74808),i=n(68614);e.WhirlpoolRouterBuilder=class{static buildWithPoolGraph(t,e){return new i.WhirlpoolRouterImpl(t,e)}static async buildWithPools(t,e){const n=await r.PoolGraphBuilder.buildPoolGraphWithFetch(e,t.fetcher);return new i.WhirlpoolRouterImpl(t,n)}}},31126:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RouterUtils=void 0;const i=n(66259),o=r(n(13550)),s=r(n(93776)),a=n(37542),u=n(41786),c=n(17759),d=n(74808),l=n(88459);class h{static async selectFirstExecutableRoute(t,e,n){const{wallet:r}=t;if(0===e.length)return null;if(!(0,l.isWalletConnected)(r))return[e[0],void 0];"legacy"!==n.maxSupportedTransactionVersion&&t.lookupTableFetcher&&await async function(t,e){const n=new Set;for(let t=0;tn.add(t.toBase58())))}const r=Array.from(n),o=[];for(let t=0;t{const n=i.AddressUtil.toPubKeys(e);t.loadLookupTables(n)})))}(t.lookupTableFetcher,e);for(let o=0;op)continue;const r=await t.lookupTableFetcher.getLookupTableAccountsForAddresses(e);try{if(d=c.txnSize({latestBlockhash:i.MEASUREMENT_BLOCKHASH,maxSupportedTransactionVersion:n.maxSupportedTransactionVersion,lookupTableAccounts:r}),void 0!==d&&d<=n.maxTransactionSize)return[s,r]}catch(t){}}}return null}static getPriceImpactForRoute(t,e){const{amountSpecifiedIsInput:n}=t,r=e.subRoutes.reduce(((t,e)=>{const r=(n?e.hopQuotes:e.hopQuotes.slice().reverse()).reduce(((t,e,r)=>{const{snapshot:i}=e,{aToB:o,sqrtPrice:s,feeRate:a}=i,u=o?s:d.PriceMath.invertSqrtPriceX64(s);let l;const h=u.mul(u).div(c.U64);if(n){const n=(0===r?e.amountIn:t[r-1]).mul(a.denominator.sub(a.numerator)).div(a.denominator);l=h.mul(n).div(c.U64)}else l=(0===r?e.amountOut:t[r-1]).mul(c.U64).div(h).mul(a.denominator).div(a.denominator.sub(a.numerator));return t.push(l),t}),new Array);return t.add(r[r.length-1])}),new o.default(0)),i=new s.default(r.toString()),a=new s.default(n?e.totalAmountOut.toString():e.totalAmountIn.toString());return(n?i.sub(a).div(i):a.sub(i).div(a)).mul(100)}static getTouchedTickArraysFromRoute(t){const e=new Set;for(const n of t.subRoutes)for(const t of n.hopQuotes)e.add(t.quote.tickArray0.toBase58()),e.add(t.quote.tickArray1.toBase58()),e.add(t.quote.tickArray2.toBase58());return i.AddressUtil.toPubKeys(Array.from(e))}static getDefaultRouteOptions(){return{percentIncrement:20,numTopRoutes:50,numTopPartialQuotes:10,maxSplits:3}}static getDefaultSelectOptions(){return{maxSupportedTransactionVersion:0,maxTransactionSize:i.TX_SIZE_LIMIT}}}e.RouterUtils=h;const f=100,p=50},88359:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getQuoteMap=void 0;const i=n(66259),o=r(n(13550)),s=n(41786),a=n(27122),u=n(74808),c=n(87151);function d(t,e,n){for(const{splitPercent:r,pathIndex:o,quoteIndex:s,edgeIndex:c,request:d}of t){const t=e[s],l=n[r][o];try{const e=(0,a.swapQuoteWithParams)(t,i.Percentage.fromFraction(0,1e3)),{whirlpoolData:n,tokenAmount:r,aToB:o,amountSpecifiedIsInput:s}=t,[h,f,p,m]=[n.tokenMintA.toBase58(),n.tokenMintB.toBase58(),n.tokenVaultA.toBase58(),n.tokenVaultB.toBase58()],[g,y]=o?[h,f]:[f,h];l.calculatedEdgeQuotes[c]={success:!0,amountIn:s?r:e.estimatedAmountIn,amountOut:s?e.estimatedAmountOut:r,whirlpool:d.whirlpool,inputMint:g,outputMint:y,mintA:h,mintB:f,vaultA:p,vaultB:m,quote:e,snapshot:{aToB:t.aToB,sqrtPrice:n.sqrtPrice,feeRate:u.PoolUtil.getFeeRate(n.feeRate)}}}catch(t){const e=t.errorCode;l.calculatedEdgeQuotes[c]={success:!1,error:e};continue}}}function l(t,e,n,r,o,s,a,u){const c=[];for(let d=0;dd.length-1)continue;const f=a?0===s:s===d.length-1,p=i.AddressUtil.toStrings(d.map((t=>t.poolAddress)));f&&(u[l][r]={path:o,splitPercent:l,edgesPoolAddrs:p,calculatedEdgeQuotes:Array(d.length)});const m=u[l][r],g=p[s],y=a?m.calculatedEdgeQuotes[s-1]:m.calculatedEdgeQuotes[s+1];let b,w;if(f)b=h,w=a?t:e;else{if(!y?.success)continue;b=a?y.amountOut:y.amountIn,w=a?y.outputMint:y.inputMint}c.push({splitPercent:l,pathIndex:r,edgeIndex:s,quoteIndex:c.length,request:{whirlpool:g,tradeTokenMint:w,tokenAmount:b,amountSpecifiedIsInput:a}})}}return c}e.getQuoteMap=async function(t,e,n,r,a,u){const{percentIncrement:h,numTopPartialQuotes:f}=u,{tokenIn:p,tokenOut:m,tradeAmount:g}=t,{percents:y,amounts:b}=function(t,e=5){const n=[],r=[];for(let i=1;i<=100/e;i++)n.push(i*e),r.push(t.mul(new o.default(i*e)).div(new o.default(100)));return{percents:n,amounts:r}}(g,h),w=Math.max(...e.map((t=>t.edges.length)),0),_={};let v=Array.from(Array(w).keys());n||(v=v.reverse());try{for(const t of v){const o=l(p,m,e,y,b,t,n,_),u=await(0,c.batchBuildSwapQuoteParams)(o.map((t=>t.request)),i.AddressUtil.toPubKey(r),a,s.PREFER_CACHE);d(o,u,_)}}catch(t){throw t}return function(t,e,n){const r=Object.keys(t).map((t=>Number(t))),i={},o=new Set;for(let e=0;et&&t.success?t:[]));if(s.length===t.length){const[e,o]=[s[0].amountIn,s[s.length-1].amountOut];i[n].push({path:r,splitPercent:n,edgesPoolAddrs:t,amountIn:e,amountOut:o,calculatedEdgeQuotes:s});continue}const a=e.flatMap((t=>t&&!t?.success?t:[]));o.add(a[0].error)}}const s={},a=n?(t,e)=>e.amountOut.cmp(t.amountOut):(t,e)=>t.amountIn.cmp(e.amountIn);for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WhirlpoolRouterImpl=void 0;const r=n(66259),i=n(37392),o=n(37542),s=n(41786),a=n(74808),u=n(50303),c=n(94138),d=n(88359);e.WhirlpoolRouterImpl=class{constructor(t,e){this.ctx=t,this.poolGraph=e}async findAllRoutes(t,e,n){const{tokenIn:o,tokenOut:l,tradeAmount:h,amountSpecifiedIsInput:f}=t,p=this.poolGraph.getPath(o,l);if(0===p.length)return Promise.reject(new i.WhirlpoolsError(`Could not find route for ${o} -> ${l}`,i.RouteQueryErrorCode.RouteDoesNotExist));if(h.isZero())return Promise.reject(new i.WhirlpoolsError("findBestRoutes error - input amount is zero.",i.RouteQueryErrorCode.ZeroInputAmount));const m={...c.RouterUtils.getDefaultRouteOptions(),...e},{program:g,fetcher:y}=this.ctx,b=g.programId;await async function(t,e,n,i=s.PREFER_CACHE){const o=new Set;for(let e=0;et.toBase58())),o=Array.from(new Set(i));d.push(...o)}await n.getTickArrays(d,i)}(p,b,y,n);try{const[e,n]=await(0,d.getQuoteMap)(t,p,f,b,y,m),r=(0,u.getBestRoutesFromQuoteMap)(e,f,m);return 0===r.length&&n.has(i.SwapErrorCode.TickArraySequenceInvalid)?Promise.reject(new i.WhirlpoolsError("All swap quote generation failed on amount too high.",i.RouteQueryErrorCode.TradeAmountTooHigh)):r}catch(t){return Promise.reject(new i.WhirlpoolsError("Stack error received on quote generation.",i.RouteQueryErrorCode.General,t.stack))}}async findBestRoute(t,e,n,r){const i=await this.findAllRoutes(t,e,r),o={...c.RouterUtils.getDefaultSelectOptions(),...n};return await c.RouterUtils.selectFirstExecutableRoute(this.ctx,i,o)}async swap(t,e,n){return await(0,o.getSwapFromRoute)(this.ctx,{route:t,slippage:e,resolvedAtaAccounts:n,wallet:this.ctx.wallet.publicKey},s.IGNORE_CACHE)}}},26168:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WHIRLPOOL_ACCOUNT_SIZE=e.getAccountSize=e.WHIRLPOOL_CODER=e.WHIRLPOOL_IDL=e.AccountName=void 0;const i=n(78845),o=r(n(92220));var s;function a(t){return e.WHIRLPOOL_CODER.size(e.WHIRLPOOL_IDL.accounts.find((e=>e.name===t)))+u[t]}!function(t){t.WhirlpoolsConfig="WhirlpoolsConfig",t.Position="Position",t.TickArray="TickArray",t.Whirlpool="Whirlpool",t.FeeTier="FeeTier",t.PositionBundle="PositionBundle",t.WhirlpoolsConfigExtension="WhirlpoolsConfigExtension",t.TokenBadge="TokenBadge"}(s||(e.AccountName=s={})),e.WHIRLPOOL_IDL=o.default,e.WHIRLPOOL_CODER=new i.BorshAccountsCoder(e.WHIRLPOOL_IDL),e.getAccountSize=a;const u={[s.WhirlpoolsConfig]:2,[s.Position]:0,[s.TickArray]:0,[s.Whirlpool]:0,[s.FeeTier]:0,[s.PositionBundle]:64,[s.WhirlpoolsConfigExtension]:512,[s.TokenBadge]:128};e.WHIRLPOOL_ACCOUNT_SIZE=a(s.Whirlpool)},6273:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},38515:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WHIRLPOOL_NFT_UPDATE_AUTH=e.FEE_RATE_MUL_VALUE=e.PROTOCOL_FEE_RATE_MUL_VALUE=e.MAX_SWAP_TICK_ARRAYS=e.MEMO_PROGRAM_ADDRESS=e.METADATA_PROGRAM_ADDRESS=e.POSITION_BUNDLE_SIZE=e.TICK_ARRAY_SIZE=e.MAX_SQRT_PRICE_BN=e.MIN_SQRT_PRICE_BN=e.MIN_SQRT_PRICE=e.MAX_SQRT_PRICE=e.MIN_TICK_INDEX=e.MAX_TICK_INDEX=e.NUM_REWARDS=e.ORCA_SUPPORTED_TICK_SPACINGS=e.ORCA_WHIRLPOOLS_CONFIG_EXTENSION=e.ORCA_WHIRLPOOLS_CONFIG=e.ORCA_WHIRLPOOL_PROGRAM_ID=void 0;const r=n(78845),i=n(18245);e.ORCA_WHIRLPOOL_PROGRAM_ID=new i.PublicKey("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"),e.ORCA_WHIRLPOOLS_CONFIG=new i.PublicKey("2LecshUwdy9xi7meFgHtFJQNSKk4KdTrcpvaB56dP2NQ"),e.ORCA_WHIRLPOOLS_CONFIG_EXTENSION=new i.PublicKey("777H5H3Tp9U11uRVRzFwM8BinfiakbaLT8vQpeuhvEiH"),e.ORCA_SUPPORTED_TICK_SPACINGS=[1,2,4,8,16,64,128,256],e.NUM_REWARDS=3,e.MAX_TICK_INDEX=443636,e.MIN_TICK_INDEX=-443636,e.MAX_SQRT_PRICE="79226673515401279992447579055",e.MIN_SQRT_PRICE="4295048016",e.MIN_SQRT_PRICE_BN=new r.BN(e.MIN_SQRT_PRICE),e.MAX_SQRT_PRICE_BN=new r.BN(e.MAX_SQRT_PRICE),e.TICK_ARRAY_SIZE=88,e.POSITION_BUNDLE_SIZE=256,e.METADATA_PROGRAM_ADDRESS=new i.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),e.MEMO_PROGRAM_ADDRESS=new i.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),e.MAX_SWAP_TICK_ARRAYS=3,e.PROTOCOL_FEE_RATE_MUL_VALUE=new r.BN(1e4),e.FEE_RATE_MUL_VALUE=new r.BN(1e6),e.WHIRLPOOL_NFT_UPDATE_AUTH=new i.PublicKey("3axbTs2z5GBy6usVbNVoqEgZMng3vZvMnAoX29BFfwhr")},37917:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(26168),e),i(n(6273),e),i(n(38515),e),i(n(15438),e)},15438:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},48231:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTickArrayDataForPosition=void 0;const r=n(74808);e.getTickArrayDataForPosition=async function(t,e,n,i){const o=r.PDAUtil.getTickArrayFromTickIndex(e.tickLowerIndex,n.tickSpacing,e.whirlpool,t.program.programId).publicKey,s=r.PDAUtil.getTickArrayFromTickIndex(e.tickUpperIndex,n.tickSpacing,e.whirlpool,t.program.programId).publicKey;return await t.fetcher.getTickArrays([o,s],i)}},47178:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TOKEN_MINTS=void 0,e.TOKEN_MINTS={USDC:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",SOL:"So11111111111111111111111111111111111111112",USDT:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",USDH:"USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX",mSOL:"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",stSOL:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"}},45342:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AdjacencyListPoolGraph=void 0;const r=n(66259),i=n(6897);function o(t,e){return(e?t.slice().reverse():t).map((t=>({poolAddress:t})))}function s(t,e,n){const r={};return t.forEach((([t,i])=>{let o=[];const[s,u]=[t,i].sort(),c=a(s,u,!1),d=e[s]||[],l=e[u]||[];if(r[c])return;const h=d.filter((({address:t})=>l.some((e=>e.address===t)))).map((t=>[t.address]));o.push(...h),d.filter((({address:t})=>!l.some((e=>e.address===t)))).forEach((t=>{const e=t.otherToken;if(!n||n.indexOf(e)>-1){const n=l.filter((t=>t.otherToken===e)).map((e=>[t.address,e.address]));o.push(...n)}})),o.length>0&&(r[c]=o)})),r}function a(t,e,n=!0){const o=[r.AddressUtil.toString(t),r.AddressUtil.toString(e)],s=n?o.sort():o;return`${s[0]}${i.PoolGraphUtils.PATH_ID_DELIMITER}${s[1]}`}e.AdjacencyListPoolGraph=class{constructor(t){const[e,n]=function(t){const e={},n=new Set;return[t.reduce(((t,i)=>{const{address:o,tokenMintA:s,tokenMintB:a}=i,[u,c,d]=r.AddressUtil.toStrings([o,s,a]);n.add(c),n.add(d),void 0===t[c]&&(t[c]=[],e[c]=new Set),void 0===t[d]&&(t[d]=[],e[d]=new Set);const[l,h]=[e[c],e[d]];return l.has(u)||(t[c].push({address:u,otherToken:d}),l.add(u)),h.has(u)||(t[d].push({address:u,otherToken:c}),h.add(u)),t}),{}),n]}(t);this.graph=e,this.tokens=Array.from(n)}getPath(t,e,n){return this.getPathsForPairs([[t,e]],n)[0][1]}getPathsForPairs(t,e){const n=t.map((([t,e])=>[r.AddressUtil.toString(t),r.AddressUtil.toString(e)])),u=s(n.filter((([t,e])=>t!==e)),this.graph,e?.intermediateTokens.map((t=>r.AddressUtil.toString(t))));return n.map((([t,e])=>{const n=i.PoolGraphUtils.getSearchPathId(t,e),[r,s]=[t,e].sort(),c=a(r,s,!1),d=r!==t,l=u[c];return[n,l?l.map((n=>({startTokenMint:t,endTokenMint:e,edges:o(n,d)}))):[]]}))}getAllPaths(t){const e=function(t){const e=[];for(let n=0;n[t,e])),n=s(e.filter((([t,e])=>t!==e)),this.graph,t?.intermediateTokens.map((t=>r.AddressUtil.toString(t))));return e.reduce(((t,[e,r])=>{const s=i.PoolGraphUtils.getSearchPathId(e,r);if(e===r)return t.push([s,[]]),t;const[u,c]=[e,r].sort(),d=a(u,c,!1),l=u!==e,h=n[d],f=h?h.map((t=>({startTokenMint:e,endTokenMint:r,edges:o(t,l)}))):[];t.push([s,f]);const p=i.PoolGraphUtils.getSearchPathId(r,e),m=h?h.map((t=>({startTokenMint:r,endTokenMint:e,edges:o(t,!l)}))):[];return t.push([p,m]),t}),[])}}},75635:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(11740),e),i(n(32315),e),i(n(6897),e)},32315:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PoolGraphBuilder=void 0;const r=n(41786),i=n(45342);e.PoolGraphBuilder=class{static async buildPoolGraphWithFetch(t,e){const n=await e.getPools(t,r.PREFER_CACHE),o=Array.from(n.entries()).map((([t,e])=>e?{address:t,tokenMintA:e.tokenMintA,tokenMintB:e.tokenMintB}:null)).flatMap((t=>t||[]));return new i.AdjacencyListPoolGraph(o)}static buildPoolGraph(t){return new i.AdjacencyListPoolGraph(t)}}},6897:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PoolGraphUtils=void 0;const r=n(66259);class i{static getSearchPathId(t,e){return`${r.AddressUtil.toString(t)}${i.PATH_ID_DELIMITER}${r.AddressUtil.toString(e)}`}static deconstructPathId(t){const e=t.split(i.PATH_ID_DELIMITER);if(2!==e.length)throw new Error(`Invalid path id: ${t}`);const[n,r]=e;return[n,r]}}e.PoolGraphUtils=i,i.PATH_ID_DELIMITER="-"},11740:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},70706:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.openPositionAccounts=void 0;const s=o(n(78845)),a=n(29955),u=n(18245);e.openPositionAccounts=function(t){const{funder:e,owner:n,positionPda:r,positionMintAddress:i,positionTokenAccount:o,whirlpool:c}=t;return{funder:e,owner:n,position:r.publicKey,positionMint:i,positionTokenAccount:o,whirlpool:c,tokenProgram:a.TOKEN_PROGRAM_ID,systemProgram:u.SystemProgram.programId,rent:s.web3.SYSVAR_RENT_PUBKEY,associatedTokenProgram:a.ASSOCIATED_TOKEN_PROGRAM_ID}}},60816:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BitMath=void 0;const r=n(78845),i=n(66259),o=n(37392);e.BitMath=class{static mul(t,e,n){const r=t.mul(e);if(this.isOverLimit(r,n))throw new o.WhirlpoolsError(`Mul result higher than u${n}`,o.MathErrorCode.MultiplicationOverflow);return r}static mulDiv(t,e,n,r){return this.mulDivRoundUpIf(t,e,n,!1,r)}static mulDivRoundUp(t,e,n,r){return this.mulDivRoundUpIf(t,e,n,!0,r)}static mulDivRoundUpIf(t,e,n,r,s){if(n.eq(i.ZERO))throw new o.WhirlpoolsError("mulDiv denominator is zero",o.MathErrorCode.DivideByZero);const a=this.mul(t,e,s),u=a.div(n);return r&&a.mod(n).gt(i.ZERO)?u.add(i.ONE):u}static checked_mul_shift_right(t,e,n){return this.checked_mul_shift_right_round_up_if(t,e,!1,n)}static checked_mul_shift_right_round_up_if(t,e,n,r){if(t.eq(i.ZERO)||e.eq(i.ZERO))return i.ZERO;const s=this.mul(t,e,r);if(this.isOverLimit(s,r))throw new o.WhirlpoolsError(`MulShiftRight overflowed u${r}.`,o.MathErrorCode.MultiplicationShiftRightOverflow);const a=i.MathUtil.fromX64_BN(s),u=n&&a.and(i.U64_MAX).gt(i.ZERO);if(u&&a.eq(i.U64_MAX))throw new o.WhirlpoolsError(`MulShiftRight overflowed u${r}.`,o.MathErrorCode.MultiplicationOverflow);return u?a.add(i.ONE):a}static isOverLimit(t,e){const n=i.TWO.pow(new r.BN(e)).sub(i.ONE);return t.gt(n)}static divRoundUp(t,e){return this.divRoundUpIf(t,e,!0)}static divRoundUpIf(t,e,n){if(e.eq(i.ZERO))throw new o.WhirlpoolsError("divRoundUpIf - divide by zero",o.MathErrorCode.DivideByZero);let r=t.div(e);return n&&t.mod(e).gt(i.ZERO)?r.add(i.ONE):r}}},17759:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.U64=void 0;const r=n(66259);e.U64=r.U64_MAX.add(r.ONE)},39634:(t,e)=>{"use strict";function n(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function r(t,e){return te?1:0}Object.defineProperty(e,"__esModule",{value:!0}),e.kSmallestPartition=void 0,e.kSmallestPartition=function t(e,i,o=0,s=e.length-1,a=r){for(;s>o;){if(s-o>600){const n=s-o+1,r=i-o+1,u=Math.log(n),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(n-c)/n)*(r-n/2<0?-1:1);t(e,i,Math.max(o,Math.floor(i-r*c/n+d)),Math.min(s,Math.floor(i+(n-r)*c/n+d)),a)}const r=e[i];let u=o,c=s;for(n(e,o,i),a(e[s],r)>0&&n(e,o,s);u0;)c--}0===a(e[o],r)?n(e,o,c):(c++,n(e,c,s)),c<=i&&(o=c+1),i<=c&&(s=c-1)}}},1922:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.computeSwapStep=void 0;const i=r(n(13550)),o=n(37917),s=n(60816),a=n(73936);function u(t,e,n,r,i){return i===r?(0,a.getAmountDeltaA)(t,e,n,r):(0,a.getAmountDeltaB)(t,e,n,r)}e.computeSwapStep=function(t,e,n,r,c,d,l){let h=u(r,c,n,d,l),f=t;d&&(f=s.BitMath.mulDiv(t,o.FEE_RATE_MUL_VALUE.sub(new i.default(e)),o.FEE_RATE_MUL_VALUE,128));let p=f.gte(h)?c:(0,a.getNextSqrtPrice)(r,n,f,d,l),m=p.eq(c),g=function(t,e,n,r,i){return i===r?(0,a.getAmountDeltaB)(t,e,n,!r):(0,a.getAmountDeltaA)(t,e,n,!r)}(r,p,n,d,l);m||(h=u(r,p,n,d,l));let y,b=d?h:g,w=d?g:h;if(!d&&w.gt(t)&&(w=t),d&&!m)y=t.sub(b);else{const t=new i.default(e);y=s.BitMath.mulDivRoundUp(b,t,o.FEE_RATE_MUL_VALUE.sub(t),128)}return{amountIn:b,amountOut:w,nextPrice:p,feeAmount:y}}},73936:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.adjustForSlippage=e.getNextSqrtPrice=e.getAmountDeltaB=e.getAmountDeltaA=void 0;const i=n(66259),o=r(n(13550)),s=n(37392),a=n(37917),u=n(60816);function c(t,e){return t.gt(e)?[e,t]:[t,e]}e.getAmountDeltaA=function(t,e,n,r){let[a,u]=c(t,e),d=u.sub(a),l=n.mul(d).shln(64),h=a.mul(u),f=l.div(h),p=l.mod(h),m=r&&!p.eq(i.ZERO)?f.add(new o.default(1)):f;if(m.gt(i.U64_MAX))throw new s.WhirlpoolsError("Results larger than U64",s.TokenErrorCode.TokenMaxExceeded);return m},e.getAmountDeltaB=function(t,e,n,r){let[i,o]=c(t,e),s=o.sub(i);return u.BitMath.checked_mul_shift_right_round_up_if(n,s,r,128)},e.getNextSqrtPrice=function(t,e,n,r,c){return r===c?function(t,e,n,r){if(n.eq(i.ZERO))return t;let c=u.BitMath.mul(t,n,256),d=u.BitMath.mul(e,t,256).shln(64);if(u.BitMath.isOverLimit(d,256))throw new s.WhirlpoolsError("getNextSqrtPriceFromARoundUp - numerator overflow u256",s.MathErrorCode.MultiplicationOverflow);let l=e.shln(64);if(!r&&l.lte(c))throw new s.WhirlpoolsError("getNextSqrtPriceFromARoundUp - Unable to divide currLiquidityX64 by product",s.MathErrorCode.DivideByZero);let h=r?l.add(c):l.sub(c),f=u.BitMath.divRoundUp(d,h);if(f.lt(new o.default(a.MIN_SQRT_PRICE)))throw new s.WhirlpoolsError("getNextSqrtPriceFromARoundUp - price less than min sqrt price",s.TokenErrorCode.TokenMinSubceeded);if(f.gt(new o.default(a.MAX_SQRT_PRICE)))throw new s.WhirlpoolsError("getNextSqrtPriceFromARoundUp - price less than max sqrt price",s.TokenErrorCode.TokenMaxExceeded);return f}(t,e,n,r):function(t,e,n,r){let i=n.shln(64),o=u.BitMath.divRoundUpIf(i,e,!r);return t=r?t.add(o):t.sub(o)}(t,e,n,r)},e.adjustForSlippage=function(t,{numerator:e,denominator:n},r){return r?t.mul(n.add(e)).div(n):t.mul(n).div(n.add(e))}},79468:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTokenBFromLiquidity=e.getTokenAFromLiquidity=e.getNextSqrtPrice=e.getAmountUnfixedDelta=e.getAmountFixedDelta=e.getLiquidityFromTokenB=e.getLiquidityFromTokenA=e.adjustAmountForSlippage=e.adjustForSlippage=e.PositionUtil=e.PositionStatus=e.AmountSpecified=e.SwapDirection=void 0;const r=n(66259),i=n(74808),o=n(99576);var s,a,u;function c(t,e,n,i){const[o,s]=l(e,n),a=t.mul(s.sub(o)).shln(64),u=s.mul(o);return i?r.MathUtil.divRoundUp(a,u):a.div(u)}function d(t,e,n,i){const[o,s]=l(e,n),a=t.mul(s.sub(o));return i?r.MathUtil.shiftRightRoundUp(a):a.shrn(64)}function l(t,e){return t.lt(e)?[t,e]:[e,t]}!function(t){t.AtoB="Swap A to B",t.BtoA="Swap B to A"}(s||(e.SwapDirection=s={})),function(t){t.Input="Specified input amount",t.Output="Specified output amount"}(a||(e.AmountSpecified=a={})),function(t){t[t.BelowRange=0]="BelowRange",t[t.InRange=1]="InRange",t[t.AboveRange=2]="AboveRange"}(u||(e.PositionStatus=u={})),e.PositionUtil=class{constructor(){}static getPositionStatus(t,e,n){return t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.toTx=void 0;const r=n(66259);e.toTx=function(t,e){return new r.TransactionBuilder(t.provider.connection,t.provider.wallet,t.txBuilderOpts).addInstruction(e)}},9471:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.PDAUtil=void 0;const i=n(78845),o=n(66259),s=n(37917),a=n(24018),u=n(33689),c="metadata";class d{static getWhirlpool(t,e,n,s,a){return o.AddressUtil.findProgramAddress([r.from("whirlpool"),e.toBuffer(),n.toBuffer(),s.toBuffer(),new i.BN(a).toArrayLike(r,"le",2)],t)}static getPosition(t,e){return o.AddressUtil.findProgramAddress([r.from("position"),e.toBuffer()],t)}static getPositionMetadata(t){return o.AddressUtil.findProgramAddress([r.from(c),s.METADATA_PROGRAM_ADDRESS.toBuffer(),t.toBuffer()],s.METADATA_PROGRAM_ADDRESS)}static getTickArray(t,e,n){return o.AddressUtil.findProgramAddress([r.from("tick_array"),e.toBuffer(),r.from(n.toString())],t)}static getTickArrayFromTickIndex(t,e,n,r,i=0){const s=u.TickUtil.getStartTickIndex(t,e,i);return d.getTickArray(o.AddressUtil.toPubKey(r),o.AddressUtil.toPubKey(n),s)}static getTickArrayFromSqrtPrice(t,e,n,r,i=0){const o=a.PriceMath.sqrtPriceX64ToTickIndex(t);return d.getTickArrayFromTickIndex(o,e,n,r,i)}static getFeeTier(t,e,n){return o.AddressUtil.findProgramAddress([r.from("fee_tier"),e.toBuffer(),new i.BN(n).toArrayLike(r,"le",2)],t)}static getOracle(t,e){return o.AddressUtil.findProgramAddress([r.from("oracle"),e.toBuffer()],t)}static getBundledPosition(t,e,n){return o.AddressUtil.findProgramAddress([r.from("bundled_position"),e.toBuffer(),r.from(n.toString())],t)}static getPositionBundle(t,e){return o.AddressUtil.findProgramAddress([r.from("position_bundle"),e.toBuffer()],t)}static getPositionBundleMetadata(t){return o.AddressUtil.findProgramAddress([r.from(c),s.METADATA_PROGRAM_ADDRESS.toBuffer(),t.toBuffer()],s.METADATA_PROGRAM_ADDRESS)}static getConfigExtension(t,e){return o.AddressUtil.findProgramAddress([r.from("config_extension"),e.toBuffer()],t)}static getTokenBadge(t,e,n){return o.AddressUtil.findProgramAddress([r.from("token_badge"),e.toBuffer(),n.toBuffer()],t)}}e.PDAUtil=d},1128:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTokenAmount=e.PoolUtil=void 0;const o=n(66259),s=n(18245),a=i(n(13550)),u=i(n(93776)),c=n(47178),d=n(24018),l=n(11603),h=n(40273),f=i(n(26018)),p=n(29955);e.PoolUtil=class{constructor(){}static isRewardInitialized(t){return!s.PublicKey.default.equals(t.mint)&&!s.PublicKey.default.equals(t.vault)}static getTokenType(t,e){return t.tokenMintA.equals(e)?l.TokenType.TokenA:t.tokenMintB.equals(e)?l.TokenType.TokenB:void 0}static getFeeRate(t){return o.Percentage.fromFraction(t,1e6)}static getProtocolFeeRate(t){return o.Percentage.fromFraction(t,1e4)}static orderMints(t,e){return this.compareMints(t,e)<0?[t,e]:[e,t]}static compareMints(t,e){return r.compare(o.AddressUtil.toPubKey(t).toBuffer(),o.AddressUtil.toPubKey(e).toBuffer())}static getTokenAmountsFromLiquidity(t,e,n,r,i){const s=new u.default(t.toString()),c=new u.default(e.toString()),d=new u.default(n.toString()),l=new u.default(r.toString());let h,f;return e.lt(n)?(h=o.MathUtil.toX64_Decimal(s).mul(l.sub(d)).div(d.mul(l)),f=new u.default(0)):e.lt(r)?(h=o.MathUtil.toX64_Decimal(s).mul(l.sub(c)).div(c.mul(l)),f=o.MathUtil.fromX64_Decimal(s.mul(c.sub(d)))):(h=new u.default(0),f=o.MathUtil.fromX64_Decimal(s.mul(l.sub(d)))),i?{tokenA:new a.default(h.ceil().toString()),tokenB:new a.default(f.ceil().toString())}:{tokenA:new a.default(h.floor().toString()),tokenB:new a.default(f.floor().toString())}}static estimateLiquidityFromTokenAmounts(t,e,n,r){if(n=n)return _(s,o,r.tokenB);if(t=0&&t{t&&e.push(n)})),e}static getUnoccupiedBundleIndexes(t){const e=[];return s.convertBitmapToArray(t).forEach(((t,n)=>{t||e.push(n)})),e}static findUnoccupiedBundleIndex(t){const e=s.getUnoccupiedBundleIndexes(t);return 0===e.length?null:e[0]}static convertBitmapToArray(t){const e=[];return t.positionBitmap.map((t=>{for(let n=0;n<8;n++)e.push(0!=(t&1<0?new i.BN(function(t){let e;return e=0!=(1&t)?new i.BN("79232123823359799118286999567"):new i.BN("79228162514264337593543950336"),0!=(2&t)&&(e=d(e.mul(new i.BN("79236085330515764027303304731")),96,256)),0!=(4&t)&&(e=d(e.mul(new i.BN("79244008939048815603706035061")),96,256)),0!=(8&t)&&(e=d(e.mul(new i.BN("79259858533276714757314932305")),96,256)),0!=(16&t)&&(e=d(e.mul(new i.BN("79291567232598584799939703904")),96,256)),0!=(32&t)&&(e=d(e.mul(new i.BN("79355022692464371645785046466")),96,256)),0!=(64&t)&&(e=d(e.mul(new i.BN("79482085999252804386437311141")),96,256)),0!=(128&t)&&(e=d(e.mul(new i.BN("79736823300114093921829183326")),96,256)),0!=(256&t)&&(e=d(e.mul(new i.BN("80248749790819932309965073892")),96,256)),0!=(512&t)&&(e=d(e.mul(new i.BN("81282483887344747381513967011")),96,256)),0!=(1024&t)&&(e=d(e.mul(new i.BN("83390072131320151908154831281")),96,256)),0!=(2048&t)&&(e=d(e.mul(new i.BN("87770609709833776024991924138")),96,256)),0!=(4096&t)&&(e=d(e.mul(new i.BN("97234110755111693312479820773")),96,256)),0!=(8192&t)&&(e=d(e.mul(new i.BN("119332217159966728226237229890")),96,256)),0!=(16384&t)&&(e=d(e.mul(new i.BN("179736315981702064433883588727")),96,256)),0!=(32768&t)&&(e=d(e.mul(new i.BN("407748233172238350107850275304")),96,256)),0!=(65536&t)&&(e=d(e.mul(new i.BN("2098478828474011932436660412517")),96,256)),0!=(131072&t)&&(e=d(e.mul(new i.BN("55581415166113811149459800483533")),96,256)),0!=(262144&t)&&(e=d(e.mul(new i.BN("38992368544603139932233054999993551")),96,256)),d(e,32,256)}(t)):new i.BN(function(t){let e,n=Math.abs(t);return e=0!=(1&n)?new i.BN("18445821805675392311"):new i.BN("18446744073709551616"),0!=(2&n)&&(e=d(e.mul(new i.BN("18444899583751176498")),64,256)),0!=(4&n)&&(e=d(e.mul(new i.BN("18443055278223354162")),64,256)),0!=(8&n)&&(e=d(e.mul(new i.BN("18439367220385604838")),64,256)),0!=(16&n)&&(e=d(e.mul(new i.BN("18431993317065449817")),64,256)),0!=(32&n)&&(e=d(e.mul(new i.BN("18417254355718160513")),64,256)),0!=(64&n)&&(e=d(e.mul(new i.BN("18387811781193591352")),64,256)),0!=(128&n)&&(e=d(e.mul(new i.BN("18329067761203520168")),64,256)),0!=(256&n)&&(e=d(e.mul(new i.BN("18212142134806087854")),64,256)),0!=(512&n)&&(e=d(e.mul(new i.BN("17980523815641551639")),64,256)),0!=(1024&n)&&(e=d(e.mul(new i.BN("17526086738831147013")),64,256)),0!=(2048&n)&&(e=d(e.mul(new i.BN("16651378430235024244")),64,256)),0!=(4096&n)&&(e=d(e.mul(new i.BN("15030750278693429944")),64,256)),0!=(8192&n)&&(e=d(e.mul(new i.BN("12247334978882834399")),64,256)),0!=(16384&n)&&(e=d(e.mul(new i.BN("8131365268884726200")),64,256)),0!=(32768&n)&&(e=d(e.mul(new i.BN("3584323654723342297")),64,256)),0!=(65536&n)&&(e=d(e.mul(new i.BN("696457651847595233")),64,256)),0!=(131072&n)&&(e=d(e.mul(new i.BN("26294789957452057")),64,256)),0!=(262144&n)&&(e=d(e.mul(new i.BN("37481735321082")),64,256)),e}(t))}static sqrtPriceX64ToTickIndex(t){if(t.gt(new i.BN(a.MAX_SQRT_PRICE))||t.lt(new i.BN(a.MIN_SQRT_PRICE)))throw new Error("Provided sqrtPrice is not within the supported sqrtPrice range.");const e=t.bitLength()-1,n=function(t,e,n){let r=t.toTwos(128).shln(32);return r.imaskn(129),r.fromTwos(128)}(new i.BN(e-64));let r=new i.BN("8000000000000000","hex"),o=0,s=new i.BN(0),u=e>=64?t.shrn(e-63):t.shln(63-e);for(;r.gt(new i.BN(0))&&o<14;){u=u.mul(u);let t=u.shrn(127);u=u.shrn(63+t.toNumber()),s=s.add(r.mul(t)),r=r.shrn(1),o+=1}const l=s.shrn(32),h=n.add(l).mul(new i.BN("59543866431248")),f=d(h.sub(new i.BN("184467440737095516")),64,128).toNumber(),p=d(h.add(new i.BN("15793534762490258745")),64,128).toNumber();return f==p?f:c.tickIndexToSqrtPriceX64(p).lte(t)?p:f}static tickIndexToPrice(t,e,n){return c.sqrtPriceX64ToPrice(c.tickIndexToSqrtPriceX64(t),e,n)}static priceToTickIndex(t,e,n){return c.sqrtPriceX64ToTickIndex(c.priceToSqrtPriceX64(t,e,n))}static priceToInitializableTickIndex(t,e,n,r){return u.TickUtil.getInitializableTickIndex(c.priceToTickIndex(t,e,n),r)}static invertPrice(t,e,n){const r=c.priceToTickIndex(t,e,n),i=u.TickUtil.invertTick(r);return c.tickIndexToPrice(i,n,e)}static invertSqrtPriceX64(t){const e=c.sqrtPriceX64ToTickIndex(t),n=u.TickUtil.invertTick(e);return c.tickIndexToSqrtPriceX64(n)}static getSlippageBoundForSqrtPrice(t,e){const n=o.DecimalUtil.fromBN(t),r=new s.default(e.numerator.toString()),u=new s.default(e.denominator.toString()),d=n.mul(u.sub(r).sqrt()).div(u.sqrt()).toDecimalPlaces(0),l=n.mul(u.add(r).sqrt()).div(u.sqrt()).toDecimalPlaces(0),h=i.BN.min(i.BN.max(new i.BN(d.toString()),a.MIN_SQRT_PRICE_BN),a.MAX_SQRT_PRICE_BN),f=i.BN.min(i.BN.max(new i.BN(l.toString()),a.MIN_SQRT_PRICE_BN),a.MAX_SQRT_PRICE_BN);return{lowerBound:[h,c.sqrtPriceX64ToTickIndex(h)],upperBound:[f,c.sqrtPriceX64ToTickIndex(f)]}}}function d(t,e,n){let r=t.toTwos(n).shrn(e);return r.imaskn(n-e+1),r.fromTwos(n-e)}e.PriceMath=c},81444:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SwapUtils=void 0;const i=n(66259),o=r(n(13550)),s=n(37917),a=n(73936),u=n(9471),c=n(1128),d=n(33689),l=n(11603);class h{static getDefaultSqrtPriceLimit(t){return new o.default(t?s.MIN_SQRT_PRICE:s.MAX_SQRT_PRICE)}static getDefaultOtherAmountThreshold(t){return t?i.ZERO:i.U64_MAX}static getSwapDirection(t,e,n){const r=c.PoolUtil.getTokenType(t,e);if(r)return r===l.TokenType.TokenA===n?l.SwapDirection.AtoB:l.SwapDirection.BtoA}static getTickArrayPublicKeys(t,e,n,r,i){const o=n?0:e;let a=0,c=[];for(let l=0;l{const[e,n]=t,r=i.slice(e,n),o=s.slice(e,n);return r.map(((t,e)=>({address:t,data:o[e]})))}))}static calculateSwapAmountsFromQuote(t,e,n,r,i){return i?{amount:t,otherAmountThreshold:(0,a.adjustForSlippage)(n,r,!1)}:{amount:t,otherAmountThreshold:(0,a.adjustForSlippage)(e,r,!0)}}static getSwapParamsFromQuote(t,e,n,r,i,o){const s=n.getData();return this.getSwapParamsFromQuoteKeys(t,e,n.getAddress(),s.tokenVaultA,s.tokenVaultB,r,i,o)}static getSwapParamsFromQuoteKeys(t,e,n,r,o,s,a,c){const d=t.aToB,[l,h]=i.AddressUtil.toPubKeys([s,a]);return{whirlpool:n,tokenOwnerAccountA:d?l:h,tokenOwnerAccountB:d?h:l,tokenVaultA:r,tokenVaultB:o,oracle:u.PDAUtil.getOracle(e.program.programId,n).publicKey,tokenAuthority:c,...t}}}e.SwapUtils=h},33689:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TickArrayUtil=e.TickUtil=void 0;const i=n(66259),o=r(n(26018)),s=n(37917),a=n(9471);var u;!function(t){t[t.Left=0]="Left",t[t.Right=1]="Right"}(u||(u={}));class c{constructor(){}static getOffsetIndex(t,e,n){return Math.floor((t-e)/n)}static getStartTickIndex(t,e,n=0){const r=(Math.floor(t/e/s.TICK_ARRAY_SIZE)+n)*e*s.TICK_ARRAY_SIZE,i=s.TICK_ARRAY_SIZE*e,a=s.MIN_TICK_INDEX-(s.MIN_TICK_INDEX%i+i);return(0,o.default)(r>=a,`startTickIndex is too small - - ${r}`),(0,o.default)(r<=s.MAX_TICK_INDEX,`startTickIndex is too large - ${r}`),r}static getInitializableTickIndex(t,e){return t-t%e}static getNextInitializableTickIndex(t,e){return c.getInitializableTickIndex(t,e)+e}static getPrevInitializableTickIndex(t,e){return c.getInitializableTickIndex(t,e)-e}static findPreviousInitializedTickIndex(t,e,n){return c.findInitializedTick(t,e,n,u.Left)}static findNextInitializedTickIndex(t,e,n){return c.findInitializedTick(t,e,n,u.Right)}static findInitializedTick(t,e,n,r){const i=l(t.startTickIndex,e,n),o=r===u.Right?1:-1;let s=r===u.Right?i+o:i;for(;s>=0&&s=s.MIN_TICK_INDEX}static isTickInitializable(t,e){return t%e==0}static invertTick(t){return-t}static getFullRangeTickIndex(t){return[Math.ceil(s.MIN_TICK_INDEX/t)*t,Math.floor(s.MAX_TICK_INDEX/t)*t]}static isFullRange(t,e,n){const[r,i]=c.getFullRangeTickIndex(t);return e===r&&n===i}}e.TickUtil=c;class d{static getTickFromArray(t,e,n){const r=l(t.startTickIndex,e,n),i=t.ticks[r];return(0,o.default)(!!i,`tick realIndex out of range - start - ${t.startTickIndex} index - ${e}, realIndex - ${r}`),i}static getTickArrayPDAs(t,e,n,r,i,o){let s=[...Array(n).keys()];return o&&(s=s.map((t=>-t))),s.map((n=>{const o=c.getStartTickIndex(t,e,n);return a.PDAUtil.getTickArray(r,i,o)}))}static async getUninitializedArraysString(t,e,n){const r=i.AddressUtil.toPubKeys(t),o=await e.getTickArrays(r,n);if(o){const t=d.getUninitializedArrays(o);if(t.length>0)return t.map((t=>r[t].toBase58())).join(", ")}return null}static async getUninitializedArraysPDAs(t,e,n,r,i,o){const s=t.map((t=>c.getStartTickIndex(t,r))),u=[...new Set(s)],l=u.map((t=>a.PDAUtil.getTickArray(e,n,t))),h=await i.getTickArrays(l.map((t=>t.publicKey)),o);return d.getUninitializedArrays(h).map((t=>({startIndex:u[t],pda:l[t]})))}static getUninitializedArrays(t){return t.map(((t,e)=>t?-1:e)).filter((t=>t>=0))}}function l(t,e,n){return Math.floor((e-t)/n)}function h(t,e,n){return t+e*n}e.TickArrayUtil=d},93018:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TokenExtensionUtil=e.NO_TOKEN_EXTENSION_CONTEXT=void 0;const o=n(29955),s=i(n(13550)),a=n(66259),u=n(40273),c=n(18245),d=n(6378),l={address:c.PublicKey.default,decimals:0,freezeAuthority:null,mintAuthority:null,isInitialized:!0,supply:0n,tlvData:r.from([]),tokenProgram:d.TOKEN_PROGRAM_ID};e.NO_TOKEN_EXTENSION_CONTEXT={currentEpoch:0,tokenMintWithProgramA:l,tokenMintWithProgramB:l,rewardTokenMintsWithProgram:[l,l,l]},e.TokenExtensionUtil=class{static calculateTransferFeeIncludedAmount(t,e,n){const r=(0,o.getTransferFeeConfig)(e);return null===r?{isFeeIncludedAmount:!0,amount:t,fee:a.ZERO}:function(t,e){const n=1e4,r=new s.default(t.maximumFee.toString());if(0===t.transferFeeBasisPoints)return{isFeeIncludedAmount:!0,amount:e,fee:a.ZERO};if(e.isZero())return{isFeeIncludedAmount:!0,amount:e,fee:a.ZERO};if(t.transferFeeBasisPoints===n){if(e.add(r).gt(a.U64_MAX))throw new Error("The total amount and fees overflow");return{isFeeIncludedAmount:!0,amount:e.add(r),fee:r}}const i=function(t,e){return t.add(e.subn(1)).div(e)}(e.muln(n),new s.default(n-t.transferFeeBasisPoints)),o=i.sub(e).gte(r)?{amount:e.add(r),fee:r}:{amount:i,fee:i.sub(e)};if(o.amount.gt(a.U64_MAX))throw new Error("The total amount and fees overflow");return{...o,isFeeIncludedAmount:!0}}((0,o.getEpochFee)(r,BigInt(n)),t)}static calculateTransferFeeExcludedAmount(t,e,n){const r=(0,o.getTransferFeeConfig)(e);return null===r?{isFeeIncludedAmount:!1,amount:t,fee:a.ZERO}:function(t,e){const n=(0,o.calculateFee)(t,BigInt(e.toString())),r=new s.default(n.toString());return{isFeeIncludedAmount:!1,amount:e.sub(r),fee:r}}((0,o.getEpochFee)(r,BigInt(n)),t)}static async buildTokenExtensionContext(t,e,n){const r=e.tokenMintA,i=e.tokenMintB,o=e.rewardInfos,[s,a]=await Promise.all([t.getMintInfos([r,i,...o.filter((t=>u.PoolUtil.isRewardInitialized(t))).map((t=>t.mint))],n),t.getEpoch()]),c=t=>s.get(t.toBase58());return{tokenMintWithProgramA:c(e.tokenMintA),tokenMintWithProgramB:c(e.tokenMintB),rewardTokenMintsWithProgram:[u.PoolUtil.isRewardInitialized(o[0])?c(o[0].mint):null,u.PoolUtil.isRewardInitialized(o[1])?c(o[1].mint):null,u.PoolUtil.isRewardInitialized(o[2])?c(o[2].mint):null],currentEpoch:a}}static async getExtraAccountMetasForTransferHook(t,e,n,r,i){const s=(0,o.getTransferHook)(e);if(!s)return;const a=new c.TransactionInstruction({programId:o.TOKEN_2022_PROGRAM_ID,keys:[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:e.address,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1}]});await(0,o.addExtraAccountMetasForExecute)(t,a,s.programId,n,e.address,r,i,0n,"confirmed");const u=a.keys.slice(5);return u.length>0?u:void 0}static isV2IxRequiredPool(t){return!!t.tokenMintWithProgramA.tokenProgram.equals(o.TOKEN_2022_PROGRAM_ID)||!!t.tokenMintWithProgramB.tokenProgram.equals(o.TOKEN_2022_PROGRAM_ID)}static isV2IxRequiredReward(t,e){return t.rewardTokenMintsWithProgram[e]?.tokenProgram.equals(o.TOKEN_2022_PROGRAM_ID)??!1}}},11603:(t,e)=>{"use strict";var n,r;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=e.SwapDirection=void 0,function(t){t.AtoB="aToB",t.BtoA="bToA"}(n||(e.SwapDirection=n={})),function(t){t[t.TokenA=1]="TokenA",t[t.TokenB=2]="TokenB"}(r||(e.TokenType=r={}))},60605:(t,e)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.RemainingAccountsBuilder=e.RemainingAccountsType=void 0,function(t){t.TransferHookA="transferHookA",t.TransferHookB="transferHookB",t.TransferHookReward="transferHookReward",t.TransferHookInput="transferHookInput",t.TransferHookIntermediate="transferHookIntermediate",t.TransferHookOutput="transferHookOutput"}(n||(e.RemainingAccountsType=n={})),e.RemainingAccountsBuilder=class{constructor(){this.remainingAccounts=[],this.slices=[]}addSlice(t,e){return e&&0!==e.length?(this.slices.push({accountsType:{[t]:{}},length:e.length}),this.remainingAccounts.push(...e),this):this}build(){return[{slices:this.slices},this.remainingAccounts.length>0?this.remainingAccounts:void 0]}}},99576:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getUpperSqrtPriceFromTokenB=e.getLowerSqrtPriceFromTokenB=e.getUpperSqrtPriceFromTokenA=e.getLowerSqrtPriceFromTokenA=void 0;const r=n(66259);e.getLowerSqrtPriceFromTokenA=function(t,e,n){const i=e.mul(n).shln(64),o=e.shln(64).add(t.mul(n));return r.MathUtil.divRoundUp(i,o)},e.getUpperSqrtPriceFromTokenA=function(t,e,n){const i=e.mul(n).shln(64),o=e.shln(64).sub(t.mul(n));return r.MathUtil.divRoundUp(i,o)},e.getLowerSqrtPriceFromTokenB=function(t,e,n){return n.sub(r.MathUtil.divRoundUp(t.shln(64),e))},e.getUpperSqrtPriceFromTokenB=function(t,e,n){return n.add(t.shln(64).div(e))}},51986:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleTransactionBuilderFactoryWithAccountResolver=e.contextOptionsToBuilderOptions=e.checkMergedTransactionSizeIsValid=e.filterNullObjects=e.convertListToMap=void 0;const r=n(66259),i=n(29955);async function o(t,e,n){const i=new r.TransactionBuilder(t.connection,t.wallet,t.txBuilderOpts);e.forEach((t=>i.addInstruction(t.compressIx(!0))));try{return await i.txnSize({latestBlockhash:n}),!0}catch(t){return!1}}e.convertListToMap=function(t,e){const n={};return t.forEach(((t,r)=>{if(t){const i=e[r];n[i]=t}})),n},e.filterNullObjects=function(t,e){const n=[],r=[];return t.forEach(((t,i)=>{null!==t&&(n.push(t),r.push(e[i]))})),[n,r]},e.checkMergedTransactionSizeIsValid=o,e.contextOptionsToBuilderOptions=function(t){return{defaultBuildOption:{...r.defaultTransactionBuilderOptions.defaultBuildOption,...t.userDefaultBuildOptions},defaultSendOption:{...r.defaultTransactionBuilderOptions.defaultSendOption,...t.userDefaultSendOptions},defaultConfirmationCommitment:t.userDefaultConfirmCommitment??r.defaultTransactionBuilderOptions.defaultConfirmationCommitment}},e.MultipleTransactionBuilderFactoryWithAccountResolver=class{constructor(t,e,n=t.wallet.publicKey,r=n){this.ctx=t,this.resolvedAtas=e,this.tokenOwner=n,this.payer=r,this.txBuilders=[],this.pendingTxBuilder=null,this.touchedMints=null,this.accountExemption=null}async addInstructions(t){null===this.accountExemption&&(this.accountExemption=await this.ctx.fetcher.getAccountRentExempt());for(let e=0;e<2;e++){this.pendingTxBuilder&&this.touchedMints||(this.pendingTxBuilder=new r.TransactionBuilder(this.ctx.connection,this.ctx.wallet,this.ctx.txBuilderOpts),this.touchedMints=new Set,this.resolvedAtas[i.NATIVE_MINT.toBase58()]=r.TokenUtil.createWrappedNativeAccountInstruction(this.tokenOwner,r.ZERO,this.accountExemption,this.payer,this.tokenOwner,this.ctx.accountResolverOpts.createWrappedSolAccountMethod));const n=new r.TransactionBuilder(this.ctx.connection,this.ctx.wallet,this.ctx.txBuilderOpts),s=t=>(this.touchedMints.has(t)||(n.addInstruction(this.resolvedAtas[t]),this.touchedMints.add(t)),this.resolvedAtas[t].address),a=await t(s.bind(this));if(n.addInstructions(a),await o(this.ctx,[this.pendingTxBuilder,n],r.MEASUREMENT_BLOCKHASH)){this.pendingTxBuilder.addInstruction(n.compressIx(!1));break}if(0!==e)throw new Error("instruction is too large.");this.txBuilders.push(this.pendingTxBuilder),this.pendingTxBuilder=null,this.touchedMints=null}}build(){return this.pendingTxBuilder?[...this.txBuilders,this.pendingTxBuilder]:[...this.txBuilders]}}},88459:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isWalletConnected=void 0;const r=n(18245);e.isWalletConnected=function(t){return null!==t&&!t.publicKey.equals(r.PublicKey.default)}},25367:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.addNativeMintHandlingIx=e.resolveAtaForMints=e.getTokenMintsFromWhirlpools=e.TokenMintTypes=void 0;const r=n(66259),i=n(29955),o=n(18245),s=n(40273),a=n(51986);var u;!function(t){t.ALL="ALL",t.POOL_ONLY="POOL_ONLY",t.REWARD_ONLY="REWARDS_ONLY"}(u||(e.TokenMintTypes=u={})),e.getTokenMintsFromWhirlpools=function(t,e=u.ALL){let n=!1;return{mintMap:Array.from(t.reduce(((t,i)=>{if(i){if(e===u.ALL||e===u.POOL_ONLY){const{tokenMintA:e,tokenMintB:o}=i;r.TokenUtil.isNativeMint(e)?n=!0:t.add(e.toBase58()),r.TokenUtil.isNativeMint(o)?n=!0:t.add(o.toBase58())}e!==u.ALL&&e!==u.REWARD_ONLY||i.rewardInfos.forEach((e=>{r.TokenUtil.isNativeMint(e.mint)&&(n=!0),s.PoolUtil.isRewardInitialized(e)&&t.add(e.mint.toBase58())}))}return t}),new Set)).map((t=>new o.PublicKey(t))),hasNativeMint:n}},e.resolveAtaForMints=async function(t,e){const{mints:n,receiver:i,payer:o,accountExemption:s}=e,u=i??t.wallet.publicKey,c=o??t.wallet.publicKey,d=await(0,r.resolveOrCreateATAs)(t.connection,u,n.map((t=>({tokenMint:t}))),(async()=>s),c,void 0,t.accountResolverOpts.allowPDAOwnerAddress,t.accountResolverOpts.createWrappedSolAccountMethod),{resolveAtaIxs:l,resolvedAtas:h}=d.reduce(((t,e)=>{const{address:n,...r}=e;return t.resolvedAtas.push(n),r.instructions.length&&t.resolveAtaIxs.push(r),t}),{resolvedAtas:[],resolveAtaIxs:[]});return{ataTokenAddresses:(0,a.convertListToMap)(h,n.map((t=>t.toBase58()))),resolveAtaIxs:l}},e.addNativeMintHandlingIx=function(t,e,n,o,s){let{address:a,...u}=r.TokenUtil.createWrappedNativeAccountInstruction(n,r.ZERO,o,void 0,void 0,s);e[i.NATIVE_MINT.toBase58()]=a,t.prependInstruction(u)}},63273:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.buildWhirlpoolClient=void 0;const r=n(4263);e.buildWhirlpoolClient=function(t){return new r.WhirlpoolClientImpl(t)}},68716:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Account:()=>Qe,AddressLookupTableAccount:()=>cr,AddressLookupTableInstruction:()=>so,AddressLookupTableProgram:()=>ao,Authorized:()=>wo,BLOCKHASH_CACHE_TIMEOUT_MS:()=>mr,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>tn,BPF_LOADER_PROGRAM_ID:()=>Gn,BpfLoader:()=>Zn,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>co,ComputeBudgetInstruction:()=>uo,ComputeBudgetProgram:()=>lo,Connection:()=>ro,Ed25519Program:()=>fo,Enum:()=>He,EpochSchedule:()=>rr,FeeCalculatorLayout:()=>zn,Keypair:()=>io,LAMPORTS_PER_SOL:()=>Yo,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>oo,Loader:()=>Vn,Lockup:()=>_o,MAX_SEED_LENGTH:()=>Ge,Message:()=>yn,MessageAccountKeys:()=>un,MessageV0:()=>bn,NONCE_ACCOUNT_LENGTH:()=>jn,NonceAccount:()=>Yn,PACKET_DATA_SIZE:()=>en,PUBLIC_KEY_LENGTH:()=>Ze,PublicKey:()=>Je,SIGNATURE_LENGTH_IN_BYTES:()=>rn,SOLANA_SCHEMA:()=>Ke,STAKE_CONFIG_ID:()=>bo,STAKE_INSTRUCTION_LAYOUTS:()=>ko,SYSTEM_INSTRUCTION_LAYOUTS:()=>Hn,SYSVAR_CLOCK_PUBKEY:()=>In,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>xn,SYSVAR_INSTRUCTIONS_PUBKEY:()=>En,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>Tn,SYSVAR_RENT_PUBKEY:()=>Pn,SYSVAR_REWARDS_PUBKEY:()=>Bn,SYSVAR_SLOT_HASHES_PUBKEY:()=>Ln,SYSVAR_SLOT_HISTORY_PUBKEY:()=>$n,SYSVAR_STAKE_HISTORY_PUBKEY:()=>Rn,Secp256k1Program:()=>go,SendTransactionError:()=>ir,SolanaJSONRPCError:()=>sr,SolanaJSONRPCErrorCode:()=>or,StakeAuthorizationLayout:()=>Mo,StakeInstruction:()=>vo,StakeProgram:()=>Ao,Struct:()=>We,SystemInstruction:()=>Wn,SystemProgram:()=>Kn,Transaction:()=>Mn,TransactionExpiredBlockheightExceededError:()=>on,TransactionExpiredNonceInvalidError:()=>an,TransactionExpiredTimeoutError:()=>sn,TransactionInstruction:()=>kn,TransactionMessage:()=>An,TransactionStatus:()=>_n,VALIDATOR_INFO_KEY:()=>Po,VERSION_PREFIX_MASK:()=>nn,VOTE_PROGRAM_ID:()=>$o,ValidatorInfo:()=>Lo,VersionedMessage:()=>wn,VersionedTransaction:()=>Sn,VoteAccount:()=>Oo,VoteAuthorizationLayout:()=>Eo,VoteInit:()=>So,VoteInstruction:()=>Io,VoteProgram:()=>To,clusterApiUrl:()=>Uo,sendAndConfirmRawTransaction:()=>jo,sendAndConfirmTransaction:()=>On});var r={};n.r(r),n.d(r,{dQ:()=>Z,ci:()=>z,bytesToNumberBE:()=>W,ty:()=>H,eV:()=>G,n$:()=>Q,ql:()=>V,hexToBytes:()=>F,_t:()=>C,tL:()=>K,S5:()=>q,FF:()=>et});var i=n(48764);function o(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function s(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Expected Uint8Array");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){s(t);const n=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),h=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function f(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function p(t){if("string"==typeof t&&(t=f(t)),!d(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function m(...t){let e=0;for(let n=0;nt().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function b(t=32){if(c&&"function"==typeof c.getRandomValues)return c.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class w extends g{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=l(this.buffer)}update(t){a(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=p(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=l(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t>v&_)}:{h:0|Number(t>>v&_),l:0|Number(t&_)}}function M(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it<>>32-n,S=(t,e,n)=>e<>>32-n,I=(t,e,n)=>e<>>64-n,x=(t,e,n)=>t<>>64-n,E={fromBig:k,split:M,toBig:(t,e)=>BigInt(t>>>0)<>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:A,rotlSL:S,rotlBH:I,rotlBL:x,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[T,P]=(()=>E.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),B=new Uint32Array(80),L=new Uint32Array(80);class $ extends w{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)B[n]=t.getUint32(e),L[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|B[t-15],n=0|L[t-15],r=E.rotrSH(e,n,1)^E.rotrSH(e,n,8)^E.shrSH(e,n,7),i=E.rotrSL(e,n,1)^E.rotrSL(e,n,8)^E.shrSL(e,n,7),o=0|B[t-2],s=0|L[t-2],a=E.rotrSH(o,s,19)^E.rotrBH(o,s,61)^E.shrSH(o,s,6),u=E.rotrSL(o,s,19)^E.rotrBL(o,s,61)^E.shrSL(o,s,6),c=E.add4L(i,u,L[t-7],L[t-16]),d=E.add4H(c,r,a,B[t-7],B[t-16]);B[t]=0|d,L[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=E.rotrSH(d,l,14)^E.rotrSH(d,l,18)^E.rotrBH(d,l,41),b=E.rotrSL(d,l,14)^E.rotrSL(d,l,18)^E.rotrBL(d,l,41),w=d&h^~d&p,_=l&f^~l&m,v=E.add5L(y,b,_,P[t],L[t]),k=E.add5H(v,g,e,w,T[t],B[t]),M=0|v,A=E.rotrSH(n,r,28)^E.rotrBH(n,r,34)^E.rotrBH(n,r,39),S=E.rotrSL(n,r,28)^E.rotrBL(n,r,34)^E.rotrBL(n,r,39),I=n&i^n&s^i&s,x=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|d,f=0|l,({h:d,l}=E.add(0|u,0|c,0|k,0|M)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const $=E.add3L(M,S,x);n=E.add3H($,k,A,I),r=0|$}({h:n,l:r}=E.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=E.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=E.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=E.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=E.add(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=E.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=E.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=E.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y)}roundClean(){B.fill(0),L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const R=y((()=>new $)),O=(BigInt(0),BigInt(1)),D=BigInt(2);function C(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const N=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function z(t){if(!C(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n=j._0&&t<=j._9?t-j._0:t>=j._A&&t<=j._F?t-(j._A-10):t>=j._a&&t<=j._f?t-(j._a-10):void 0}function F(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(D<new Uint8Array(t),J=t=>Uint8Array.from(t);function Q(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=X(t),i=X(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=X())=>{i=a(J([0]),t),r=a(),0!==t.length&&(i=a(J([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const tt={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||C(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function et(t,e,n={}){const r=(e,n,r)=>{const i=tt[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const nt=BigInt(0),rt=BigInt(1),it=BigInt(2),ot=BigInt(3),st=BigInt(4),at=BigInt(5),ut=BigInt(8);function ct(t,e){const n=t%e;return n>=nt?n:e+n}function dt(t,e,n){if(n<=nt||e 0");if(n===rt)return nt;let r=rt;for(;e>nt;)e&rt&&(r=r*t%n),t=t*t%n,e>>=rt;return r}function lt(t,e,n){let r=t;for(;e-- >nt;)r*=r,r%=n;return r}function ht(t,e){if(t===nt||e<=nt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=ct(t,e),r=e,i=nt,o=rt,s=rt,a=nt;for(;n!==nt;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==rt)throw new Error("invert: does not exist");return ct(i,e)}BigInt(9),BigInt(16);const ft=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function mt(t,e,n=!1,r={}){if(t<=nt)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=pt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%st===ot){const e=(t+rt)/st;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%ut===at){const e=(t-at)/ut;return function(t,n){const r=t.mul(n,it),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,it),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-rt)/it;let n,r,i;for(n=t-rt,r=0;n%it===nt;n/=it,r++);for(i=it;ict(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return nt<=e&&et===nt,isOdd:t=>(t&rt)===rt,neg:e=>ct(-e,t),eql:(t,e)=>t===e,sqr:e=>ct(e*e,t),add:(e,n)=>ct(e+n,t),sub:(e,n)=>ct(e-n,t),mul:(e,n)=>ct(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===nt)return t.ONE;if(n===rt)return e;let r=t.ONE,i=e;for(;n>nt;)n&rt&&(r=t.mul(r,i)),i=t.sqr(i),n>>=rt;return r}(a,t,e),div:(e,n)=>ct(e*ht(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>ht(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?q(t,o):K(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?H(t):W(t)}});return Object.freeze(a)}function gt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function yt(t){const e=gt(t);return e+Math.ceil(e/2)}const bt=BigInt(0),wt=BigInt(1);function _t(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>bt;)n&wt&&(r=r.add(i)),i=i.double(),n>>=wt;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=wt);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function vt(t){return et(t.Fp,ft.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),et(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const kt=BigInt(0),Mt=BigInt(1),At=BigInt(2),St=BigInt(8),It={zip215:!0};function xt(t){const e=function(t){const e=vt(t);return et(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=At<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:kt}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&ktp(t)&&p(e)&&tt===kt||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===kt?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,Mt,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(At*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===kt)return this.double();const r=d(s*At*h),f=d(a*At*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===kt?M:this.equals(M)||e===Mt?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?St:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:kt,y:Mt};if(u!==Mt)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===Mt?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=V("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=H(a);h===kt||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-Mt),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&Mt)===Mt,_=0!=(128&u);if(!r&&b===kt&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return x(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=q(e,n.BYTES);return r[r.length-1]|=t&Mt?128:0,r}toHex(){return z(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,Mt,d(e.Gx*e.Gy)),v.ZERO=new v(kt,Mt,Mt,kt);const{BASE:k,ZERO:M}=v,A=_t(v,8*a);function S(t){return ct(t,r)}function I(t){return S(H(t))}function x(t){const e=a;t=V("private key",t,e);const n=V("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function E(t=new Uint8Array,...e){const n=G(...e);return I(o(f(n,V("context",t),!!i)))}const T=It;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return x(t).pointBytes},sign:function(t,e,r={}){t=V("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=x(e),c=E(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+E(r.context,d,u,t)*s);return b(l),V("result",G(d,q(l,n.BYTES)),2*a)},verify:function(t,e,r,o=T){const{context:s,zip215:a}=o,u=n.BYTES;t=V("signature",t,2*u),e=V("message",e),i&&(e=i(e));const c=H(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=E(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const Et=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Tt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Pt=(BigInt(0),BigInt(1)),Bt=BigInt(2),Lt=BigInt(5),$t=BigInt(10),Rt=BigInt(20),Ot=BigInt(40),Dt=BigInt(80);const Ct=mt(Et,void 0,!0),Nt={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ct,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:R,randomBytes:b,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=Et,r=ct(e*e*e,n),i=ct(r*r*e,n);let o=ct(t*r*function(t){const e=Et,n=t*t%e*t%e,r=lt(n,Bt,e)*n%e,i=lt(r,Pt,e)*t%e,o=lt(i,Lt,e)*i%e,s=lt(o,$t,e)*o%e,a=lt(s,Rt,e)*s%e,u=lt(a,Ot,e)*a%e,c=lt(u,Dt,e)*u%e,d=lt(c,Dt,e)*u%e,l=lt(d,$t,e)*o%e;return{pow_p_5_8:lt(l,Bt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=ct(e*o*o,n),a=o,u=ct(o*Tt,n),c=s===t,d=s===ct(-t,n),l=s===ct(-t*Tt,n);return c&&(o=a),(d||l)&&(o=u),(ct(o,n)&rt)===rt&&(o=ct(-o,n)),{isValid:c||d,value:o}}},zt=xt(Nt);const Ut=(Ct.ORDER+BigInt(3))/BigInt(8);Ct.pow(Bt,Ut),Ct.sqrt(Ct.neg(Ct.ONE)),Ct.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(Ct,Ct.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var jt=n(13550),Yt=n.n(jt),Ft=n(77191),Wt=n.n(Ft);const Ht=(t,e,n)=>t&e^t&n^e&n,Kt=new Uint32Array([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]),qt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Vt=new Uint32Array(64);class Gt extends w{constructor(){super(64,32,8,!1),this.A=0|qt[0],this.B=0|qt[1],this.C=0|qt[2],this.D=0|qt[3],this.E=0|qt[4],this.F=0|qt[5],this.G=0|qt[6],this.H=0|qt[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Vt[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Vt[t-15],n=Vt[t-2],r=h(e,7)^h(e,18)^e>>>3,i=h(n,17)^h(n,19)^n>>>10;Vt[t]=i+Vt[t-7]+r+Vt[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(h(s,6)^h(s,11)^h(s,25))+((d=s)&a^~d&u)+Kt[t]+Vt[t]|0,l=(h(n,2)^h(n,13)^h(n,22))+Ht(n,r,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){Vt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Zt=y((()=>new Gt));var Xt=n(25532),Jt=n(39386),Qt=n(40475),te=n(53471),ee=n(31198),ne=n.n(ee),re=n(54654),ie=n(31991);const[oe,se,ae]=[[],[],[]],ue=BigInt(0),ce=BigInt(1),de=BigInt(2),le=BigInt(7),he=BigInt(256),fe=BigInt(113);for(let t=0,e=ce,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],oe.push(2*(5*r+n)),se.push((t+1)*(t+2)/2%64);let i=ue;for(let t=0;t<7;t++)e=(e<>le)*fe)%he,e&de&&(i^=ce<<(ce<n>32?I(t,e,n):A(t,e,n),ye=(t,e,n)=>n>32?x(t,e,n):S(t,e,n);class be extends g{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,o(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=ge(o,s,1)^n[r],u=ye(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=se[n],o=ge(e,i,r),s=ye(e,i,r),a=oe[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=pe[r],t[1]^=me[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){a(this);const{blockLen:e,state:n}=this,r=(t=p(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return o(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(u(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new be(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const we=((t,e,n)=>y((()=>new be(e,t,n))))(1,136,32);class _e extends g{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(t.outputLen),o(t.blockLen)}(t);const n=p(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew _e(t,e).update(n).digest();ve.create=(t,e)=>new _e(t,e);const{bytesToNumberBE:ke,hexToBytes:Me}=r,Ae={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=Ae;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:ke(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Ae,n="string"==typeof t?Me(t):t;if(!C(n))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=Ae._parseInt(n.subarray(2)),{d:s,l:a}=Ae._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},Se=BigInt(0),Ie=BigInt(1),xe=(BigInt(2),BigInt(3));function Ee(t){const e=function(t){const e=vt(t);return et(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return ct(t,r)}function a(t){return ht(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=vt(t);et(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return G(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&Sen.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(V("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,xe),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,xe);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===Se)return r;if(a(t),t===Ie)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>Se||c>Se;)s&Ie&&(d=d.add(p)),c&Ie&&(h=h.add(p)),p=p.double(),s>>=Ie,c>>=Ie;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==Se&&e!==Ie&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Ie)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Ie?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return z(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=_t(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=G;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=W(s);if(!(Se<(a=t)&&az(K(t,e.nByteLength));function f(t){return t>r>>Ie}const p=(t,e,n)=>W(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=V("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=Ae.toSig(V("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(V("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return F(this.toDERHex())}toDERHex(){return Ae.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return F(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=yt(e.n);return function(t,e,n=!1){const r=t.length,i=gt(e),o=yt(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=ct(n?W(t):H(t),e-rt)+rt;return n?q(s,i):K(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=C(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=W(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=Z(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(Se<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return K(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=V("msgHash",t),p&&(t=V("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g){const t=!0===g?d(n.BYTES):g;M.push(V("extraEntropy",t))}const A=G(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===Se)return;const o=s(n*s(S+i*_));if(o===Se)return;let c=(r.x===i?0:2)|Number(r.y&Ie),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return Q(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=V("msgHash",n),r=V("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||C(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof Ae.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function Te(t){return{hash:t,hmac:(e,...n)=>ve(t,e,m(...n)),randomBytes:b}}BigInt(4);const Pe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Be=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Le=BigInt(1),$e=BigInt(2),Re=(t,e)=>(t+e/$e)/e;const Oe=mt(Pe,void 0,void 0,{sqrt:function(t){const e=Pe,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=lt(d,n,e)*d%e,h=lt(l,n,e)*d%e,f=lt(h,$e,e)*c%e,p=lt(f,i,e)*f%e,m=lt(p,o,e)*p%e,g=lt(m,a,e)*m%e,y=lt(g,u,e)*g%e,b=lt(y,a,e)*m%e,w=lt(b,n,e)*d%e,_=lt(w,s,e)*p%e,v=lt(_,r,e)*c%e,k=lt(v,$e,e);if(!Oe.eql(Oe.sqr(k),t))throw new Error("Cannot find square root");return k}}),De=function(t,e){const n=e=>Ee({...t,...Te(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Oe,n:Be,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Be,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Le*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=Re(o*t,e),u=Re(-r*t,e);let c=ct(t-a*n-u*i,e),d=ct(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},Zt);BigInt(0),De.ProjectivePoint;const Ce=zt.utils.randomPrivateKey,Ne=()=>{const t=zt.utils.randomPrivateKey(),e=ze(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},ze=zt.getPublicKey;function Ue(t){try{return zt.ExtendedPoint.fromHex(t),!0}catch{return!1}}const je=(t,e)=>zt.sign(t,e.slice(0,32)),Ye=zt.verify,Fe=t=>i.Buffer.isBuffer(t)?t:t instanceof Uint8Array?i.Buffer.from(t.buffer,t.byteOffset,t.byteLength):i.Buffer.from(t);class We{constructor(t){Object.assign(this,t)}encode(){return i.Buffer.from((0,Xt.serialize)(Ke,this))}static decode(t){return(0,Xt.deserialize)(Ke,this,t)}static decodeUnchecked(t){return(0,Xt.deserializeUnchecked)(Ke,this,t)}}class He extends We{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}}const Ke=new Map;var qe;let Ve;const Ge=32,Ze=32;let Xe=1;Ve=Symbol.toStringTag;class Je extends We{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Wt().decode(t);if(e.length!=Ze)throw new Error("Invalid public key input");this._bn=new(Yt())(e)}else this._bn=new(Yt())(t);if(this._bn.byteLength()>Ze)throw new Error("Invalid public key input")}}static unique(){const t=new Je(Xe);return Xe+=1,new Je(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Wt().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(i.Buffer);if(t.length===Ze)return t;const e=i.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Ve](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=i.Buffer.concat([t.toBuffer(),i.Buffer.from(e),n.toBuffer()]),o=Zt(r);return new Je(o)}static createProgramAddressSync(t,e){let n=i.Buffer.alloc(0);t.forEach((function(t){if(t.length>Ge)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Fe(t)])})),n=i.Buffer.concat([n,e.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=Zt(n);if(Ue(r))throw new Error("Invalid seeds, address must fall off the curve");return new Je(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const o=t.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return Ue(new Je(t).toBytes())}}qe=Je,Je.default=new qe("11111111111111111111111111111111"),Ke.set(Je,{kind:"struct",fields:[["_bn","u256"]]});class Qe{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=Fe(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Fe(Ce()),this._publicKey=Fe(ze(this._secretKey))}get publicKey(){return new Je(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const tn=new Je("BPFLoader1111111111111111111111111111111111"),en=1232,nn=127,rn=64;class on extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(on.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class sn extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(sn.prototype,"name",{value:"TransactionExpiredTimeoutError"});class an extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(an.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class un{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const cn=(t="publicKey")=>Jt.blob(32,t),dn=(t="signature")=>Jt.blob(64,t),ln=(t="string")=>{const e=Jt.struct([Jt.u32("length"),Jt.u32("lengthPadding"),Jt.blob(Jt.offset(Jt.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),o=e;return o.decode=(t,e)=>n(t,e).chars.toString(),o.encode=(t,e,n)=>{const o={chars:i.Buffer.from(t,"utf8")};return r(o,e,n)},o.alloc=t=>Jt.u32().span+Jt.u32().span+i.Buffer.from(t,"utf8").length,o};function hn(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return hn({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function fn(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function pn(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function mn(t,e){if(!t)throw new Error(e||"Assertion failed")}class gn{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new gn(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];mn(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{mn(e.length>0,"Expected at least one writable signer key");const[t]=e[0];mn(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Je(t))),...n.map((([t])=>new Je(t))),...r.map((([t])=>new Je(t))),...i.map((([t])=>new Je(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Je(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(mn(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}class yn{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Je(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Wt().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new un(this.staticAccountKeys)}static compile(t){const e=gn.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new un(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Wt().encode(t.data)})));return new yn({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];pn(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Wt().decode(t.data));let o=[];pn(o,e.length);let s=[];return pn(s,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:e,dataLength:i.Buffer.from(s),data:r}}));let r=[];pn(r,n.length);let o=i.Buffer.alloc(en);i.Buffer.from(r).copy(o);let s=r.length;n.forEach((t=>{const e=Jt.struct([Jt.u8("programIdIndex"),Jt.blob(t.keyIndicesCount.length,"keyIndicesCount"),Jt.seq(Jt.u8("keyIndex"),t.keyIndices.length,"keyIndices"),Jt.blob(t.dataLength.length,"dataLength"),Jt.seq(Jt.u8("userdatum"),t.data.length,"data")]).encode(t,o,s);s+=e})),o=o.slice(0,s);const a=Jt.struct([Jt.blob(1,"numRequiredSignatures"),Jt.blob(1,"numReadonlySignedAccounts"),Jt.blob(1,"numReadonlyUnsignedAccounts"),Jt.blob(e.length,"keyCount"),Jt.seq(cn("key"),t,"keys"),cn("recentBlockhash")]),u={numRequiredSignatures:i.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:i.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:i.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:i.Buffer.from(e),keys:this.accountKeys.map((t=>Fe(t.toBytes()))),recentBlockhash:Wt().decode(this.recentBlockhash)};let c=i.Buffer.alloc(2048);const d=a.encode(u,c);return o.copy(c,d),c.slice(0,d+o.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&nn))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=e.shift(),o=e.shift(),s=fn(e);let a=[];for(let t=0;t0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new un(this.staticAccountKeys,e)}isAccountSigner(t){return t=n?t-nt+e.writableIndexes.length),0):t>=this.header.numRequiredSignatures?t-et.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const t of n.writableIndexes){if(!(tt.toBytes())),recentBlockhash:Wt().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let t=0;const e=new Uint8Array(en);for(const n of this.compiledInstructions){const r=Array();pn(r,n.accountKeyIndexes.length);const i=Array();pn(i,n.data.length),t+=Jt.struct([Jt.u8("programIdIndex"),Jt.blob(r.length,"encodedAccountKeyIndexesLength"),Jt.seq(Jt.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),Jt.blob(i.length,"encodedDataLength"),Jt.blob(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(en);for(const n of this.addressTableLookups){const r=Array();pn(r,n.writableIndexes.length);const i=Array();pn(i,n.readonlyIndexes.length),t+=Jt.struct([cn("accountKey"),Jt.blob(r.length,"encodedWritableIndexesLength"),Jt.seq(Jt.u8(),n.writableIndexes.length,"writableIndexes"),Jt.blob(i.length,"encodedReadonlyIndexesLength"),Jt.seq(Jt.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),r=n&nn;mn(n!==r,"Expected versioned message but received legacy message"),mn(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},o=[],s=fn(e);for(let t=0;t{const e=wn.deserializeMessageVersion(t);if("legacy"===e)return yn.from(t);if(0===e)return bn.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let _n=function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t}({});const vn=i.Buffer.alloc(rn).fill(0);class kn{constructor(t){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class Mn{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new kn(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Je(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Wt().encode(e)}}));return f.forEach((t=>{mn(t.programIdIndex>=0),t.accounts.forEach((t=>mn(t>=0)))})),new yn({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=je(n,t.secretKey);this._addSignature(t.publicKey,Fe(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){mn(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=i.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):Ye(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];pn(n,e.length);const r=n.length+64*e.length+t.length,o=i.Buffer.alloc(r);return mn(e.length<256),i.Buffer.from(n).copy(o,0),e.forEach((({signature:t},e)=>{null!==t&&(mn(64===t.length,"signature has invalid length"),i.Buffer.from(t).copy(o,n.length+64*e))})),t.copy(o,n.length+64*e.length),mn(o.length<=en,`Transaction too large: ${o.length} > ${en}`),o}get keys(){return mn(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return mn(1===this.instructions.length),this.instructions[0].programId}get data(){return mn(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=fn(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Wt().encode(vn)?null:Wt().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new kn({keys:r,programId:t.accountKeys[e.programIdIndex],data:Wt().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}class An{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:r,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;mn(u>0,"Message header is invalid");const c=t.staticAccountKeys.length-o-a;mn(c>=0,"Message header is invalid");const d=t.getAccountKeys(e),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const t of r){const e=[];for(const r of t.accountKeyIndexes){const t=d.get(r);if(void 0===t)throw new Error(`Failed to find key for account key index ${r}`);let i;i=rt.equals(r.publicKey)));mn(t>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[t]=je(e,r.secretKey)}}addSignature(t,e){mn(64===e.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((e=>e.equals(t)));mn(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const In=new Je("SysvarC1ock11111111111111111111111111111111"),xn=new Je("SysvarEpochSchedu1e111111111111111111111111"),En=new Je("Sysvar1nstructions1111111111111111111111111"),Tn=new Je("SysvarRecentB1ockHashes11111111111111111111"),Pn=new Je("SysvarRent111111111111111111111111111111111"),Bn=new Je("SysvarRewards111111111111111111111111111111"),Ln=new Je("SysvarS1otHashes111111111111111111111111111"),$n=new Je("SysvarS1otHistory11111111111111111111111111"),Rn=new Je("SysvarStakeHistory1111111111111111111111111");async function On(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function Dn(t){return new Promise((e=>setTimeout(e,t)))}function Cn(t,e){const n=t.layout.span>=0?t.layout.span:hn(t,e),r=i.Buffer.alloc(n),o=Object.assign({instruction:t.index},e);return t.layout.encode(o,r),r}function Nn(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const zn=Jt.nu64("lamportsPerSignature"),Un=Jt.struct([Jt.u32("version"),Jt.u32("state"),cn("authorizedPubkey"),cn("nonce"),Jt.struct([zn],"feeCalculator")]),jn=Un.span;class Yn{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=Un.decode(Fe(t),0);return new Yn({authorizedPubkey:new Je(e.authorizedPubkey),nonce:new Je(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const Fn=(8,t=>{const e=(0,Jt.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return(0,Qt.toBigIntLE)(i.Buffer.from(n))},o.encode=(t,e,r)=>{const i=(0,Qt.toBufferLE)(t,8);return n(i,e,r)},o});class Wn{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Hn))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=Nn(Hn.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new Je(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=Nn(Hn.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=Nn(Hn.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new Je(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=Nn(Hn.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=Nn(Hn.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Je(e),seed:n,space:r,programId:new Je(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=Nn(Hn.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new Je(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=Nn(Hn.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Je(e),seed:n,programId:new Je(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=Nn(Hn.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new Je(e),seed:n,lamports:r,space:i,programId:new Je(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=Nn(Hn.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new Je(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(Hn.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Nn(Hn.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=Nn(Hn.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new Je(e)}}static checkProgramId(t){if(!t.equals(Kn.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length0?i:1,space:o.length,programId:r}));null!==a&&await On(t,a,[e,n],{commitment:"confirmed"})}const s=Jt.struct([Jt.u32("instruction"),Jt.u32("offset"),Jt.u32("bytesLength"),Jt.u32("bytesLengthPadding"),Jt.seq(Jt.u8("byte"),Jt.offset(Jt.u32(),-8),"bytes")]),a=Vn.chunkSize;let u=0,c=o,d=[];for(;c.length>0;){const o=c.slice(0,a),l=i.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:o,bytesLength:0,bytesLengthPadding:0},l);const h=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push(On(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await Dn(1e3/t)}u+=a,c=c.slice(a)}await Promise.all(d);{const o=Jt.struct([Jt.u32("instruction")]),s=i.Buffer.alloc(o.span);o.encode({instruction:1},s);const a=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1}],programId:r,data:s}),u="processed",c=await t.sendTransaction(a,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}Vn.chunkSize=qn;const Gn=new Je("BPFLoader2111111111111111111111111111111111");class Zn{static getMinNumSignatures(t){return Vn.getMinNumSignatures(t)}static load(t,e,n,r,i){return Vn.load(t,e,n,i,r)}}function Xn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jn=Object.prototype.toString,Qn=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function tr(t,e){var n,r,i,o,s,a,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return tr(t.toJSON(),e);if("[object Array]"===(u=Jn.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=tr(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Qn(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}class rr{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32)))-nr(32)-1;return[n,t-(this.getSlotsInEpoch(n)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}var e}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const n=(0,ie.Z)(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in n?n.socket:n,n}),t,e,n),this.underlyingSocket=void 0}call(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class cr{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${t.index}`);return n}(dr,t),n=t.length-56;mn(n>=0,"lookup table is invalid"),mn(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=Jt.struct([Jt.seq(cn(),r,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new Je(e.authority[0]):void 0,addresses:i.map((t=>new Je(t)))}}}const dr={index:1,layout:Jt.struct([Jt.u32("typeIndex"),Fn("deactivationSlot"),Jt.nu64("lastExtendedSlot"),Jt.u8("lastExtendedStartIndex"),Jt.u8(),Jt.seq(cn(),Jt.offset(Jt.u8(),-1),"authority")])},lr=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,hr=(0,te.oQ)((0,te.eE)(Je),(0,te.Z_)(),(t=>new Je(t))),fr=(0,te.bc)([(0,te.Z_)(),(0,te.i0)("base64")]),pr=(0,te.oQ)((0,te.eE)(i.Buffer),fr,(t=>i.Buffer.from(t[0],"base64"))),mr=3e4;function gr(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function yr(t){return(0,te.G0)([(0,te.dt)({jsonrpc:(0,te.i0)("2.0"),id:(0,te.Z_)(),result:t}),(0,te.dt)({jsonrpc:(0,te.i0)("2.0"),id:(0,te.Z_)(),error:(0,te.dt)({code:(0,te._4)(),message:(0,te.Z_)(),data:(0,te.jt)((0,te.Yj)())})})])}const br=yr((0,te._4)());function wr(t){return(0,te.oQ)(yr(t),br,(e=>"error"in e?e:{...e,result:(0,te.Ue)(e.result,t)}))}function _r(t){return wr((0,te.dt)({context:(0,te.dt)({slot:(0,te.Rx)()}),value:t}))}function vr(t){return(0,te.dt)({context:(0,te.dt)({slot:(0,te.Rx)()}),value:t})}function kr(t,e){return 0===t?new bn({header:e.header,staticAccountKeys:e.accountKeys.map((t=>new Je(t))),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Wt().decode(t.data)}))),addressTableLookups:e.addressTableLookups}):new yn(e)}const Mr=(0,te.dt)({foundation:(0,te.Rx)(),foundationTerm:(0,te.Rx)(),initial:(0,te.Rx)(),taper:(0,te.Rx)(),terminal:(0,te.Rx)()}),Ar=wr((0,te.IX)((0,te.AG)((0,te.dt)({epoch:(0,te.Rx)(),effectiveSlot:(0,te.Rx)(),amount:(0,te.Rx)(),postBalance:(0,te.Rx)(),commission:(0,te.jt)((0,te.AG)((0,te.Rx)()))})))),Sr=(0,te.IX)((0,te.dt)({slot:(0,te.Rx)(),prioritizationFee:(0,te.Rx)()})),Ir=(0,te.dt)({total:(0,te.Rx)(),validator:(0,te.Rx)(),foundation:(0,te.Rx)(),epoch:(0,te.Rx)()}),xr=(0,te.dt)({epoch:(0,te.Rx)(),slotIndex:(0,te.Rx)(),slotsInEpoch:(0,te.Rx)(),absoluteSlot:(0,te.Rx)(),blockHeight:(0,te.jt)((0,te.Rx)()),transactionCount:(0,te.jt)((0,te.Rx)())}),Er=(0,te.dt)({slotsPerEpoch:(0,te.Rx)(),leaderScheduleSlotOffset:(0,te.Rx)(),warmup:(0,te.O7)(),firstNormalEpoch:(0,te.Rx)(),firstNormalSlot:(0,te.Rx)()}),Tr=(0,te.IM)((0,te.Z_)(),(0,te.IX)((0,te.Rx)())),Pr=(0,te.AG)((0,te.G0)([(0,te.dt)({}),(0,te.Z_)()])),Br=(0,te.dt)({err:Pr}),Lr=(0,te.i0)("receivedSignature"),$r=(0,te.dt)({"solana-core":(0,te.Z_)(),"feature-set":(0,te.jt)((0,te.Rx)())}),Rr=_r((0,te.dt)({err:(0,te.AG)((0,te.G0)([(0,te.dt)({}),(0,te.Z_)()])),logs:(0,te.AG)((0,te.IX)((0,te.Z_)())),accounts:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.AG)((0,te.dt)({executable:(0,te.O7)(),owner:(0,te.Z_)(),lamports:(0,te.Rx)(),data:(0,te.IX)((0,te.Z_)()),rentEpoch:(0,te.jt)((0,te.Rx)())}))))),unitsConsumed:(0,te.jt)((0,te.Rx)()),returnData:(0,te.jt)((0,te.AG)((0,te.dt)({programId:(0,te.Z_)(),data:(0,te.bc)([(0,te.Z_)(),(0,te.i0)("base64")])})))})),Or=_r((0,te.dt)({byIdentity:(0,te.IM)((0,te.Z_)(),(0,te.IX)((0,te.Rx)())),range:(0,te.dt)({firstSlot:(0,te.Rx)(),lastSlot:(0,te.Rx)()})})),Dr=wr(Mr),Cr=wr(Ir),Nr=wr(Sr),zr=wr(xr),Ur=wr(Er),jr=wr(Tr),Yr=wr((0,te.Rx)()),Fr=_r((0,te.dt)({total:(0,te.Rx)(),circulating:(0,te.Rx)(),nonCirculating:(0,te.Rx)(),nonCirculatingAccounts:(0,te.IX)(hr)})),Wr=(0,te.dt)({amount:(0,te.Z_)(),uiAmount:(0,te.AG)((0,te.Rx)()),decimals:(0,te.Rx)(),uiAmountString:(0,te.jt)((0,te.Z_)())}),Hr=_r((0,te.IX)((0,te.dt)({address:hr,amount:(0,te.Z_)(),uiAmount:(0,te.AG)((0,te.Rx)()),decimals:(0,te.Rx)(),uiAmountString:(0,te.jt)((0,te.Z_)())}))),Kr=_r((0,te.IX)((0,te.dt)({pubkey:hr,account:(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:pr,rentEpoch:(0,te.Rx)()})}))),qr=(0,te.dt)({program:(0,te.Z_)(),parsed:(0,te._4)(),space:(0,te.Rx)()}),Vr=_r((0,te.IX)((0,te.dt)({pubkey:hr,account:(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:qr,rentEpoch:(0,te.Rx)()})}))),Gr=_r((0,te.IX)((0,te.dt)({lamports:(0,te.Rx)(),address:hr}))),Zr=(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:pr,rentEpoch:(0,te.Rx)()}),Xr=(0,te.dt)({pubkey:hr,account:Zr}),Jr=(0,te.oQ)((0,te.G0)([(0,te.eE)(i.Buffer),qr]),(0,te.G0)([fr,qr]),(t=>Array.isArray(t)?(0,te.Ue)(t,pr):t)),Qr=(0,te.dt)({executable:(0,te.O7)(),owner:hr,lamports:(0,te.Rx)(),data:Jr,rentEpoch:(0,te.Rx)()}),ti=(0,te.dt)({pubkey:hr,account:Qr}),ei=(0,te.dt)({state:(0,te.G0)([(0,te.i0)("active"),(0,te.i0)("inactive"),(0,te.i0)("activating"),(0,te.i0)("deactivating")]),active:(0,te.Rx)(),inactive:(0,te.Rx)()}),ni=wr((0,te.IX)((0,te.dt)({signature:(0,te.Z_)(),slot:(0,te.Rx)(),err:Pr,memo:(0,te.AG)((0,te.Z_)()),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)()))}))),ri=wr((0,te.IX)((0,te.dt)({signature:(0,te.Z_)(),slot:(0,te.Rx)(),err:Pr,memo:(0,te.AG)((0,te.Z_)()),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)()))}))),ii=(0,te.dt)({subscription:(0,te.Rx)(),result:vr(Zr)}),oi=(0,te.dt)({pubkey:hr,account:Zr}),si=(0,te.dt)({subscription:(0,te.Rx)(),result:vr(oi)}),ai=(0,te.dt)({parent:(0,te.Rx)(),slot:(0,te.Rx)(),root:(0,te.Rx)()}),ui=(0,te.dt)({subscription:(0,te.Rx)(),result:ai}),ci=(0,te.G0)([(0,te.dt)({type:(0,te.G0)([(0,te.i0)("firstShredReceived"),(0,te.i0)("completed"),(0,te.i0)("optimisticConfirmation"),(0,te.i0)("root")]),slot:(0,te.Rx)(),timestamp:(0,te.Rx)()}),(0,te.dt)({type:(0,te.i0)("createdBank"),parent:(0,te.Rx)(),slot:(0,te.Rx)(),timestamp:(0,te.Rx)()}),(0,te.dt)({type:(0,te.i0)("frozen"),slot:(0,te.Rx)(),timestamp:(0,te.Rx)(),stats:(0,te.dt)({numTransactionEntries:(0,te.Rx)(),numSuccessfulTransactions:(0,te.Rx)(),numFailedTransactions:(0,te.Rx)(),maxTransactionsPerEntry:(0,te.Rx)()})}),(0,te.dt)({type:(0,te.i0)("dead"),slot:(0,te.Rx)(),timestamp:(0,te.Rx)(),err:(0,te.Z_)()})]),di=(0,te.dt)({subscription:(0,te.Rx)(),result:ci}),li=(0,te.dt)({subscription:(0,te.Rx)(),result:vr((0,te.G0)([Br,Lr]))}),hi=(0,te.dt)({subscription:(0,te.Rx)(),result:(0,te.Rx)()}),fi=(0,te.dt)({pubkey:(0,te.Z_)(),gossip:(0,te.AG)((0,te.Z_)()),tpu:(0,te.AG)((0,te.Z_)()),rpc:(0,te.AG)((0,te.Z_)()),version:(0,te.AG)((0,te.Z_)())}),pi=(0,te.dt)({votePubkey:(0,te.Z_)(),nodePubkey:(0,te.Z_)(),activatedStake:(0,te.Rx)(),epochVoteAccount:(0,te.O7)(),epochCredits:(0,te.IX)((0,te.bc)([(0,te.Rx)(),(0,te.Rx)(),(0,te.Rx)()])),commission:(0,te.Rx)(),lastVote:(0,te.Rx)(),rootSlot:(0,te.AG)((0,te.Rx)())}),mi=wr((0,te.dt)({current:(0,te.IX)(pi),delinquent:(0,te.IX)(pi)})),gi=(0,te.G0)([(0,te.i0)("processed"),(0,te.i0)("confirmed"),(0,te.i0)("finalized")]),yi=(0,te.dt)({slot:(0,te.Rx)(),confirmations:(0,te.AG)((0,te.Rx)()),err:Pr,confirmationStatus:(0,te.jt)(gi)}),bi=_r((0,te.IX)((0,te.AG)(yi))),wi=wr((0,te.Rx)()),_i=(0,te.dt)({accountKey:hr,writableIndexes:(0,te.IX)((0,te.Rx)()),readonlyIndexes:(0,te.IX)((0,te.Rx)())}),vi=(0,te.dt)({signatures:(0,te.IX)((0,te.Z_)()),message:(0,te.dt)({accountKeys:(0,te.IX)((0,te.Z_)()),header:(0,te.dt)({numRequiredSignatures:(0,te.Rx)(),numReadonlySignedAccounts:(0,te.Rx)(),numReadonlyUnsignedAccounts:(0,te.Rx)()}),instructions:(0,te.IX)((0,te.dt)({accounts:(0,te.IX)((0,te.Rx)()),data:(0,te.Z_)(),programIdIndex:(0,te.Rx)()})),recentBlockhash:(0,te.Z_)(),addressTableLookups:(0,te.jt)((0,te.IX)(_i))})}),ki=(0,te.dt)({pubkey:hr,signer:(0,te.O7)(),writable:(0,te.O7)(),source:(0,te.jt)((0,te.G0)([(0,te.i0)("transaction"),(0,te.i0)("lookupTable")]))}),Mi=(0,te.dt)({accountKeys:(0,te.IX)(ki),signatures:(0,te.IX)((0,te.Z_)())}),Ai=(0,te.dt)({parsed:(0,te._4)(),program:(0,te.Z_)(),programId:hr}),Si=(0,te.dt)({accounts:(0,te.IX)(hr),data:(0,te.Z_)(),programId:hr}),Ii=(0,te.G0)([Si,Ai]),xi=(0,te.G0)([(0,te.dt)({parsed:(0,te._4)(),program:(0,te.Z_)(),programId:(0,te.Z_)()}),(0,te.dt)({accounts:(0,te.IX)((0,te.Z_)()),data:(0,te.Z_)(),programId:(0,te.Z_)()})]),Ei=(0,te.oQ)(Ii,xi,(t=>"accounts"in t?(0,te.Ue)(t,Si):(0,te.Ue)(t,Ai))),Ti=(0,te.dt)({signatures:(0,te.IX)((0,te.Z_)()),message:(0,te.dt)({accountKeys:(0,te.IX)(ki),instructions:(0,te.IX)(Ei),recentBlockhash:(0,te.Z_)(),addressTableLookups:(0,te.jt)((0,te.AG)((0,te.IX)(_i)))})}),Pi=(0,te.dt)({accountIndex:(0,te.Rx)(),mint:(0,te.Z_)(),owner:(0,te.jt)((0,te.Z_)()),uiTokenAmount:Wr}),Bi=(0,te.dt)({writable:(0,te.IX)(hr),readonly:(0,te.IX)(hr)}),Li=(0,te.dt)({err:Pr,fee:(0,te.Rx)(),innerInstructions:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.dt)({index:(0,te.Rx)(),instructions:(0,te.IX)((0,te.dt)({accounts:(0,te.IX)((0,te.Rx)()),data:(0,te.Z_)(),programIdIndex:(0,te.Rx)()}))})))),preBalances:(0,te.IX)((0,te.Rx)()),postBalances:(0,te.IX)((0,te.Rx)()),logMessages:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.Z_)()))),preTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),postTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),loadedAddresses:(0,te.jt)(Bi),computeUnitsConsumed:(0,te.jt)((0,te.Rx)())}),$i=(0,te.dt)({err:Pr,fee:(0,te.Rx)(),innerInstructions:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.dt)({index:(0,te.Rx)(),instructions:(0,te.IX)(Ei)})))),preBalances:(0,te.IX)((0,te.Rx)()),postBalances:(0,te.IX)((0,te.Rx)()),logMessages:(0,te.jt)((0,te.AG)((0,te.IX)((0,te.Z_)()))),preTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),postTokenBalances:(0,te.jt)((0,te.AG)((0,te.IX)(Pi))),loadedAddresses:(0,te.jt)(Bi),computeUnitsConsumed:(0,te.jt)((0,te.Rx)())}),Ri=(0,te.G0)([(0,te.i0)(0),(0,te.i0)("legacy")]),Oi=(0,te.dt)({pubkey:(0,te.Z_)(),lamports:(0,te.Rx)(),postBalance:(0,te.AG)((0,te.Rx)()),rewardType:(0,te.AG)((0,te.Z_)()),commission:(0,te.jt)((0,te.AG)((0,te.Rx)()))}),Di=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:vi,meta:(0,te.AG)(Li),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ci=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ni=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Mi,meta:(0,te.AG)(Li),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),zi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Ti,meta:(0,te.AG)($i),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Ui=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:Mi,meta:(0,te.AG)($i),version:(0,te.jt)(Ri)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),ji=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)()),blockHeight:(0,te.AG)((0,te.Rx)())}))),Yi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),transactions:(0,te.IX)((0,te.dt)({transaction:vi,meta:(0,te.AG)(Li)})),rewards:(0,te.jt)((0,te.IX)(Oi)),blockTime:(0,te.AG)((0,te.Rx)())}))),Fi=wr((0,te.AG)((0,te.dt)({blockhash:(0,te.Z_)(),previousBlockhash:(0,te.Z_)(),parentSlot:(0,te.Rx)(),signatures:(0,te.IX)((0,te.Z_)()),blockTime:(0,te.AG)((0,te.Rx)())}))),Wi=wr((0,te.AG)((0,te.dt)({slot:(0,te.Rx)(),meta:(0,te.AG)(Li),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)())),transaction:vi,version:(0,te.jt)(Ri)}))),Hi=wr((0,te.AG)((0,te.dt)({slot:(0,te.Rx)(),transaction:Ti,meta:(0,te.AG)($i),blockTime:(0,te.jt)((0,te.AG)((0,te.Rx)())),version:(0,te.jt)(Ri)}))),Ki=_r((0,te.dt)({blockhash:(0,te.Z_)(),feeCalculator:(0,te.dt)({lamportsPerSignature:(0,te.Rx)()})})),qi=_r((0,te.dt)({blockhash:(0,te.Z_)(),lastValidBlockHeight:(0,te.Rx)()})),Vi=_r((0,te.O7)()),Gi=(0,te.dt)({slot:(0,te.Rx)(),numTransactions:(0,te.Rx)(),numSlots:(0,te.Rx)(),samplePeriodSecs:(0,te.Rx)()}),Zi=wr((0,te.IX)(Gi)),Xi=_r((0,te.AG)((0,te.dt)({feeCalculator:(0,te.dt)({lamportsPerSignature:(0,te.Rx)()})}))),Ji=wr((0,te.Z_)()),Qi=wr((0,te.Z_)()),to=(0,te.dt)({err:Pr,logs:(0,te.IX)((0,te.Z_)()),signature:(0,te.Z_)()}),eo=(0,te.dt)({result:vr(to),subscription:(0,te.Rx)()}),no={"solana-client":"js/0.0.0-development"};class ro{constructor(t,e){let n,r,i,o,s,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const t={};return async e=>{const{commitment:n,config:r}=gr(e),i=this._buildArgs([],n,void 0,r),o=er(i);return t[o]=t[o]??(async()=>{try{const t=await this._rpcRequest("getBlockHeight",i),e=(0,te.Ue)(t,wr((0,te.Rx)()));if("error"in e)throw new sr(e.error,"failed to get block height information");return e.result}finally{delete t[o]}})(),await t[o]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,n=e.wsEndpoint,r=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=n||function(t){const e=t.match(lr);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);const[n,r,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(t),this._rpcClient=function(t,e,n,r,i,o){const s=n||ar;let a;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(t,e)=>{const n=await new Promise(((n,i)=>{try{r(t,e,((t,e)=>n([t,e])))}catch(t){i(t)}}));return await s(...n)}),new(ne())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},no)};try{let e,n=5,u=500;for(;e=a?await a(t,o):await s(t,o),429===e.status&&!0!==i&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await Dn(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{})}(t,r,i,o,s,a),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new ur(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=await this._rpcRequest("getBalance",i),s=(0,te.Ue)(o,_r((0,te.Rx)()));if("error"in s)throw new sr(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=await this._rpcRequest("getBlockTime",[t]),n=(0,te.Ue)(e,wr((0,te.AG)((0,te.Rx)())));if("error"in n)throw new sr(n.error,`failed to get block time for slot ${t}`);return n.result}async getMinimumLedgerSlot(){const t=await this._rpcRequest("minimumLedgerSlot",[]),e=(0,te.Ue)(t,wr((0,te.Rx)()));if("error"in e)throw new sr(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const t=await this._rpcRequest("getFirstAvailableBlock",[]),e=(0,te.Ue)(t,Yr);if("error"in e)throw new sr(e.error,"failed to get first available block");return e.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=await this._rpcRequest("getSupply",[e]),r=(0,te.Ue)(n,Fr);if("error"in r)throw new sr(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenSupply",n),i=(0,te.Ue)(r,_r(Wr));if("error"in i)throw new sr(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenAccountBalance",n),i=(0,te.Ue)(r,_r(Wr));if("error"in i)throw new sr(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=gr(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=await this._rpcRequest("getTokenAccountsByOwner",s),u=(0,te.Ue)(a,Kr);if("error"in u)throw new sr(u.error,`failed to get token accounts owned by account ${t.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",i),s=(0,te.Ue)(o,Vr);if("error"in s)throw new sr(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=await this._rpcRequest("getLargestAccounts",n),i=(0,te.Ue)(r,Gr);if("error"in i)throw new sr(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenLargestAccounts",n),i=(0,te.Ue)(r,Hr);if("error"in i)throw new sr(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,te.Ue)(o,_r((0,te.AG)(Zr)));if("error"in s)throw new sr(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,te.Ue)(o,_r((0,te.AG)(Qr)));if("error"in s)throw new sr(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,te.Ue)(s,_r((0,te.IX)((0,te.AG)(Qr))));if("error"in a)throw new sr(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,te.Ue)(s,_r((0,te.IX)((0,te.AG)(Zr))));if("error"in a)throw new sr(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=gr(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),s=await this._rpcRequest("getStakeActivation",o),a=(0,te.Ue)(s,wr(ei));if("error"in a)throw new sr(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=gr(e),{encoding:i,...o}=r||{},s=this._buildArgs([t.toBase58()],n,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=(0,te.IX)(Xr),c=!0===o.withContext?(0,te.Ue)(a,_r(u)):(0,te.Ue)(a,wr(u));if("error"in c)throw new sr(c.error,`failed to get accounts owned by program ${t.toBase58()}`);return c.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getProgramAccounts",i),s=(0,te.Ue)(o,wr((0,te.IX)(ti)));if("error"in s)throw new sr(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{const e=t;if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);n=e.signature}try{r=Wt().decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}return mn(64===r.length,"signature has invalid length"),"string"==typeof t?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise(((e,n)=>{null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(()=>{n(t.reason)})))}))}getTransactionConfirmationPromise({commitment:t,signature:e}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,s)=>{try{n=this.onSignature(e,((t,e)=>{n=void 0;const r={context:e,value:t};o({__type:_n.PROCESSED,response:r})}),t);const a=new Promise((t=>{null==n?t():r=this._onSubscriptionStateChange(n,(e=>{"subscribed"===e&&t()}))}));(async()=>{if(await a,i)return;const n=await this.getSignatureStatus(e);if(i)return;if(null==n)return;const{context:r,value:u}=n;if(null!=u)if(u?.err)s(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,o({__type:_n.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((e=>{const r=async()=>{try{return await this.getBlockHeight(t)}catch(t){return-1}};(async()=>{let t=await r();if(!i){for(;t<=n;){if(await Dn(1e3),i)return;if(t=await r(),i)return}e({__type:_n.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:t,signature:r}),u=this.getCancellationPromise(e);let c;try{const t=await Promise.race([u,a,o]);if(t.__type!==_n.PROCESSED)throw new on(r);c=t.response}finally{i=!0,s()}return c}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let s=!1;const a=new Promise((e=>{let o=i,a=null;const u=async()=>{try{const{context:e,value:i}=await this.getNonceAndContext(r,{commitment:t,minContextSlot:n});return a=e.slot,i?.nonce}catch(t){return o}};(async()=>{if(o=await u(),!s)for(;;){if(i!==o)return void e({__type:_n.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await Dn(2e3),s)return;if(o=await u(),s)return}})()})),{abortConfirmation:u,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(e);let l;try{const e=await Promise.race([d,c,a]);if(e.__type===_n.PROCESSED)l=e.response;else{let r;for(;;){const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(e.slotInWhichNonceDidAdvance??n))){r=t;break}await Dn(400)}if(!r?.value)throw new an(o);{const e=t||"finalized",{confirmationStatus:n}=r.value;switch(e){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new an(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new an(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new an(o)}l={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,u()}return l}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let n;const r=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>e({__type:_n.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});let s;try{const t=await Promise.race([o,r]);if(t.__type!==_n.PROCESSED)throw new sn(e,t.timeoutMs/1e3);s=t.response}finally{clearTimeout(n),i()}return s}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),e=(0,te.Ue)(t,wr((0,te.IX)(fi)));if("error"in e)throw new sr(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getVoteAccounts",e),r=(0,te.Ue)(n,mi);if("error"in r)throw new sr(r.error,"failed to get vote accounts");return r.result}async getSlot(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlot",r),o=(0,te.Ue)(i,wr((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get slot");return o.result}async getSlotLeader(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlotLeader",r),o=(0,te.Ue)(i,wr((0,te.Z_)()));if("error"in o)throw new sr(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(t,e){const n=[t,e],r=await this._rpcRequest("getSlotLeaders",n),i=(0,te.Ue)(r,wr((0,te.IX)(hr)));if("error"in i)throw new sr(i.error,"failed to get slot leaders");return i.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);return mn(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=await this._rpcRequest("getSignatureStatuses",n),i=(0,te.Ue)(r,bi);if("error"in i)throw new sr(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getTransactionCount",r),o=(0,te.Ue)(i,wr((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get transaction count");return o.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getInflationGovernor",e),r=(0,te.Ue)(n,Dr);if("error"in r)throw new sr(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=gr(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:i?.epoch}),s=await this._rpcRequest("getInflationReward",o),a=(0,te.Ue)(s,Ar);if("error"in a)throw new sr(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){const t=await this._rpcRequest("getInflationRate",[]),e=(0,te.Ue)(t,Cr);if("error"in e)throw new sr(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getEpochInfo",r),o=(0,te.Ue)(i,zr);if("error"in o)throw new sr(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){const t=await this._rpcRequest("getEpochSchedule",[]),e=(0,te.Ue)(t,Ur);if("error"in e)throw new sr(e.error,"failed to get epoch schedule");const n=e.result;return new rr(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),e=(0,te.Ue)(t,jr);if("error"in e)throw new sr(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getMinimumBalanceForRentExemption",n),i=(0,te.Ue)(r,wi);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getRecentBlockhash",e),r=(0,te.Ue)(n,Ki);if("error"in r)throw new sr(r.error,"failed to get recent blockhash");return r.result}async getRecentPerformanceSamples(t){const e=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),n=(0,te.Ue)(e,Zi);if("error"in n)throw new sr(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getFeeCalculatorForBlockhash",n),i=(0,te.Ue)(r,Xi);if("error"in i)throw new sr(i.error,"failed to get fee calculator");const{context:o,value:s}=i.result;return{context:o,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){const n=Fe(t.serialize()).toString("base64"),r=this._buildArgs([n],e),i=await this._rpcRequest("getFeeForMessage",r),o=(0,te.Ue)(i,_r((0,te.AG)((0,te.Rx)())));if("error"in o)throw new sr(o.error,"failed to get fee for message");if(null===o.result)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(t){const e=t?.lockedWritableAccounts?.map((t=>t.toBase58())),n=e?.length?[e]:[],r=await this._rpcRequest("getRecentPrioritizationFees",n),i=(0,te.Ue)(r,Nr);if("error"in i)throw new sr(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getLatestBlockhash",r),o=(0,te.Ue)(i,qi);if("error"in o)throw new sr(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgs([t],n,void 0,r),o=await this._rpcRequest("isBlockhashValid",i),s=(0,te.Ue)(o,Vi);if("error"in s)throw new sr(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){const t=await this._rpcRequest("getVersion",[]),e=(0,te.Ue)(t,wr($r));if("error"in e)throw new sr(e.error,"failed to get version");return e.result}async getGenesisHash(){const t=await this._rpcRequest("getGenesisHash",[]),e=(0,te.Ue)(t,wr((0,te.Z_)()));if("error"in e)throw new sr(e.error,"failed to get genesis hash");return e.result}async getBlock(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,te.Ue)(o,Ni);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,te.Ue)(o,Ci);if("error"in t)throw t.error;return t.result}default:{const t=(0,te.Ue)(o,Di);if("error"in t)throw t.error;const{result:e}=t;return e?{...e,transactions:e.transactions.map((({transaction:t,meta:e,version:n})=>({meta:e,transaction:{...t,message:kr(n,t.message)},version:n})))}:null}}}catch(t){throw new sr(t,"failed to get confirmed block")}}async getParsedBlock(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,te.Ue)(o,Ui);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,te.Ue)(o,ji);if("error"in t)throw t.error;return t.result}default:{const t=(0,te.Ue)(o,zi);if("error"in t)throw t.error;return t.result}}}catch(t){throw new sr(t,"failed to get block")}}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=await this._rpcRequest("getBlockProduction",r),o=(0,te.Ue)(i,Or);if("error"in o)throw new sr(o.error,"failed to get block production information");return o.result}async getTransaction(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getTransaction",i),s=(0,te.Ue)(o,Wi);if("error"in s)throw new sr(s.error,"failed to get transaction");const a=s.result;return a?{...a,transaction:{...a.transaction,message:kr(a.version,a.transaction.message)}}:a}async getParsedTransaction(t,e){const{commitment:n,config:r}=gr(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getTransaction",i),s=(0,te.Ue)(o,Hi);if("error"in s)throw new sr(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,te.Ue)(t,Hi);if("error"in e)throw new sr(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const{commitment:n,config:r}=gr(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,te.Ue)(t,Wi);if("error"in e)throw new sr(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:kr(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,te.Ue)(r,Yi);if("error"in i)throw new sr(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");const s={...o,transactions:o.transactions.map((({transaction:t,meta:e})=>{const n=new yn(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...s,transactions:s.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:Mn.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=await this._rpcRequest("getBlocks",r),o=(0,te.Ue)(i,wr((0,te.IX)((0,te.Rx)())));if("error"in o)throw new sr(o.error,"failed to get blocks");return o.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),i=(0,te.Ue)(r,Fi);if("error"in i)throw new sr(i.error,"failed to get block");const o=i.result;if(!o)throw new Error("Block "+t+" not found");return o}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,te.Ue)(r,Fi);if("error"in i)throw new sr(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");return o}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,te.Ue)(r,Wi);if("error"in i)throw new sr(i.error,"failed to get transaction");const o=i.result;if(!o)return o;const s=new yn(o.transaction.message),a=o.transaction.signatures;return{...o,transaction:Mn.populate(s,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,te.Ue)(r,Hi);if("error"in i)throw new sr(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=(0,te.Ue)(t,Hi);if("error"in e)throw new sr(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getConfirmedSignaturesForAddress2",r),o=(0,te.Ue)(i,ni);if("error"in o)throw new sr(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getSignaturesForAddress",r),o=(0,te.Ue)(i,ri);if("error"in o)throw new sr(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=new cr({key:t,state:cr.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=Yn.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),r=(0,te.Ue)(n,Ji);if("error"in r)throw new sr(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await Dn(100);const t=Date.now()-this._blockhashInfo.lastFetch>=mr;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await Dn(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:e,config:n}=gr(t),r=this._buildArgs([],e,"base64",n),i=await this._rpcRequest("getStakeMinimumDelegation",r),o=(0,te.Ue)(i,_r((0,te.Rx)()));if("error"in o)throw new sr(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(t,e,n){if("message"in t){const r=t.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(e)||void 0!==n)throw new Error("Invalid arguments");const s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment);const a=[o,s],u=await this._rpcRequest("simulateTransaction",a),c=(0,te.Ue)(u,Rr);if("error"in c)throw new Error("failed to simulate transaction: "+c.error.message);return c.result}let r;if(t instanceof Mn){let e=t;r=new Mn,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=Mn.populate(t),r._message=r._json=void 0;if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid arguments");const o=e;if(r.nonceInfo&&o)r.sign(...o);else{let t=this._disableBlockhashCaching;for(;;){const e=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=e.lastValidBlockHeight,r.recentBlockhash=e.blockhash,!o)break;if(r.sign(...o),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}t=!0}}const s=r._compile(),a=s.serialize(),u=r._serialize(a).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:s.nonProgramIds()).map((t=>t.toBase58()));c.accounts={encoding:"base64",addresses:t}}o&&(c.sigVerify=!0);const d=[u,c],l=await this._rpcRequest("simulateTransaction",d),h=(0,te.Ue)(l,Rr);if("error"in h){let t;if("data"in h.error&&(t=h.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(h.error.message,n)}throw new ir("failed to simulate transaction: "+h.error.message,t)}return h.result}async sendTransaction(t,e,n){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const n=t.serialize();return await this.sendRawTransaction(n,e)}if(void 0===e||!Array.isArray(e))throw new Error("Invalid arguments");const r=e;if(t.nonceInfo)t.sign(...r);else{let e=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(e);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...r),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}e=!0}}const i=t.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(t,e){const n=Fe(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],s=await this._rpcRequest("sendTransaction",o),a=(0,te.Ue)(s,Qi);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new ir("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(t,e){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,n!==e.state){const n=this._subscriptionStateChangeCallbacksByHash[t];n&&n.forEach((t=>{try{t(e.state)}catch{}}))}}_onSubscriptionStateChange(t,e){const n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(e),()=>{r.delete(e),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const e=await this._rpcWebSocket.call(i,r);this._setSubscription(t,{...n,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,ii);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=er([t.method,e],!0),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];mn(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,si);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,eo);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,ui);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,di);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,li);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),s=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=(0,te.Ue)(t,hi);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class io{constructor(t){this._keypair=void 0,this._keypair=t??Ne()}static generate(){return new io(Ne())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=ze(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new io({publicKey:n,secretKey:t})}static fromSeed(t){const e=ze(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new io({publicKey:e,secretKey:n})}get publicKey(){return new Je(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const oo=Object.freeze({CreateLookupTable:{index:0,layout:Jt.struct([Jt.u32("instruction"),Fn("recentSlot"),Jt.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Jt.struct([Jt.u32("instruction")])},ExtendLookupTable:{index:2,layout:Jt.struct([Jt.u32("instruction"),Fn(),Jt.seq(cn(),Jt.offset(Jt.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Jt.struct([Jt.u32("instruction")])},CloseLookupTable:{index:4,layout:Jt.struct([Jt.u32("instruction")])}});class so{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(oo))if(r.index==e){n=t;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);const{recentSlot:e}=Nn(oo.CreateLookupTable,t.data);return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error(`invalid instruction; found ${t.keys.length} keys, expected at least 2`);const{addresses:e}=Nn(oo.ExtendLookupTable,t.data);return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((t=>new Je(t)))}}static decodeCloseLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}static decodeFreezeLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static decodeDeactivateLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(ao.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(t,e){if(t.lengtht.toBytes()))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Kn.programId,isSigner:!1,isWritable:!1}),new kn({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=Cn(oo.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new kn({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=Cn(oo.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new kn({programId:this.programId,keys:n,data:e})}}ao.programId=new Je("AddressLookupTab1e1111111111111111111111111");class uo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u8("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(co))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=Nn(co.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=Nn(co.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=Nn(co.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=Nn(co.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(lo.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const co=Object.freeze({RequestUnits:{index:0,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("units"),Jt.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Jt.struct([Jt.u8("instruction"),Jt.u32("units")])},SetComputeUnitPrice:{index:3,layout:Jt.struct([Jt.u8("instruction"),Fn("microLamports")])}});class lo{constructor(){}static requestUnits(t){const e=Cn(co.RequestUnits,t);return new kn({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=Cn(co.RequestHeapFrame,t);return new kn({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=Cn(co.SetComputeUnitLimit,t);return new kn({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=Cn(co.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new kn({keys:[],programId:this.programId,data:e})}}lo.programId=new Je("ComputeBudget111111111111111111111111111111");const ho=Jt.struct([Jt.u8("numSignatures"),Jt.u8("padding"),Jt.u16("signatureOffset"),Jt.u16("signatureInstructionIndex"),Jt.u16("publicKeyOffset"),Jt.u16("publicKeyInstructionIndex"),Jt.u16("messageDataOffset"),Jt.u16("messageDataSize"),Jt.u16("messageInstructionIndex")]);class fo{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:o}=t;mn(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),mn(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const s=ho.span,a=s+e.length,u=a+r.length,c=i.Buffer.alloc(u+n.length),d=null==o?65535:o;return ho.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,s),c.fill(r,a),c.fill(n,u),new kn({keys:[],programId:fo.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;mn(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=io.fromSecretKey(e),i=t.publicKey.toBytes(),o=je(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}fo.programId=new Je("Ed25519SigVerify111111111111111111111111111"),De.utils.isValidPrivateKey;const po=De.getPublicKey,mo=Jt.struct([Jt.u8("numSignatures"),Jt.u16("signatureOffset"),Jt.u8("signatureInstructionIndex"),Jt.u16("ethAddressOffset"),Jt.u8("ethAddressInstructionIndex"),Jt.u16("messageDataOffset"),Jt.u16("messageDataSize"),Jt.u8("messageInstructionIndex"),Jt.blob(20,"ethAddress"),Jt.blob(64,"signature"),Jt.u8("recoveryId")]);class go{constructor(){}static publicKeyToEthAddress(t){mn(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return i.Buffer.from(we(Fe(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return go.createInstructionWithEthAddress({ethAddress:go.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:o,instructionIndex:s=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?i.Buffer.from(e.substr(2),"hex"):i.Buffer.from(e,"hex"):e,mn(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,c=u+r.length+1,d=i.Buffer.alloc(mo.span+n.length);return mo.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:s,signature:Fe(r),ethAddress:Fe(a),recoveryId:o},d),d.fill(Fe(n),mo.span),new kn({keys:[],programId:go.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;mn(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=Fe(e),o=po(t,!1).slice(1),s=i.Buffer.from(we(Fe(n))),[a,u]=((t,e)=>{const n=De.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(s,t);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var yo;go.programId=new Je("KeccakSecp256k11111111111111111111111111111");const bo=new Je("StakeConfig11111111111111111111111111111111");class wo{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class _o{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}yo=_o,_o.default=new yo(0,0,Je.default);class vo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ko))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=Nn(ko.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new wo(new Je(e.staker),new Je(e.withdrawer)),lockup:new _o(n.unixTimestamp,n.epoch,new Je(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),Nn(ko.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=Nn(ko.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Je(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Nn(ko.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new Je(i),newAuthorizedPubkey:new Je(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Nn(ko.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(ko.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Nn(ko.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Nn(ko.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(Ao.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.lengthJt.struct([cn("staker"),cn("withdrawer")],t))(),((t="lockup")=>Jt.struct([Jt.ns64("unixTimestamp"),Jt.ns64("epoch"),cn("custodian")],t))()])},Authorize:{index:1,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:Jt.struct([Jt.u32("instruction")])},Split:{index:3,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},Withdraw:{index:4,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},Deactivate:{index:5,layout:Jt.struct([Jt.u32("instruction")])},Merge:{index:7,layout:Jt.struct([Jt.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("stakeAuthorizationType"),ln("authoritySeed"),cn("authorityOwner")])}}),Mo=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Ao{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||_o.default,o=Cn(ko.Initialize,{authorized:{staker:Fe(n.staker.toBuffer()),withdrawer:Fe(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Fe(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new kn(s)}static createAccountWithSeed(t){const e=new Mn;e.add(Kn.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new Mn;e.add(Kn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=Cn(ko.Delegate);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:bo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=Cn(ko.Authorize,{newAuthorized:Fe(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=Cn(ko.AuthorizeWithSeed,{newAuthorized:Fe(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:Fe(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new Mn).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=Cn(ko.Split,{lamports:i});return new kn({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new Mn;return e.add(Kn.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:s}=t,a=new Mn;return a.add(Kn.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),a.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:s}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=Cn(ko.Merge);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=Cn(ko.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:Rn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=Cn(ko.Deactivate);return(new Mn).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}Ao.programId=new Je("Stake11111111111111111111111111111111111111"),Ao.space=200;class So{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}class Io{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Jt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(xo))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=Nn(xo.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new So(new Je(e.nodePubkey),new Je(e.authorizedVoter),new Je(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=Nn(xo.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Je(e),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:e,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Nn(xo.AuthorizeWithSeed,t.data);return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new Je(e),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new Je(r),voteAuthorizationType:{index:i},votePubkey:t.keys[0].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Nn(xo.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(To.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.lengthJt.struct([cn("nodePubkey"),cn("authorizedVoter"),cn("authorizedWithdrawer"),Jt.u8("commission")],t))()])},Authorize:{index:1,layout:Jt.struct([Jt.u32("instruction"),cn("newAuthorized"),Jt.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:Jt.struct([Jt.u32("instruction"),Jt.ns64("lamports")])},AuthorizeWithSeed:{index:10,layout:Jt.struct([Jt.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>Jt.struct([Jt.u32("voteAuthorizationType"),cn("currentAuthorityDerivedKeyOwnerPubkey"),ln("currentAuthorityDerivedKeySeed"),cn("newAuthorized")],t))()])}}),Eo=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class To{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=Cn(xo.InitializeAccount,{voteInit:{nodePubkey:Fe(r.nodePubkey.toBuffer()),authorizedVoter:Fe(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Fe(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Pn,isSigner:!1,isWritable:!1},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new kn(o)}static createAccount(t){const e=new Mn;return e.add(Kn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=Cn(xo.Authorize,{newAuthorized:Fe(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=Cn(xo.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Fe(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Fe(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:In,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=Cn(xo.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return To.withdraw(t)}}To.programId=new Je("Vote111111111111111111111111111111111111111"),To.space=3731;const Po=new Je("Va1idator1nfo111111111111111111111111111111"),Bo=(0,te.dt)({name:(0,te.Z_)(),website:(0,te.jt)((0,te.Z_)()),details:(0,te.jt)((0,te.Z_)()),keybaseUsername:(0,te.jt)((0,te.Z_)())});class Lo{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==fn(e))return null;const n=[];for(let t=0;t<2;t++){const t=new Je(e.slice(0,Ze));e=e.slice(Ze);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(Po)&&n[1].isSigner){const t=ln().decode(i.Buffer.from(e)),r=JSON.parse(t);return(0,te.hu)(r,Bo),new Lo(n[1].publicKey,r)}return null}}const $o=new Je("Vote111111111111111111111111111111111111111"),Ro=Jt.struct([cn("nodePubkey"),cn("authorizedWithdrawer"),Jt.u8("commission"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("slot"),Jt.u32("confirmationCount")]),Jt.offset(Jt.u32(),-8),"votes"),Jt.u8("rootSlotValid"),Jt.nu64("rootSlot"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("epoch"),cn("authorizedVoter")]),Jt.offset(Jt.u32(),-8),"authorizedVoters"),Jt.struct([Jt.seq(Jt.struct([cn("authorizedPubkey"),Jt.nu64("epochOfLastAuthorizedSwitch"),Jt.nu64("targetEpoch")]),32,"buf"),Jt.nu64("idx"),Jt.u8("isEmpty")],"priorVoters"),Jt.nu64(),Jt.seq(Jt.struct([Jt.nu64("epoch"),Jt.nu64("credits"),Jt.nu64("prevCredits")]),Jt.offset(Jt.u32(),-8),"epochCredits"),Jt.struct([Jt.nu64("slot"),Jt.nu64("timestamp")],"lastTimestamp")]);class Oo{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=Ro.decode(Fe(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Oo({nodePubkey:new Je(e.nodePubkey),authorizedWithdrawer:new Je(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(Do),priorVoters:No(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function Do({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new Je(t)}}function Co({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new Je(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function No({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(Co),...t.slice(0,e).map(Co)]}const zo={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Uo(t,e){const n=!1===e?"http":"https";if(!t)return zo[n].devnet;const r=zo[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r}async function jo(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await t.sendRawTransaction(e,s),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(a,u),d=(await c).value;if(d.err)throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`);return a}const Yo=1e9},54654:(t,e,n)=>{"use strict";var r=n(48764).Buffer,i=n(64836);e.Z=void 0;var o=i(n(64687)),s=i(n(17156)),a=i(n(18698)),u=i(n(56690)),c=i(n(89728)),d=i(n(61655)),l=i(n(94993)),h=i(n(73808)),f=n(26729),p=n(77758);var m=function(t){(0,d.default)(b,t);var e,n,i,f,m,g,y=(m=b,g=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=(0,h.default)(m);if(g){var n=(0,h.default)(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return(0,l.default)(this,t)});function b(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;(0,u.default)(this,b);var s=r.autoconnect,a=void 0===s||s,c=r.reconnect,d=void 0===c||c,l=r.reconnect_interval,h=void 0===l?1e3:l,f=r.max_reconnects,m=void 0===f?5:f,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);in.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),b}(f.EventEmitter);e.Z=m},31991:(t,e,n)=>{"use strict";var r=n(64836);e.Z=function(t,e){return new c(t,e)};var i=r(n(56690)),o=r(n(89728)),s=r(n(61655)),a=r(n(94993)),u=r(n(73808));var c=function(t){(0,s.default)(c,t);var e,n,r=(e=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=(0,u.default)(e);if(n){var i=(0,u.default)(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return(0,a.default)(this,t)});function c(t,e,n){var o;return(0,i.default)(this,c),(o=r.call(this)).socket=new window.WebSocket(t,n),o.socket.onopen=function(){return o.emit("open")},o.socket.onmessage=function(t){return o.emit("message",t.data)},o.socket.onerror=function(t){return o.emit("error",t)},o.socket.onclose=function(t){o.emit("close",t.code,t.reason)},o}return(0,o.default)(c,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),c}(n(26729).EventEmitter)},77758:(t,e,n)=>{"use strict";var r=n(64836);Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDataPack=void 0,e.createError=function(t,e){var n={code:t,message:s.get(t)||"Internal Server Error"};return e&&(n.data=e),n};var i=r(n(56690)),o=r(n(89728)),s=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),a=function(){function t(){(0,i.default)(this,t)}return(0,o.default)(t,[{key:"encode",value:function(t){return JSON.stringify(t)}},{key:"decode",value:function(t){return JSON.parse(t)}}]),t}();e.DefaultDataPack=a},39386:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.s16=e.s8=e.nu64be=e.u48be=e.u40be=e.u32be=e.u24be=e.u16be=e.nu64=e.u48=e.u40=e.u32=e.u24=e.u16=e.u8=e.offset=e.greedy=e.Constant=e.UTF8=e.CString=e.Blob=e.Boolean=e.BitField=e.BitStructure=e.VariantLayout=e.Union=e.UnionLayoutDiscriminator=e.UnionDiscriminator=e.Structure=e.Sequence=e.DoubleBE=e.Double=e.FloatBE=e.Float=e.NearInt64BE=e.NearInt64=e.NearUInt64BE=e.NearUInt64=e.IntBE=e.Int=e.UIntBE=e.UInt=e.OffsetLayout=e.GreedyCount=e.ExternalLayout=e.bindConstructorLayout=e.nameWithProperty=e.Layout=e.uint8ArrayToBuffer=e.checkUint8Array=void 0,e.constant=e.utf8=e.cstr=e.blob=e.unionLayoutDiscriminator=e.union=e.seq=e.bits=e.struct=e.f64be=e.f64=e.f32be=e.f32=e.ns64be=e.s48be=e.s40be=e.s32be=e.s24be=e.s16be=e.ns64=e.s48=e.s40=e.s32=e.s24=void 0;const r=n(48764);function i(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function o(t){return i(t),r.Buffer.from(t.buffer,t.byteOffset,t.length)}e.checkUint8Array=i,e.uint8ArrayToBuffer=o;class s{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function a(t,e){return e.property?t+"["+e.property+"]":t}e.Layout=s,e.nameWithProperty=a,e.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof s))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,n)=>e.decode(t,n),writable:!0})};class u extends s{isCount(){throw new Error("ExternalLayout is abstract")}}e.ExternalLayout=u;class c extends u{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){i(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}e.GreedyCount=c;class d extends u{constructor(t,e=0,n){if(!(t instanceof s))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof l||this.layout instanceof h}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}e.OffsetLayout=d;class l extends s{constructor(t,e){if(super(t,e),6t+r.encode(i,e,n+t)),0);return this.count instanceof u&&this.count.encode(t.length,e,n),i}}e.Sequence=I;class x extends s{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof s),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e=0){i(t);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}e.Structure=x;class E{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}e.UnionDiscriminator=E;class T extends E{constructor(t,e){if(!(t instanceof u&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}e.UnionLayoutDiscriminator=T;class P extends s{constructor(t,e,n){let r;if(t instanceof l||t instanceof h)r=new T(new d(t));else if(t instanceof u&&t.isCount())r=new T(t);else{if(!(t instanceof E))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");r=t}if(void 0===e&&(e=null),!(null===e||e instanceof s))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof l||t instanceof h)&&(i+=r.layout.span)),super(i,n),this.discriminator=r,this.usesPrefixDiscriminator=t instanceof l||t instanceof h,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const r=this.discriminator,i=r.decode(t,e),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=o.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n=0){const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new B(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}e.Union=P;class B extends s{constructor(t,e,n,r){if(!(t instanceof P))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof s))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let r=0;return this.layout&&(r=this.layout.getSpan(t,e+n)),n+r}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function L(t){return 0>t&&(t+=4294967296),t}e.VariantLayout=B;class $ extends s{constructor(t,e,n){if(!(t instanceof l||t instanceof h))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==L(t&this.valueMask))throw new TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=L(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),o(t).slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof u&&(r=t.length),!(t instanceof Uint8Array&&r===t.length))throw new TypeError(a("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>e.length)throw new RangeError("encoding overruns Uint8Array");const i=o(t);return o(e).write(i.toString("hex"),n,r,"hex"),this.length instanceof u&&this.length.encode(r,e,n),r}}e.Blob=D;class C extends s{constructor(t){super(-1,t)}getSpan(t,e=0){i(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const a=o(e);return i.copy(a,n),a[n+s]=0,s+1}}e.CString=C;class N extends s{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return i(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return i.copy(o(e),n),s}}e.UTF8=N;class z extends s{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}e.Constant=z,e.greedy=(t,e)=>new c(t,e),e.offset=(t,e,n)=>new d(t,e,n),e.u8=t=>new l(1,t),e.u16=t=>new l(2,t),e.u24=t=>new l(3,t),e.u32=t=>new l(4,t),e.u40=t=>new l(5,t),e.u48=t=>new l(6,t),e.nu64=t=>new b(t),e.u16be=t=>new h(2,t),e.u24be=t=>new h(3,t),e.u32be=t=>new h(4,t),e.u40be=t=>new h(5,t),e.u48be=t=>new h(6,t),e.nu64be=t=>new w(t),e.s8=t=>new f(1,t),e.s16=t=>new f(2,t),e.s24=t=>new f(3,t),e.s32=t=>new f(4,t),e.s40=t=>new f(5,t),e.s48=t=>new f(6,t),e.ns64=t=>new _(t),e.s16be=t=>new p(2,t),e.s24be=t=>new p(3,t),e.s32be=t=>new p(4,t),e.s40be=t=>new p(5,t),e.s48be=t=>new p(6,t),e.ns64be=t=>new v(t),e.f32=t=>new k(t),e.f32be=t=>new M(t),e.f64=t=>new A(t),e.f64be=t=>new S(t),e.struct=(t,e,n)=>new x(t,e,n),e.bits=(t,e,n)=>new $(t,e,n),e.seq=(t,e,n)=>new I(t,e,n),e.union=(t,e,n)=>new P(t,e,n),e.unionLayoutDiscriminator=(t,e)=>new T(t,e),e.blob=(t,e)=>new D(t,e),e.cstr=t=>new C(t),e.utf8=(t,e)=>new N(t,e),e.constant=(t,e)=>new z(t,e)},18245:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Account:()=>Oe,AddressLookupTableAccount:()=>Vn,AddressLookupTableInstruction:()=>Hi,AddressLookupTableProgram:()=>Ki,Authorized:()=>ro,BLOCKHASH_CACHE_TIMEOUT_MS:()=>tr,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>De,BPF_LOADER_PROGRAM_ID:()=>Rn,BpfLoader:()=>On,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>Vi,ComputeBudgetInstruction:()=>qi,ComputeBudgetProgram:()=>Gi,Connection:()=>Yi,Ed25519Program:()=>Xi,Enum:()=>Ee,EpochSchedule:()=>Yn,FeeCalculatorLayout:()=>An,Keypair:()=>Fi,LAMPORTS_PER_SOL:()=>xo,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>Wi,Loader:()=>$n,Lockup:()=>io,MAX_SEED_LENGTH:()=>Be,Message:()=>en,MessageAccountKeys:()=>Fe,MessageV0:()=>nn,NONCE_ACCOUNT_LENGTH:()=>In,NonceAccount:()=>xn,PACKET_DATA_SIZE:()=>Ce,PUBLIC_KEY_LENGTH:()=>Le,PublicKey:()=>Re,SIGNATURE_LENGTH_IN_BYTES:()=>ze,SOLANA_SCHEMA:()=>Te,STAKE_CONFIG_ID:()=>no,STAKE_INSTRUCTION_LAYOUTS:()=>so,SYSTEM_INSTRUCTION_LAYOUTS:()=>Pn,SYSVAR_CLOCK_PUBKEY:()=>ln,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>hn,SYSVAR_INSTRUCTIONS_PUBKEY:()=>fn,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>pn,SYSVAR_RENT_PUBKEY:()=>mn,SYSVAR_REWARDS_PUBKEY:()=>gn,SYSVAR_SLOT_HASHES_PUBKEY:()=>yn,SYSVAR_SLOT_HISTORY_PUBKEY:()=>bn,SYSVAR_STAKE_HISTORY_PUBKEY:()=>wn,Secp256k1Program:()=>to,SendTransactionError:()=>Fn,SolanaJSONRPCError:()=>Hn,SolanaJSONRPCErrorCode:()=>Wn,StakeAuthorizationLayout:()=>ao,StakeInstruction:()=>oo,StakeProgram:()=>uo,Struct:()=>xe,SystemInstruction:()=>Tn,SystemProgram:()=>Bn,Transaction:()=>un,TransactionExpiredBlockheightExceededError:()=>Ue,TransactionExpiredNonceInvalidError:()=>Ye,TransactionExpiredTimeoutError:()=>je,TransactionInstruction:()=>an,TransactionMessage:()=>cn,TransactionStatus:()=>on,VALIDATOR_INFO_KEY:()=>mo,VERSION_PREFIX_MASK:()=>Ne,VOTE_PROGRAM_ID:()=>bo,ValidatorInfo:()=>yo,VersionedMessage:()=>rn,VersionedTransaction:()=>dn,VoteAccount:()=>_o,VoteAuthorizationLayout:()=>fo,VoteInit:()=>co,VoteInstruction:()=>lo,VoteProgram:()=>po,clusterApiUrl:()=>So,sendAndConfirmRawTransaction:()=>Io,sendAndConfirmTransaction:()=>_n});var r={};n.r(r),n.d(r,{gk:()=>S,dQ:()=>N,ci:()=>x,bytesToNumberBE:()=>L,ty:()=>$,eV:()=>C,n$:()=>j,ql:()=>D,hexToBytes:()=>B,_t:()=>A,tL:()=>R,S5:()=>O,FF:()=>F});var i=n(48764),o=n(4359);const s=BigInt(2**32-1),a=BigInt(32);function u(t,e=!1){return e?{h:Number(t&s),l:Number(t>>a&s)}:{h:0|Number(t>>a&s),l:0|Number(t&s)}}function c(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;it<>>32-n,l=(t,e,n)=>e<>>32-n,h=(t,e,n)=>e<>>64-n,f=(t,e,n)=>t<>>64-n,p={fromBig:u,split:c,toBig:(t,e)=>BigInt(t>>>0)<>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:d,rotlSL:l,rotlBH:h,rotlBL:f,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)};var m=n(23486);const[g,y]=(()=>p.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),b=new Uint32Array(80),w=new Uint32Array(80);class _ extends o.VR{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m]}set(t,e,n,r,i,o,s,a,u,c,d,l,h,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let n=0;n<16;n++,e+=4)b[n]=t.getUint32(e),w[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|b[t-15],n=0|w[t-15],r=p.rotrSH(e,n,1)^p.rotrSH(e,n,8)^p.shrSH(e,n,7),i=p.rotrSL(e,n,1)^p.rotrSL(e,n,8)^p.shrSL(e,n,7),o=0|b[t-2],s=0|w[t-2],a=p.rotrSH(o,s,19)^p.rotrBH(o,s,61)^p.shrSH(o,s,6),u=p.rotrSL(o,s,19)^p.rotrBL(o,s,61)^p.shrSL(o,s,6),c=p.add4L(i,u,w[t-7],w[t-16]),d=p.add4H(c,r,a,b[t-7],b[t-16]);b[t]=0|d,w[t]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:m,Gl:_,Hh:v,Hl:k}=this;for(let t=0;t<80;t++){const e=p.rotrSH(d,l,14)^p.rotrSH(d,l,18)^p.rotrBH(d,l,41),M=p.rotrSL(d,l,14)^p.rotrSL(d,l,18)^p.rotrBL(d,l,41),A=d&h^~d&m,S=l&f^~l&_,I=p.add5L(k,M,S,y[t],w[t]),x=p.add5H(I,v,e,A,g[t],b[t]),E=0|I,T=p.rotrSH(n,r,28)^p.rotrBH(n,r,34)^p.rotrBH(n,r,39),P=p.rotrSL(n,r,28)^p.rotrBL(n,r,34)^p.rotrBL(n,r,39),B=n&i^n&s^i&s,L=r&o^r&a^o&a;v=0|m,k=0|_,m=0|h,_=0|f,h=0|d,f=0|l,({h:d,l}=p.add(0|u,0|c,0|x,0|E)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const $=p.add3L(E,P,L);n=p.add3H($,x,T,B),r=0|$}({h:n,l:r}=p.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=p.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=p.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=p.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l}=p.add(0|this.Eh,0|this.El,0|d,0|l)),({h,l:f}=p.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:m,l:_}=p.add(0|this.Gh,0|this.Gl,0|m,0|_)),({h:v,l:k}=p.add(0|this.Hh,0|this.Hl,0|v,0|k)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,m,_,v,k)}roundClean(){b.fill(0),w.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const v=(0,m.hE)((()=>new _)),k=(BigInt(0),BigInt(1)),M=BigInt(2);function A(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}function S(t){if(!A(t))throw new Error("Uint8Array expected")}const I=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function x(t){S(t);let e="";for(let n=0;n=T._0&&t<=T._9?t-T._0:t>=T._A&&t<=T._F?t-(T._A-10):t>=T._a&&t<=T._f?t-(T._a-10):void 0}function B(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e(M<new Uint8Array(t),U=t=>Uint8Array.from(t);function j(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=z(t),i=z(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...t)=>n(i,r,...t),u=(t=z())=>{i=a(U([0]),t),r=a(),0!==t.length&&(i=a(U([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(s(),u(t);!(n=e(c()));)u();return s(),n}}const Y={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||A(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function F(t,e,n={}){const r=(e,n,r)=>{const i=Y[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const W=BigInt(0),H=BigInt(1),K=BigInt(2),q=BigInt(3),V=BigInt(4),G=BigInt(5),Z=BigInt(8);function X(t,e){const n=t%e;return n>=W?n:e+n}function J(t,e,n){if(n<=W||e 0");if(n===H)return W;let r=H;for(;e>W;)e&H&&(r=r*t%n),t=t*t%n,e>>=H;return r}function Q(t,e,n){let r=t;for(;e-- >W;)r*=r,r%=n;return r}function tt(t,e){if(t===W||e<=W)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=X(t,e),r=e,i=W,o=H,s=H,a=W;for(;n!==W;){const t=r/n,e=r%n,u=i-s*t,c=o-a*t;r=n,n=e,i=s,o=a,s=u,a=c}if(r!==H)throw new Error("invert: does not exist");return X(i,e)}BigInt(9),BigInt(16);const et=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function nt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function rt(t,e,n=!1,r={}){if(t<=W)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=nt(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(t){if(t%V===q){const e=(t+H)/V;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%Z===G){const e=(t-G)/Z;return function(t,n){const r=t.mul(n,K),i=t.pow(r,e),o=t.mul(n,i),s=t.mul(t.mul(o,K),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-H)/K;let n,r,i;for(n=t-H,r=0;n%K===W;n/=K,r++);for(i=K;iX(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return W<=e&&et===W,isOdd:t=>(t&H)===H,neg:e=>X(-e,t),eql:(t,e)=>t===e,sqr:e=>X(e*e,t),add:(e,n)=>X(e+n,t),sub:(e,n)=>X(e-n,t),mul:(e,n)=>X(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===W)return t.ONE;if(n===H)return e;let r=t.ONE,i=e;for(;n>W;)n&H&&(r=t.mul(r,i)),i=t.sqr(i),n>>=H;return r}(a,t,e),div:(e,n)=>X(e*tt(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>tt(e,t),sqrt:r.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r))),t.ONE),i=t.inv(r);return e.reduceRight(((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r))),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?O(t,o):R(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?$(t):L(t)}});return Object.freeze(a)}function it(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function ot(t){const e=it(t);return e+Math.ceil(e/2)}const st=BigInt(0),at=BigInt(1);function ut(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>st;)n&at&&(r=r.add(i)),i=i.double(),n>>=at;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),o=[];let s=t,a=s;for(let t=0;t>=h,r>a&&(r-=l,o+=at);const s=e,f=e+Math.abs(r)-1,p=t%2!=0,m=r<0;0===r?c=c.add(n(p,i[s])):u=u.add(n(m,i[f]))}return{p:u,f:c}},wNAFCached(t,e,n,r){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,r(o))),this.wNAF(i,o,n)}}}function ct(t){return F(t.Fp,et.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),F(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const dt=BigInt(0),lt=BigInt(1),ht=BigInt(2),ft=BigInt(8),pt={zip215:!0};function mt(t){const e=function(t){const e=ct(t);return F(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=ht<{try{return{isValid:!0,value:n.sqrt(t*n.inv(e))}}catch(t){return{isValid:!1,value:dt}}}),h=e.adjustScalarBytes||(t=>t),f=e.domain||((t,e,n)=>{if(e.length||n)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&dtp(t)&&p(e)&&tt===dt||m(t,c);function y(t,e){if(m(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===dt?t:y(t,r)}const w=new Map;function _(t){if(!(t instanceof v))throw new Error("ExtendedPoint expected")}class v{constructor(t,e,n,r){if(this.ex=t,this.ey=e,this.ez=n,this.et=r,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(n))throw new Error("z required");if(!g(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof v)throw new Error("extended point not allowed");const{x:e,y:n}=t||{};if(!g(e)||!g(n))throw new Error("invalid affine point");return new v(e,n,lt,d(e*n))}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.ez)));return t.map(((t,n)=>t.toAffine(e[n]))).map(v.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}assertValidity(){const{a:t,d:n}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=d(r*r),u=d(i*i),c=d(o*o),l=d(c*c),h=d(a*t);if(d(c*d(h+u))!==d(l+d(n*d(a*u))))throw new Error("bad point: equation left != right (1)");if(d(r*i)!==d(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){_(t);const{ex:e,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=t,a=d(e*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:t}=e,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(ht*d(i*i)),u=d(t*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,m=d(l*f),g=d(h*p),y=d(l*p),b=d(f*h);return new v(m,g,b,y)}add(t){_(t);const{a:n,d:r}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=t;if(n===BigInt(-1)){const t=d((o-i)*(c+u)),e=d((o+i)*(c-u)),n=d(e-t);if(n===dt)return this.double();const r=d(s*ht*h),f=d(a*ht*l),p=f+r,m=e+t,g=f-r,y=d(p*n),b=d(m*g),w=d(p*g),_=d(n*m);return new v(y,b,_,w)}const f=d(i*u),p=d(o*c),m=d(a*r*h),g=d(s*l),y=d((i+o)*(u+c)-f-p),b=g-m,w=g+m,k=d(p-n*f),M=d(y*b),A=d(w*k),S=d(y*k),I=d(b*w);return new v(M,A,I,S)}subtract(t){return this.add(t.negate())}wNAF(t){return A.wNAFCached(this,w,t,v.normalizeZ)}multiply(t){const{p:e,f:n}=this.wNAF(y(t,r));return v.normalizeZ([e,n])[0]}multiplyUnsafe(t){let e=b(t);return e===dt?M:this.equals(M)||e===lt?this:this.equals(k)?this.wNAF(e).p:A.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(t){const{ex:e,ey:r,ez:i}=this,o=this.is0();null==t&&(t=o?ft:n.inv(i));const s=d(e*t),a=d(r*t),u=d(i*t);if(o)return{x:dt,y:lt};if(u!==lt)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===lt?this:this.multiplyUnsafe(t)}static fromHex(t,r=!1){const{d:i,a:o}=e,s=n.BYTES,a=(t=D("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const h=$(a);h===dt||y(h,r?c:n.ORDER);const f=d(h*h),p=d(f-lt),m=d(i*f-o);let{isValid:g,value:b}=l(p,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const w=(b<)===lt,_=0!=(128&u);if(!r&&b===dt&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==w&&(b=d(-b)),v.fromAffine({x:b,y:h})}static fromPrivateKey(t){return E(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),r=O(e,n.BYTES);return r[r.length-1]|=t<?128:0,r}toHex(){return x(this.toRawBytes())}}v.BASE=new v(e.Gx,e.Gy,lt,d(e.Gx*e.Gy)),v.ZERO=new v(dt,lt,lt,dt);const{BASE:k,ZERO:M}=v,A=ut(v,8*a);function S(t){return X(t,r)}function I(t){return S($(t))}function E(t){const e=a;t=D("private key",t,e);const n=D("hashed private key",o(t),2*e),r=h(n.slice(0,e)),i=n.slice(e,2*e),s=I(r),u=k.multiply(s),c=u.toRawBytes();return{head:r,prefix:i,scalar:s,point:u,pointBytes:c}}function T(t=new Uint8Array,...e){const n=C(...e);return I(o(f(n,D("context",t),!!i)))}const P=pt;return k._setWindowSize(8),{CURVE:e,getPublicKey:function(t){return E(t).pointBytes},sign:function(t,e,r={}){t=D("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=E(e),c=T(r.context,o,t),d=k.multiply(c).toRawBytes(),l=S(c+T(r.context,d,u,t)*s);return b(l),D("result",C(d,O(l,n.BYTES)),2*a)},verify:function(t,e,r,o=P){const{context:s,zip215:a}=o,u=n.BYTES;t=D("signature",t,2*u),e=D("message",e),i&&(e=i(e));const c=$(t.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(t.slice(0,u),a),h=k.multiplyUnsafe(c)}catch(t){return!1}if(!a&&d.isSmallOrder())return!1;const f=T(s,l.toRawBytes(),d.toRawBytes(),e);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:E,randomPrivateKey:()=>s(n.BYTES),precompute:(t=8,e=v.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}const gt=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),yt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),bt=(BigInt(0),BigInt(1)),wt=BigInt(2),_t=BigInt(5),vt=BigInt(10),kt=BigInt(20),Mt=BigInt(40),At=BigInt(80);const St=rt(gt,void 0,!0),It=mt({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:St,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:v,randomBytes:m.O6,adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const n=gt,r=X(e*e*e,n),i=X(r*r*e,n);let o=X(t*r*function(t){const e=gt,n=t*t%e*t%e,r=Q(n,wt,e)*n%e,i=Q(r,bt,e)*t%e,o=Q(i,_t,e)*i%e,s=Q(o,vt,e)*o%e,a=Q(s,kt,e)*s%e,u=Q(a,Mt,e)*a%e,c=Q(u,At,e)*u%e,d=Q(c,At,e)*u%e,l=Q(d,vt,e)*o%e;return{pow_p_5_8:Q(l,wt,e)*t%e,b2:n}}(t*i).pow_p_5_8,n);const s=X(e*o*o,n),a=o,u=X(o*yt,n),c=s===t,d=s===X(-t,n),l=s===X(-t*yt,n);return c&&(o=a),(d||l)&&(o=u),(X(o,n)&H)===H&&(o=X(-o,n)),{isValid:c||d,value:o}}});const xt=(St.ORDER+BigInt(3))/BigInt(8);St.pow(wt,xt),St.sqrt(St.neg(St.ONE)),St.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);t.isOdd(n)&&t.neg(n)}(St,St.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Et=n(13550),Tt=n.n(Et),Pt=n(77191),Bt=n.n(Pt),Lt=n(17748),$t=n(25532),Rt=n(39386),Ot=n(40475),Dt=n(53471),Ct=n(31198),Nt=n.n(Ct),zt=n(66855),Ut=n(89062),jt=n(93527);const Yt=[],Ft=[],Wt=[],Ht=BigInt(0),Kt=BigInt(1),qt=BigInt(2),Vt=BigInt(7),Gt=BigInt(256),Zt=BigInt(113);for(let t=0,e=Kt,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],Yt.push(2*(5*r+n)),Ft.push((t+1)*(t+2)/2%64);let i=Ht;for(let t=0;t<7;t++)e=(e<>Vt)*Zt)%Gt,e&qt&&(i^=Kt<<(Kt<n>32?h(t,e,n):d(t,e,n),te=(t,e,n)=>n>32?f(t,e,n):l(t,e,n);class ee extends m.kb{constructor(t,e,n,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,jt.Rx)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,m.Jq)(this.state)}keccak(){m.iA||(0,m.l1)(this.state32),function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,o=n[i],s=n[i+1],a=Qt(o,s,1)^n[r],u=te(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=u}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=Ft[n],o=Qt(e,i,r),s=te(e,i,r),a=Yt[n];e=t[a],i=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=Xt[r],t[1]^=Jt[r]}n.fill(0)}(this.state32,this.rounds),m.iA||(0,m.l1)(this.state32),this.posOut=0,this.pos=0}update(t){(0,jt.Gg)(this);const{blockLen:e,state:n}=this,r=(t=(0,m.O0)(t)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,jt.Rx)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,jt.J8)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new ee(e,n,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const ne=((t,e,n)=>(0,m.hE)((()=>new ee(e,t,n))))(1,136,32);class re extends m.kb{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,jt.vp)(t);const n=(0,m.O0)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew re(t,e).update(n).digest();ie.create=(t,e)=>new re(t,e);const{bytesToNumberBE:oe,hexToBytes:se}=r,ae={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=ae;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:oe(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=ae,n="string"==typeof t?se(t):t;S(n);let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=ae._parseInt(n.subarray(2)),{d:s,l:a}=ae._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},ue=BigInt(0),ce=BigInt(1),de=(BigInt(2),BigInt(3));function le(t){const e=function(t){const e=ct(t);return F(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,o=2*n.BYTES+1;function s(t){return X(t,r)}function a(t){return tt(t,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=function(t){const e=function(t){const e=ct(t);F(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const i=e.toAffine();return C(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:i}=e,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&uen.eql(t,n.ZERO);return i(e)&&i(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(D("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),s=o(t);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:r,pz:i}=this,{px:o,py:s,pz:a}=t,u=n.eql(n.mul(e,a),n.mul(o,i)),c=n.eql(n.mul(r,a),n.mul(s,i));return u&&c}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,i=n.mul(r,de),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),m=n.mul(o,s);return m=n.add(m,m),d=n.mul(o,a),d=n.add(d,d),u=n.mul(t,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(m,u),d=n.mul(i,d),p=n.mul(t,p),m=n.sub(h,p),m=n.mul(t,m),m=n.add(m,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,m),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,m),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(t){d(t);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=n.ZERO,h=n.ZERO,f=n.ZERO;const p=e.a,m=n.mul(e.b,de);let g=n.mul(r,s),y=n.mul(i,a),b=n.mul(o,u),w=n.add(r,i),_=n.add(s,a);w=n.mul(w,_),_=n.add(g,y),w=n.sub(w,_),_=n.add(r,o);let v=n.add(s,u);return _=n.mul(_,v),v=n.add(g,b),_=n.sub(_,v),v=n.add(i,o),c=n.add(a,u),v=n.mul(v,c),c=n.add(y,b),v=n.sub(v,c),f=n.mul(p,_),c=n.mul(m,b),f=n.add(c,f),c=n.sub(y,f),f=n.add(y,f),h=n.mul(c,f),y=n.add(g,g),y=n.add(y,g),b=n.mul(p,b),_=n.mul(m,_),y=n.add(y,b),b=n.sub(g,b),b=n.mul(p,b),_=n.add(_,b),g=n.mul(y,_),h=n.add(h,g),g=n.mul(v,_),c=n.mul(w,c),c=n.sub(c,g),g=n.mul(w,y),f=n.mul(v,f),f=n.add(f,g),new l(c,h,f)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return f.wNAFCached(this,c,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}))}multiplyUnsafe(t){const r=l.ZERO;if(t===ue)return r;if(a(t),t===ce)return this;const{endo:i}=e;if(!i)return f.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),d=r,h=r,p=this;for(;s>ue||c>ue;)s&ce&&(d=d.add(p)),c&ce&&(h=h.add(p)),p=p.double(),s>>=ce,c>>=ce;return o&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,i.beta),h.py,h.pz),d.add(h)}multiply(t){a(t);let r,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:d}=this.wNAF(e),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,s.beta),h.py,h.pz),r=c.add(h),i=d.add(p)}else{const{p:t,f:e}=this.wNAF(o);r=t,i=e}return l.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,i=(t,e)=>e!==ue&&e!==ce&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:i}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));const s=n.mul(e,t),a=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===ce)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===ce?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(l,this,t)}toHex(t=!0){return x(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,f=ut(l,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,r){const i=e.toAffine(),o=n.toBytes(i.x),s=C;return r?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===o&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=L(s);if(!(ue<(a=t)&&ax(R(t,e.nByteLength));function f(t){return t>r>>ce}const p=(t,e,n)=>L(t.slice(e,n));class m{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=D("compactSignature",t,2*n),new m(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=ae.toSig(D("DER",t));return new m(e,n)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r,s:i,recovery:o}=this,c=w(D("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+e.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),m=s(-c*p),g=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return B(this.toDERHex())}toDERHex(){return ae.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return B(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=ot(e.n);return function(t,e,n=!1){const r=t.length,i=it(e),o=ot(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=X(n?L(t):$(t),e-H)+H;return n?O(s,i):R(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=A(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===o:n?r===2*i||r===2*o:t instanceof u}const b=e.bits2int||function(t){const n=L(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},w=e.bits2int_modN||function(t){return s(b(t))},_=N(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(ue<=t&&t<_))throw new Error(`bigint expected < 2^${e.nBitLength}`);return R(t,e.nByteLength)}const k={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=k){const{seed:o,k2sig:d}=function(t,r,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=e;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),t=D("msgHash",t),p&&(t=D("prehashed msgHash",o(t)));const y=w(t),_=c(r),M=[v(_),v(y)];if(null!=g&&!1!==g){const t=!0===g?d(n.BYTES):g;M.push(D("extraEntropy",t))}const A=C(...M),S=y;return{seed:A,k2sig:function(t){const e=b(t);if(!l(e))return;const n=a(e),r=u.BASE.multiply(e).toAffine(),i=s(r.x);if(i===ue)return;const o=s(n*s(S+i*_));if(o===ue)return;let c=(r.x===i?0:2)|Number(r.y&ce),d=o;return h&&f(o)&&(d=function(t){return f(t)?s(-t):t}(o),c^=1),new m(i,d,c)}}}(t,r,i),h=e;return j(h.hash.outputLen,h.nByteLength,h.hmac)(o,d)},verify:function(t,n,r,i=M){const o=t;if(n=D("msgHash",n),r=D("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:d}=i;let l,h;try{if("string"==typeof o||A(o))try{l=m.fromDER(o)}catch(t){if(!(t instanceof ae.Err))throw t;l=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new m(t,e)}}h=u.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;d&&(n=e.hash(n));const{r:f,s:p}=l,g=w(n),y=a(p),b=s(g*y),_=s(f*y),v=u.BASE.multiplyAndAddUnsafe(h,b,_)?.toAffine();return!!v&&s(v.x)===f},ProjectivePoint:u,Signature:m,utils:g}}function he(t){return{hash:t,hmac:(e,...n)=>ie(t,e,(0,m.eV)(...n)),randomBytes:m.O6}}BigInt(4);const fe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),pe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),me=BigInt(1),ge=BigInt(2),ye=(t,e)=>(t+e/ge)/e;const be=rt(fe,void 0,void 0,{sqrt:function(t){const e=fe,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,d=c*c*t%e,l=Q(d,n,e)*d%e,h=Q(l,n,e)*d%e,f=Q(h,ge,e)*c%e,p=Q(f,i,e)*f%e,m=Q(p,o,e)*p%e,g=Q(m,a,e)*m%e,y=Q(g,u,e)*g%e,b=Q(y,a,e)*m%e,w=Q(b,n,e)*d%e,_=Q(w,s,e)*p%e,v=Q(_,r,e)*c%e,k=Q(v,ge,e);if(!be.eql(be.sqr(k),t))throw new Error("Cannot find square root");return k}}),we=function(t,e){const n=e=>le({...t,...he(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:be,n:pe,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=pe,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-me*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=ye(o*t,e),u=ye(-r*t,e);let c=X(t-a*n-u*i,e),d=X(-a*r-u*o,e);const l=c>s,h=d>s;if(l&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},Lt.J);BigInt(0),we.ProjectivePoint;const _e=It.utils.randomPrivateKey,ve=()=>{const t=It.utils.randomPrivateKey(),e=ke(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},ke=It.getPublicKey;function Me(t){try{return It.ExtendedPoint.fromHex(t),!0}catch{return!1}}const Ae=(t,e)=>It.sign(t,e.slice(0,32)),Se=It.verify,Ie=t=>i.Buffer.isBuffer(t)?t:t instanceof Uint8Array?i.Buffer.from(t.buffer,t.byteOffset,t.byteLength):i.Buffer.from(t);class xe{constructor(t){Object.assign(this,t)}encode(){return i.Buffer.from((0,$t.serialize)(Te,this))}static decode(t){return(0,$t.deserialize)(Te,this,t)}static decodeUnchecked(t){return(0,$t.deserializeUnchecked)(Te,this,t)}}class Ee extends xe{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}}const Te=new Map;var Pe;const Be=32,Le=32;let $e=1;class Re extends xe{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=Bt().decode(t);if(e.length!=Le)throw new Error("Invalid public key input");this._bn=new(Tt())(e)}else this._bn=new(Tt())(t);if(this._bn.byteLength()>Le)throw new Error("Invalid public key input")}}static unique(){const t=new Re($e);return $e+=1,new Re(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Bt().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(i.Buffer);if(t.length===Le)return t;const e=i.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=i.Buffer.concat([t.toBuffer(),i.Buffer.from(e),n.toBuffer()]),o=(0,Lt.J)(r);return new Re(o)}static createProgramAddressSync(t,e){let n=i.Buffer.alloc(0);t.forEach((function(t){if(t.length>Be)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Ie(t)])})),n=i.Buffer.concat([n,e.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=(0,Lt.J)(n);if(Me(r))throw new Error("Invalid seeds, address must fall off the curve");return new Re(r)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const o=t.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return Me(new Re(t).toBytes())}}Pe=Re,Re.default=new Pe("11111111111111111111111111111111"),Te.set(Re,{kind:"struct",fields:[["_bn","u256"]]});class Oe{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=Ie(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Ie(_e()),this._publicKey=Ie(ke(this._secretKey))}get publicKey(){return new Re(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const De=new Re("BPFLoader1111111111111111111111111111111111"),Ce=1232,Ne=127,ze=64;class Ue extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Ue.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class je extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(je.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Ye extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Ye.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class Fe{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,n)=>{e.set(t.toBase58(),n)}));const n=t=>{const n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((t=>({programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((t=>n(t.pubkey))),data:t.data})))}}const We=(t="publicKey")=>Rt.blob(32,t),He=(t="signature")=>Rt.blob(64,t),Ke=(t="string")=>{const e=Rt.struct([Rt.u32("length"),Rt.u32("lengthPadding"),Rt.blob(Rt.offset(Rt.u32(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),o=e;return o.decode=(t,e)=>n(t,e).chars.toString(),o.encode=(t,e,n)=>{const o={chars:i.Buffer.from(t,"utf8")};return r(o,e,n)},o.alloc=t=>Rt.u32().span+Rt.u32().span+i.Buffer.from(t,"utf8").length,o};function qe(t,e){const n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const r=e[t.property];if(Array.isArray(r))return r.length*n(t.elementLayout)}else if("fields"in t)return qe({layout:t},e[t.property]);return 0};let r=0;return t.layout.fields.forEach((t=>{r+=n(t)})),r}function Ve(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function Ge(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}function Ze(t,e){if(!t)throw new Error(e||"Assertion failed")}class Xe{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,r=t=>{const e=t.toBase58();let r=n.get(e);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(e,r)),r},i=r(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){r(e.programId).isInvoked=!0;for(const t of e.keys){const e=r(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new Xe(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];Ze(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),n=t.filter((([,t])=>t.isSigner&&!t.isWritable)),r=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{Ze(e.length>0,"Expected at least one writable signer key");const[t]=e[0];Ze(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new Re(t))),...n.map((([t])=>new Re(t))),...r.map((([t])=>new Re(t))),...i.map((([t])=>new Re(t)))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==r.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new Re(i),o=t.findIndex((t=>t.equals(e)));o>=0&&(Ze(o<256,"Max lookup table index exceeded"),n.push(o),r.push(e),this.keyMetaMap.delete(i))}return[n,r]}}const Je="Reached end of buffer unexpectedly";function Qe(t){if(0===t.length)throw new Error(Je);return t.shift()}function tn(t,...e){const[n]=e;if(2===e.length?n+(e[1]??0)>t.length:n>=t.length)throw new Error(Je);return t.splice(...e)}class en{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new Re(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Bt().decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new Fe(this.staticAccountKeys)}static compile(t){const e=Xe.compile(t.instructions,t.payerKey),[n,r]=e.getMessageComponents(),i=new Fe(r).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:Bt().encode(t.data)})));return new en({header:n,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];Ge(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(Bt().decode(t.data));let o=[];Ge(o,e.length);let s=[];return Ge(s,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:e,dataLength:i.Buffer.from(s),data:r}}));let r=[];Ge(r,n.length);let o=i.Buffer.alloc(Ce);i.Buffer.from(r).copy(o);let s=r.length;n.forEach((t=>{const e=Rt.struct([Rt.u8("programIdIndex"),Rt.blob(t.keyIndicesCount.length,"keyIndicesCount"),Rt.seq(Rt.u8("keyIndex"),t.keyIndices.length,"keyIndices"),Rt.blob(t.dataLength.length,"dataLength"),Rt.seq(Rt.u8("userdatum"),t.data.length,"data")]).encode(t,o,s);s+=e})),o=o.slice(0,s);const a=Rt.struct([Rt.blob(1,"numRequiredSignatures"),Rt.blob(1,"numReadonlySignedAccounts"),Rt.blob(1,"numReadonlyUnsignedAccounts"),Rt.blob(e.length,"keyCount"),Rt.seq(We("key"),t,"keys"),We("recentBlockhash")]),u={numRequiredSignatures:i.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:i.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:i.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:i.Buffer.from(e),keys:this.accountKeys.map((t=>Ie(t.toBytes()))),recentBlockhash:Bt().decode(this.recentBlockhash)};let c=i.Buffer.alloc(2048);const d=a.encode(u,c);return o.copy(c,d),c.slice(0,d+o.length)}static from(t){let e=[...t];const n=Qe(e);if(n!==(n&Ne))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=Qe(e),o=Qe(e),s=Ve(e);let a=[];for(let t=0;t0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Fe(this.staticAccountKeys,e)}isAccountSigner(t){return t=n?t-nt+e.writableIndexes.length),0):t>=this.header.numRequiredSignatures?t-et.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const t of n.writableIndexes){if(!(tt.toBytes())),recentBlockhash:Bt().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let t=0;const e=new Uint8Array(Ce);for(const n of this.compiledInstructions){const r=Array();Ge(r,n.accountKeyIndexes.length);const i=Array();Ge(i,n.data.length),t+=Rt.struct([Rt.u8("programIdIndex"),Rt.blob(r.length,"encodedAccountKeyIndexesLength"),Rt.seq(Rt.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),Rt.blob(i.length,"encodedDataLength"),Rt.blob(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(Ce);for(const n of this.addressTableLookups){const r=Array();Ge(r,n.writableIndexes.length);const i=Array();Ge(i,n.readonlyIndexes.length),t+=Rt.struct([We("accountKey"),Rt.blob(r.length,"encodedWritableIndexesLength"),Rt.seq(Rt.u8(),n.writableIndexes.length,"writableIndexes"),Rt.blob(i.length,"encodedReadonlyIndexesLength"),Rt.seq(Rt.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=Qe(e),r=n&Ne;Ze(n!==r,"Expected versioned message but received legacy message"),Ze(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:Qe(e),numReadonlySignedAccounts:Qe(e),numReadonlyUnsignedAccounts:Qe(e)},o=[],s=Ve(e);for(let t=0;t{const e=rn.deserializeMessageVersion(t);if("legacy"===e)return en.from(t);if(0===e)return nn.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let on=function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t}({});const sn=i.Buffer.alloc(ze).fill(0);class an{constructor(t){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class un{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new an(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new Re(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(n)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(d.push(t.toString()),a+=1,n||(u+=1)):(l.push(t.toString()),n||(c+=1))}));const h=d.concat(l),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:h.indexOf(n.toString()),accounts:t.keys.map((t=>h.indexOf(t.pubkey.toString()))),data:Bt().encode(e)}}));return f.forEach((t=>{Ze(t.programIdIndex>=0),t.accounts.forEach((t=>Ze(t>=0)))})),new en({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,n)=>e[n].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=Ae(n,t.secretKey);this._addSignature(t.publicKey,Ie(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){Ze(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=i.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?e&&(n.missing||=[]).push(i):Se(r,t,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n){const t=this._getMessageSignednessErrors(r,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`\nInvalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map((t=>t.toBase58())).join("`, `")}\`].`),t.missing&&(e+=`\nMissing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map((t=>t.toBase58())).join("`, `")}\`].`),new Error(e)}}return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];Ge(n,e.length);const r=n.length+64*e.length+t.length,o=i.Buffer.alloc(r);return Ze(e.length<256),i.Buffer.from(n).copy(o,0),e.forEach((({signature:t},e)=>{null!==t&&(Ze(64===t.length,"signature has invalid length"),i.Buffer.from(t).copy(o,n.length+64*e))})),t.copy(o,n.length+64*e.length),Ze(o.length<=Ce,`Transaction too large: ${o.length} > ${Ce}`),o}get keys(){return Ze(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return Ze(1===this.instructions.length),this.instructions[0].programId}get data(){return Ze(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=Ve(e);let r=[];for(let t=0;t0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==Bt().encode(sn)?null:Bt().decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new an({keys:r,programId:t.accountKeys[e.programIdIndex],data:Bt().decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}class cn{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:r,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;Ze(u>0,"Message header is invalid");const c=t.staticAccountKeys.length-o-a;Ze(c>=0,"Message header is invalid");const d=t.getAccountKeys(e),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const t of r){const e=[];for(const r of t.accountKeyIndexes){const t=d.get(r);if(void 0===t)throw new Error(`Failed to find key for account key index ${r}`);let i;i=rt.equals(r.publicKey)));Ze(t>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[t]=Ae(e,r.secretKey)}}addSignature(t,e){Ze(64===e.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((e=>e.equals(t)));Ze(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const ln=new Re("SysvarC1ock11111111111111111111111111111111"),hn=new Re("SysvarEpochSchedu1e111111111111111111111111"),fn=new Re("Sysvar1nstructions1111111111111111111111111"),pn=new Re("SysvarRecentB1ockHashes11111111111111111111"),mn=new Re("SysvarRent111111111111111111111111111111111"),gn=new Re("SysvarRewards111111111111111111111111111111"),yn=new Re("SysvarS1otHashes111111111111111111111111111"),bn=new Re("SysvarS1otHistory11111111111111111111111111"),wn=new Re("SysvarStakeHistory1111111111111111111111111");async function _n(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i);let s;if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)s=(await t.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){const{nonceInstruction:n}=e.nonceInfo,i=n.keys[0].pubkey;s=(await t.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:e.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await t.confirmTransaction(o,r&&r.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function vn(t){return new Promise((e=>setTimeout(e,t)))}function kn(t,e){const n=t.layout.span>=0?t.layout.span:qe(t,e),r=i.Buffer.alloc(n),o=Object.assign({instruction:t.index},e);return t.layout.encode(o,r),r}function Mn(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const An=Rt.nu64("lamportsPerSignature"),Sn=Rt.struct([Rt.u32("version"),Rt.u32("state"),We("authorizedPubkey"),We("nonce"),Rt.struct([An],"feeCalculator")]),In=Sn.span;class xn{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=Sn.decode(Ie(t),0);return new xn({authorizedPubkey:new Re(e.authorizedPubkey),nonce:new Re(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const En=(8,t=>{const e=(0,Rt.blob)(8,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return(0,Ot.toBigIntLE)(i.Buffer.from(n))},o.encode=(t,e,r)=>{const i=(0,Ot.toBufferLE)(t,8);return n(i,e,r)},o});class Tn{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Pn))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=Mn(Pn.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new Re(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=Mn(Pn.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=Mn(Pn.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new Re(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=Mn(Pn.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=Mn(Pn.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Re(e),seed:n,space:r,programId:new Re(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=Mn(Pn.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new Re(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=Mn(Pn.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new Re(e),seed:n,programId:new Re(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=Mn(Pn.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new Re(e),seed:n,lamports:r,space:i,programId:new Re(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=Mn(Pn.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new Re(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Mn(Pn.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Mn(Pn.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=Mn(Pn.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new Re(e)}}static checkProgramId(t){if(!t.equals(Bn.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length0?i:1,space:o.length,programId:r}));null!==a&&await _n(t,a,[e,n],{commitment:"confirmed"})}const s=Rt.struct([Rt.u32("instruction"),Rt.u32("offset"),Rt.u32("bytesLength"),Rt.u32("bytesLengthPadding"),Rt.seq(Rt.u8("byte"),Rt.offset(Rt.u32(),-8),"bytes")]),a=$n.chunkSize;let u=0,c=o,d=[];for(;c.length>0;){const o=c.slice(0,a),l=i.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:o,bytesLength:0,bytesLengthPadding:0},l);const h=(new un).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(d.push(_n(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await vn(1e3/t)}u+=a,c=c.slice(a)}await Promise.all(d);{const o=Rt.struct([Rt.u32("instruction")]),s=i.Buffer.alloc(o.span);o.encode({instruction:1},s);const a=(new un).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:mn,isSigner:!1,isWritable:!1}],programId:r,data:s}),u="processed",c=await t.sendTransaction(a,[e,n],{preflightCommitment:u}),{context:d,value:l}=await t.confirmTransaction({signature:c,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},u);if(l.err)throw new Error(`Transaction ${c} failed (${JSON.stringify(l)})`);for(;;){try{if(await t.getSlot({commitment:u})>d.slot)break}catch{}await new Promise((t=>setTimeout(t,Math.round(200))))}}return!0}}$n.chunkSize=Ln;const Rn=new Re("BPFLoader2111111111111111111111111111111111");class On{static getMinNumSignatures(t){return $n.getMinNumSignatures(t)}static load(t,e,n,r,i){return $n.load(t,e,n,i,r)}}function Dn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cn=Object.prototype.toString,Nn=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function zn(t,e){var n,r,i,o,s,a,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return zn(t.toJSON(),e);if("[object Array]"===(u=Cn.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=zn(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Nn(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}class Yn{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32)))-jn(32)-1;return[n,t-(this.getSlotsInEpoch(n)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}var e}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const n=(0,Ut.Z)(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in n?n.socket:n,n}),t,e,n),this.underlyingSocket=void 0}call(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){const e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class Vn{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${t.index}`);return n}(Gn,t),n=t.length-56;Ze(n>=0,"lookup table is invalid"),Ze(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=Rt.struct([Rt.seq(We(),r,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new Re(e.authority[0]):void 0,addresses:i.map((t=>new Re(t)))}}}const Gn={index:1,layout:Rt.struct([Rt.u32("typeIndex"),En("deactivationSlot"),Rt.nu64("lastExtendedSlot"),Rt.u8("lastExtendedStartIndex"),Rt.u8(),Rt.seq(We(),Rt.offset(Rt.u8(),-1),"authority")])},Zn=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,Xn=(0,Dt.oQ)((0,Dt.eE)(Re),(0,Dt.Z_)(),(t=>new Re(t))),Jn=(0,Dt.bc)([(0,Dt.Z_)(),(0,Dt.i0)("base64")]),Qn=(0,Dt.oQ)((0,Dt.eE)(i.Buffer),Jn,(t=>i.Buffer.from(t[0],"base64"))),tr=3e4;function er(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function nr(t){return(0,Dt.G0)([(0,Dt.dt)({jsonrpc:(0,Dt.i0)("2.0"),id:(0,Dt.Z_)(),result:t}),(0,Dt.dt)({jsonrpc:(0,Dt.i0)("2.0"),id:(0,Dt.Z_)(),error:(0,Dt.dt)({code:(0,Dt._4)(),message:(0,Dt.Z_)(),data:(0,Dt.jt)((0,Dt.Yj)())})})])}const rr=nr((0,Dt._4)());function ir(t){return(0,Dt.oQ)(nr(t),rr,(e=>"error"in e?e:{...e,result:(0,Dt.Ue)(e.result,t)}))}function or(t){return ir((0,Dt.dt)({context:(0,Dt.dt)({slot:(0,Dt.Rx)()}),value:t}))}function sr(t){return(0,Dt.dt)({context:(0,Dt.dt)({slot:(0,Dt.Rx)()}),value:t})}function ar(t,e){return 0===t?new nn({header:e.header,staticAccountKeys:e.accountKeys.map((t=>new Re(t))),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Bt().decode(t.data)}))),addressTableLookups:e.addressTableLookups}):new en(e)}const ur=(0,Dt.dt)({foundation:(0,Dt.Rx)(),foundationTerm:(0,Dt.Rx)(),initial:(0,Dt.Rx)(),taper:(0,Dt.Rx)(),terminal:(0,Dt.Rx)()}),cr=ir((0,Dt.IX)((0,Dt.AG)((0,Dt.dt)({epoch:(0,Dt.Rx)(),effectiveSlot:(0,Dt.Rx)(),amount:(0,Dt.Rx)(),postBalance:(0,Dt.Rx)(),commission:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)()))})))),dr=(0,Dt.IX)((0,Dt.dt)({slot:(0,Dt.Rx)(),prioritizationFee:(0,Dt.Rx)()})),lr=(0,Dt.dt)({total:(0,Dt.Rx)(),validator:(0,Dt.Rx)(),foundation:(0,Dt.Rx)(),epoch:(0,Dt.Rx)()}),hr=(0,Dt.dt)({epoch:(0,Dt.Rx)(),slotIndex:(0,Dt.Rx)(),slotsInEpoch:(0,Dt.Rx)(),absoluteSlot:(0,Dt.Rx)(),blockHeight:(0,Dt.jt)((0,Dt.Rx)()),transactionCount:(0,Dt.jt)((0,Dt.Rx)())}),fr=(0,Dt.dt)({slotsPerEpoch:(0,Dt.Rx)(),leaderScheduleSlotOffset:(0,Dt.Rx)(),warmup:(0,Dt.O7)(),firstNormalEpoch:(0,Dt.Rx)(),firstNormalSlot:(0,Dt.Rx)()}),pr=(0,Dt.IM)((0,Dt.Z_)(),(0,Dt.IX)((0,Dt.Rx)())),mr=(0,Dt.AG)((0,Dt.G0)([(0,Dt.dt)({}),(0,Dt.Z_)()])),gr=(0,Dt.dt)({err:mr}),yr=(0,Dt.i0)("receivedSignature"),br=(0,Dt.dt)({"solana-core":(0,Dt.Z_)(),"feature-set":(0,Dt.jt)((0,Dt.Rx)())}),wr=or((0,Dt.dt)({err:(0,Dt.AG)((0,Dt.G0)([(0,Dt.dt)({}),(0,Dt.Z_)()])),logs:(0,Dt.AG)((0,Dt.IX)((0,Dt.Z_)())),accounts:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.AG)((0,Dt.dt)({executable:(0,Dt.O7)(),owner:(0,Dt.Z_)(),lamports:(0,Dt.Rx)(),data:(0,Dt.IX)((0,Dt.Z_)()),rentEpoch:(0,Dt.jt)((0,Dt.Rx)())}))))),unitsConsumed:(0,Dt.jt)((0,Dt.Rx)()),returnData:(0,Dt.jt)((0,Dt.AG)((0,Dt.dt)({programId:(0,Dt.Z_)(),data:(0,Dt.bc)([(0,Dt.Z_)(),(0,Dt.i0)("base64")])})))})),_r=or((0,Dt.dt)({byIdentity:(0,Dt.IM)((0,Dt.Z_)(),(0,Dt.IX)((0,Dt.Rx)())),range:(0,Dt.dt)({firstSlot:(0,Dt.Rx)(),lastSlot:(0,Dt.Rx)()})})),vr=ir(ur),kr=ir(lr),Mr=ir(dr),Ar=ir(hr),Sr=ir(fr),Ir=ir(pr),xr=ir((0,Dt.Rx)()),Er=or((0,Dt.dt)({total:(0,Dt.Rx)(),circulating:(0,Dt.Rx)(),nonCirculating:(0,Dt.Rx)(),nonCirculatingAccounts:(0,Dt.IX)(Xn)})),Tr=(0,Dt.dt)({amount:(0,Dt.Z_)(),uiAmount:(0,Dt.AG)((0,Dt.Rx)()),decimals:(0,Dt.Rx)(),uiAmountString:(0,Dt.jt)((0,Dt.Z_)())}),Pr=or((0,Dt.IX)((0,Dt.dt)({address:Xn,amount:(0,Dt.Z_)(),uiAmount:(0,Dt.AG)((0,Dt.Rx)()),decimals:(0,Dt.Rx)(),uiAmountString:(0,Dt.jt)((0,Dt.Z_)())}))),Br=or((0,Dt.IX)((0,Dt.dt)({pubkey:Xn,account:(0,Dt.dt)({executable:(0,Dt.O7)(),owner:Xn,lamports:(0,Dt.Rx)(),data:Qn,rentEpoch:(0,Dt.Rx)()})}))),Lr=(0,Dt.dt)({program:(0,Dt.Z_)(),parsed:(0,Dt._4)(),space:(0,Dt.Rx)()}),$r=or((0,Dt.IX)((0,Dt.dt)({pubkey:Xn,account:(0,Dt.dt)({executable:(0,Dt.O7)(),owner:Xn,lamports:(0,Dt.Rx)(),data:Lr,rentEpoch:(0,Dt.Rx)()})}))),Rr=or((0,Dt.IX)((0,Dt.dt)({lamports:(0,Dt.Rx)(),address:Xn}))),Or=(0,Dt.dt)({executable:(0,Dt.O7)(),owner:Xn,lamports:(0,Dt.Rx)(),data:Qn,rentEpoch:(0,Dt.Rx)()}),Dr=(0,Dt.dt)({pubkey:Xn,account:Or}),Cr=(0,Dt.oQ)((0,Dt.G0)([(0,Dt.eE)(i.Buffer),Lr]),(0,Dt.G0)([Jn,Lr]),(t=>Array.isArray(t)?(0,Dt.Ue)(t,Qn):t)),Nr=(0,Dt.dt)({executable:(0,Dt.O7)(),owner:Xn,lamports:(0,Dt.Rx)(),data:Cr,rentEpoch:(0,Dt.Rx)()}),zr=(0,Dt.dt)({pubkey:Xn,account:Nr}),Ur=(0,Dt.dt)({state:(0,Dt.G0)([(0,Dt.i0)("active"),(0,Dt.i0)("inactive"),(0,Dt.i0)("activating"),(0,Dt.i0)("deactivating")]),active:(0,Dt.Rx)(),inactive:(0,Dt.Rx)()}),jr=ir((0,Dt.IX)((0,Dt.dt)({signature:(0,Dt.Z_)(),slot:(0,Dt.Rx)(),err:mr,memo:(0,Dt.AG)((0,Dt.Z_)()),blockTime:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)()))}))),Yr=ir((0,Dt.IX)((0,Dt.dt)({signature:(0,Dt.Z_)(),slot:(0,Dt.Rx)(),err:mr,memo:(0,Dt.AG)((0,Dt.Z_)()),blockTime:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)()))}))),Fr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:sr(Or)}),Wr=(0,Dt.dt)({pubkey:Xn,account:Or}),Hr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:sr(Wr)}),Kr=(0,Dt.dt)({parent:(0,Dt.Rx)(),slot:(0,Dt.Rx)(),root:(0,Dt.Rx)()}),qr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:Kr}),Vr=(0,Dt.G0)([(0,Dt.dt)({type:(0,Dt.G0)([(0,Dt.i0)("firstShredReceived"),(0,Dt.i0)("completed"),(0,Dt.i0)("optimisticConfirmation"),(0,Dt.i0)("root")]),slot:(0,Dt.Rx)(),timestamp:(0,Dt.Rx)()}),(0,Dt.dt)({type:(0,Dt.i0)("createdBank"),parent:(0,Dt.Rx)(),slot:(0,Dt.Rx)(),timestamp:(0,Dt.Rx)()}),(0,Dt.dt)({type:(0,Dt.i0)("frozen"),slot:(0,Dt.Rx)(),timestamp:(0,Dt.Rx)(),stats:(0,Dt.dt)({numTransactionEntries:(0,Dt.Rx)(),numSuccessfulTransactions:(0,Dt.Rx)(),numFailedTransactions:(0,Dt.Rx)(),maxTransactionsPerEntry:(0,Dt.Rx)()})}),(0,Dt.dt)({type:(0,Dt.i0)("dead"),slot:(0,Dt.Rx)(),timestamp:(0,Dt.Rx)(),err:(0,Dt.Z_)()})]),Gr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:Vr}),Zr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:sr((0,Dt.G0)([gr,yr]))}),Xr=(0,Dt.dt)({subscription:(0,Dt.Rx)(),result:(0,Dt.Rx)()}),Jr=(0,Dt.dt)({pubkey:(0,Dt.Z_)(),gossip:(0,Dt.AG)((0,Dt.Z_)()),tpu:(0,Dt.AG)((0,Dt.Z_)()),rpc:(0,Dt.AG)((0,Dt.Z_)()),version:(0,Dt.AG)((0,Dt.Z_)())}),Qr=(0,Dt.dt)({votePubkey:(0,Dt.Z_)(),nodePubkey:(0,Dt.Z_)(),activatedStake:(0,Dt.Rx)(),epochVoteAccount:(0,Dt.O7)(),epochCredits:(0,Dt.IX)((0,Dt.bc)([(0,Dt.Rx)(),(0,Dt.Rx)(),(0,Dt.Rx)()])),commission:(0,Dt.Rx)(),lastVote:(0,Dt.Rx)(),rootSlot:(0,Dt.AG)((0,Dt.Rx)())}),ti=ir((0,Dt.dt)({current:(0,Dt.IX)(Qr),delinquent:(0,Dt.IX)(Qr)})),ei=(0,Dt.G0)([(0,Dt.i0)("processed"),(0,Dt.i0)("confirmed"),(0,Dt.i0)("finalized")]),ni=(0,Dt.dt)({slot:(0,Dt.Rx)(),confirmations:(0,Dt.AG)((0,Dt.Rx)()),err:mr,confirmationStatus:(0,Dt.jt)(ei)}),ri=or((0,Dt.IX)((0,Dt.AG)(ni))),ii=ir((0,Dt.Rx)()),oi=(0,Dt.dt)({accountKey:Xn,writableIndexes:(0,Dt.IX)((0,Dt.Rx)()),readonlyIndexes:(0,Dt.IX)((0,Dt.Rx)())}),si=(0,Dt.dt)({signatures:(0,Dt.IX)((0,Dt.Z_)()),message:(0,Dt.dt)({accountKeys:(0,Dt.IX)((0,Dt.Z_)()),header:(0,Dt.dt)({numRequiredSignatures:(0,Dt.Rx)(),numReadonlySignedAccounts:(0,Dt.Rx)(),numReadonlyUnsignedAccounts:(0,Dt.Rx)()}),instructions:(0,Dt.IX)((0,Dt.dt)({accounts:(0,Dt.IX)((0,Dt.Rx)()),data:(0,Dt.Z_)(),programIdIndex:(0,Dt.Rx)()})),recentBlockhash:(0,Dt.Z_)(),addressTableLookups:(0,Dt.jt)((0,Dt.IX)(oi))})}),ai=(0,Dt.dt)({pubkey:Xn,signer:(0,Dt.O7)(),writable:(0,Dt.O7)(),source:(0,Dt.jt)((0,Dt.G0)([(0,Dt.i0)("transaction"),(0,Dt.i0)("lookupTable")]))}),ui=(0,Dt.dt)({accountKeys:(0,Dt.IX)(ai),signatures:(0,Dt.IX)((0,Dt.Z_)())}),ci=(0,Dt.dt)({parsed:(0,Dt._4)(),program:(0,Dt.Z_)(),programId:Xn}),di=(0,Dt.dt)({accounts:(0,Dt.IX)(Xn),data:(0,Dt.Z_)(),programId:Xn}),li=(0,Dt.G0)([di,ci]),hi=(0,Dt.G0)([(0,Dt.dt)({parsed:(0,Dt._4)(),program:(0,Dt.Z_)(),programId:(0,Dt.Z_)()}),(0,Dt.dt)({accounts:(0,Dt.IX)((0,Dt.Z_)()),data:(0,Dt.Z_)(),programId:(0,Dt.Z_)()})]),fi=(0,Dt.oQ)(li,hi,(t=>"accounts"in t?(0,Dt.Ue)(t,di):(0,Dt.Ue)(t,ci))),pi=(0,Dt.dt)({signatures:(0,Dt.IX)((0,Dt.Z_)()),message:(0,Dt.dt)({accountKeys:(0,Dt.IX)(ai),instructions:(0,Dt.IX)(fi),recentBlockhash:(0,Dt.Z_)(),addressTableLookups:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(oi)))})}),mi=(0,Dt.dt)({accountIndex:(0,Dt.Rx)(),mint:(0,Dt.Z_)(),owner:(0,Dt.jt)((0,Dt.Z_)()),uiTokenAmount:Tr}),gi=(0,Dt.dt)({writable:(0,Dt.IX)(Xn),readonly:(0,Dt.IX)(Xn)}),yi=(0,Dt.dt)({err:mr,fee:(0,Dt.Rx)(),innerInstructions:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.dt)({index:(0,Dt.Rx)(),instructions:(0,Dt.IX)((0,Dt.dt)({accounts:(0,Dt.IX)((0,Dt.Rx)()),data:(0,Dt.Z_)(),programIdIndex:(0,Dt.Rx)()}))})))),preBalances:(0,Dt.IX)((0,Dt.Rx)()),postBalances:(0,Dt.IX)((0,Dt.Rx)()),logMessages:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.Z_)()))),preTokenBalances:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(mi))),postTokenBalances:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(mi))),loadedAddresses:(0,Dt.jt)(gi),computeUnitsConsumed:(0,Dt.jt)((0,Dt.Rx)())}),bi=(0,Dt.dt)({err:mr,fee:(0,Dt.Rx)(),innerInstructions:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.dt)({index:(0,Dt.Rx)(),instructions:(0,Dt.IX)(fi)})))),preBalances:(0,Dt.IX)((0,Dt.Rx)()),postBalances:(0,Dt.IX)((0,Dt.Rx)()),logMessages:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)((0,Dt.Z_)()))),preTokenBalances:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(mi))),postTokenBalances:(0,Dt.jt)((0,Dt.AG)((0,Dt.IX)(mi))),loadedAddresses:(0,Dt.jt)(gi),computeUnitsConsumed:(0,Dt.jt)((0,Dt.Rx)())}),wi=(0,Dt.G0)([(0,Dt.i0)(0),(0,Dt.i0)("legacy")]),_i=(0,Dt.dt)({pubkey:(0,Dt.Z_)(),lamports:(0,Dt.Rx)(),postBalance:(0,Dt.AG)((0,Dt.Rx)()),rewardType:(0,Dt.AG)((0,Dt.Z_)()),commission:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)()))}),vi=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:si,meta:(0,Dt.AG)(yi),version:(0,Dt.jt)(wi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),ki=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),Mi=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:ui,meta:(0,Dt.AG)(yi),version:(0,Dt.jt)(wi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),Ai=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:pi,meta:(0,Dt.AG)(bi),version:(0,Dt.jt)(wi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),Si=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:ui,meta:(0,Dt.AG)(bi),version:(0,Dt.jt)(wi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),Ii=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)()),blockHeight:(0,Dt.AG)((0,Dt.Rx)())}))),xi=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),transactions:(0,Dt.IX)((0,Dt.dt)({transaction:si,meta:(0,Dt.AG)(yi)})),rewards:(0,Dt.jt)((0,Dt.IX)(_i)),blockTime:(0,Dt.AG)((0,Dt.Rx)())}))),Ei=ir((0,Dt.AG)((0,Dt.dt)({blockhash:(0,Dt.Z_)(),previousBlockhash:(0,Dt.Z_)(),parentSlot:(0,Dt.Rx)(),signatures:(0,Dt.IX)((0,Dt.Z_)()),blockTime:(0,Dt.AG)((0,Dt.Rx)())}))),Ti=ir((0,Dt.AG)((0,Dt.dt)({slot:(0,Dt.Rx)(),meta:(0,Dt.AG)(yi),blockTime:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)())),transaction:si,version:(0,Dt.jt)(wi)}))),Pi=ir((0,Dt.AG)((0,Dt.dt)({slot:(0,Dt.Rx)(),transaction:pi,meta:(0,Dt.AG)(bi),blockTime:(0,Dt.jt)((0,Dt.AG)((0,Dt.Rx)())),version:(0,Dt.jt)(wi)}))),Bi=or((0,Dt.dt)({blockhash:(0,Dt.Z_)(),feeCalculator:(0,Dt.dt)({lamportsPerSignature:(0,Dt.Rx)()})})),Li=or((0,Dt.dt)({blockhash:(0,Dt.Z_)(),lastValidBlockHeight:(0,Dt.Rx)()})),$i=or((0,Dt.O7)()),Ri=(0,Dt.dt)({slot:(0,Dt.Rx)(),numTransactions:(0,Dt.Rx)(),numSlots:(0,Dt.Rx)(),samplePeriodSecs:(0,Dt.Rx)()}),Oi=ir((0,Dt.IX)(Ri)),Di=or((0,Dt.AG)((0,Dt.dt)({feeCalculator:(0,Dt.dt)({lamportsPerSignature:(0,Dt.Rx)()})}))),Ci=ir((0,Dt.Z_)()),Ni=ir((0,Dt.Z_)()),zi=(0,Dt.dt)({err:mr,logs:(0,Dt.IX)((0,Dt.Z_)()),signature:(0,Dt.Z_)()}),Ui=(0,Dt.dt)({result:sr(zi),subscription:(0,Dt.Rx)()}),ji={"solana-client":"js/0.0.0-development"};class Yi{constructor(t,e){let n,r,i,o,s,a;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const t={};return async e=>{const{commitment:n,config:r}=er(e),i=this._buildArgs([],n,void 0,r),o=Un(i);return t[o]=t[o]??(async()=>{try{const t=await this._rpcRequest("getBlockHeight",i),e=(0,Dt.Ue)(t,ir((0,Dt.Rx)()));if("error"in e)throw new Hn(e.error,"failed to get block height information");return e.result}finally{delete t[o]}})(),await t[o]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,n=e.wsEndpoint,r=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=n||function(t){const e=t.match(Zn);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);const[n,r,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(t),this._rpcClient=function(t,e,n,r,i,o){const s=n||Kn;let a;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(t,e)=>{const n=await new Promise(((n,i)=>{try{r(t,e,((t,e)=>n([t,e])))}catch(t){i(t)}}));return await s(...n)}),new(Nt())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},ji)};try{let e,n=5,u=500;for(;e=a?await a(t,o):await s(t,o),429===e.status&&!0!==i&&(n-=1,0!==n);)console.error(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await vn(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{})}(t,r,i,o,s,a),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new qn(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=await this._rpcRequest("getBalance",i),s=(0,Dt.Ue)(o,or((0,Dt.Rx)()));if("error"in s)throw new Hn(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=await this._rpcRequest("getBlockTime",[t]),n=(0,Dt.Ue)(e,ir((0,Dt.AG)((0,Dt.Rx)())));if("error"in n)throw new Hn(n.error,`failed to get block time for slot ${t}`);return n.result}async getMinimumLedgerSlot(){const t=await this._rpcRequest("minimumLedgerSlot",[]),e=(0,Dt.Ue)(t,ir((0,Dt.Rx)()));if("error"in e)throw new Hn(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const t=await this._rpcRequest("getFirstAvailableBlock",[]),e=(0,Dt.Ue)(t,xr);if("error"in e)throw new Hn(e.error,"failed to get first available block");return e.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=await this._rpcRequest("getSupply",[e]),r=(0,Dt.Ue)(n,Er);if("error"in r)throw new Hn(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenSupply",n),i=(0,Dt.Ue)(r,or(Tr));if("error"in i)throw new Hn(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenAccountBalance",n),i=(0,Dt.Ue)(r,or(Tr));if("error"in i)throw new Hn(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=er(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=await this._rpcRequest("getTokenAccountsByOwner",s),u=(0,Dt.Ue)(a,Br);if("error"in u)throw new Hn(u.error,`failed to get token accounts owned by account ${t.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",i),s=(0,Dt.Ue)(o,$r);if("error"in s)throw new Hn(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=await this._rpcRequest("getLargestAccounts",n),i=(0,Dt.Ue)(r,Rr);if("error"in i)throw new Hn(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=await this._rpcRequest("getTokenLargestAccounts",n),i=(0,Dt.Ue)(r,Pr);if("error"in i)throw new Hn(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,Dt.Ue)(o,or((0,Dt.AG)(Or)));if("error"in s)throw new Hn(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getAccountInfo",i),s=(0,Dt.Ue)(o,or((0,Dt.AG)(Nr)));if("error"in s)throw new Hn(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){const{commitment:n,config:r}=er(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,Dt.Ue)(s,or((0,Dt.IX)((0,Dt.AG)(Nr))));if("error"in a)throw new Hn(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=er(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),s=await this._rpcRequest("getMultipleAccounts",o),a=(0,Dt.Ue)(s,or((0,Dt.IX)((0,Dt.AG)(Or))));if("error"in a)throw new Hn(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=er(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),s=await this._rpcRequest("getStakeActivation",o),a=(0,Dt.Ue)(s,ir(Ur));if("error"in a)throw new Hn(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=er(e),{encoding:i,...o}=r||{},s=this._buildArgs([t.toBase58()],n,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=(0,Dt.IX)(Dr),c=!0===o.withContext?(0,Dt.Ue)(a,or(u)):(0,Dt.Ue)(a,ir(u));if("error"in c)throw new Hn(c.error,`failed to get accounts owned by program ${t.toBase58()}`);return c.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=await this._rpcRequest("getProgramAccounts",i),s=(0,Dt.Ue)(o,ir((0,Dt.IX)(zr)));if("error"in s)throw new Hn(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{const e=t;if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);n=e.signature}try{r=Bt().decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}return Ze(64===r.length,"signature has invalid length"),"string"==typeof t?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise(((e,n)=>{null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(()=>{n(t.reason)})))}))}getTransactionConfirmationPromise({commitment:t,signature:e}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,s)=>{try{n=this.onSignature(e,((t,e)=>{n=void 0;const r={context:e,value:t};o({__type:on.PROCESSED,response:r})}),t);const a=new Promise((t=>{null==n?t():r=this._onSubscriptionStateChange(n,(e=>{"subscribed"===e&&t()}))}));(async()=>{if(await a,i)return;const n=await this.getSignatureStatus(e);if(i)return;if(null==n)return;const{context:r,value:u}=n;if(null!=u)if(u?.err)s(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,o({__type:on.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((e=>{const r=async()=>{try{return await this.getBlockHeight(t)}catch(t){return-1}};(async()=>{let t=await r();if(!i){for(;t<=n;){if(await vn(1e3),i)return;if(t=await r(),i)return}e({__type:on.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:t,signature:r}),u=this.getCancellationPromise(e);let c;try{const t=await Promise.race([u,a,o]);if(t.__type!==on.PROCESSED)throw new Ue(r);c=t.response}finally{i=!0,s()}return c}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let s=!1;const a=new Promise((e=>{let o=i,a=null;const u=async()=>{try{const{context:e,value:i}=await this.getNonceAndContext(r,{commitment:t,minContextSlot:n});return a=e.slot,i?.nonce}catch(t){return o}};(async()=>{if(o=await u(),!s)for(;;){if(i!==o)return void e({__type:on.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await vn(2e3),s)return;if(o=await u(),s)return}})()})),{abortConfirmation:u,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(e);let l;try{const e=await Promise.race([d,c,a]);if(e.__type===on.PROCESSED)l=e.response;else{let r;for(;;){const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(e.slotInWhichNonceDidAdvance??n))){r=t;break}await vn(400)}if(!r?.value)throw new Ye(o);{const e=t||"finalized",{confirmationStatus:n}=r.value;switch(e){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new Ye(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new Ye(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new Ye(o)}l={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,u()}return l}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let n;const r=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>e({__type:on.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});let s;try{const t=await Promise.race([o,r]);if(t.__type!==on.PROCESSED)throw new je(e,t.timeoutMs/1e3);s=t.response}finally{clearTimeout(n),i()}return s}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),e=(0,Dt.Ue)(t,ir((0,Dt.IX)(Jr)));if("error"in e)throw new Hn(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getVoteAccounts",e),r=(0,Dt.Ue)(n,ti);if("error"in r)throw new Hn(r.error,"failed to get vote accounts");return r.result}async getSlot(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlot",r),o=(0,Dt.Ue)(i,ir((0,Dt.Rx)()));if("error"in o)throw new Hn(o.error,"failed to get slot");return o.result}async getSlotLeader(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getSlotLeader",r),o=(0,Dt.Ue)(i,ir((0,Dt.Z_)()));if("error"in o)throw new Hn(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(t,e){const n=[t,e],r=await this._rpcRequest("getSlotLeaders",n),i=(0,Dt.Ue)(r,ir((0,Dt.IX)(Xn)));if("error"in i)throw new Hn(i.error,"failed to get slot leaders");return i.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);return Ze(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=await this._rpcRequest("getSignatureStatuses",n),i=(0,Dt.Ue)(r,ri);if("error"in i)throw new Hn(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getTransactionCount",r),o=(0,Dt.Ue)(i,ir((0,Dt.Rx)()));if("error"in o)throw new Hn(o.error,"failed to get transaction count");return o.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getInflationGovernor",e),r=(0,Dt.Ue)(n,vr);if("error"in r)throw new Hn(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=er(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:i?.epoch}),s=await this._rpcRequest("getInflationReward",o),a=(0,Dt.Ue)(s,cr);if("error"in a)throw new Hn(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){const t=await this._rpcRequest("getInflationRate",[]),e=(0,Dt.Ue)(t,kr);if("error"in e)throw new Hn(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getEpochInfo",r),o=(0,Dt.Ue)(i,Ar);if("error"in o)throw new Hn(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){const t=await this._rpcRequest("getEpochSchedule",[]),e=(0,Dt.Ue)(t,Sr);if("error"in e)throw new Hn(e.error,"failed to get epoch schedule");const n=e.result;return new Yn(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),e=(0,Dt.Ue)(t,Ir);if("error"in e)throw new Hn(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getMinimumBalanceForRentExemption",n),i=(0,Dt.Ue)(r,ii);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=await this._rpcRequest("getRecentBlockhash",e),r=(0,Dt.Ue)(n,Bi);if("error"in r)throw new Hn(r.error,"failed to get recent blockhash");return r.result}async getRecentPerformanceSamples(t){const e=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),n=(0,Dt.Ue)(e,Oi);if("error"in n)throw new Hn(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=await this._rpcRequest("getFeeCalculatorForBlockhash",n),i=(0,Dt.Ue)(r,Di);if("error"in i)throw new Hn(i.error,"failed to get fee calculator");const{context:o,value:s}=i.result;return{context:o,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){const n=Ie(t.serialize()).toString("base64"),r=this._buildArgs([n],e),i=await this._rpcRequest("getFeeForMessage",r),o=(0,Dt.Ue)(i,or((0,Dt.AG)((0,Dt.Rx)())));if("error"in o)throw new Hn(o.error,"failed to get fee for message");if(null===o.result)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(t){const e=t?.lockedWritableAccounts?.map((t=>t.toBase58())),n=e?.length?[e]:[],r=await this._rpcRequest("getRecentPrioritizationFees",n),i=(0,Dt.Ue)(r,Mr);if("error"in i)throw new Hn(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,void 0,n),i=await this._rpcRequest("getLatestBlockhash",r),o=(0,Dt.Ue)(i,Li);if("error"in o)throw new Hn(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgs([t],n,void 0,r),o=await this._rpcRequest("isBlockhashValid",i),s=(0,Dt.Ue)(o,$i);if("error"in s)throw new Hn(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){const t=await this._rpcRequest("getVersion",[]),e=(0,Dt.Ue)(t,ir(br));if("error"in e)throw new Hn(e.error,"failed to get version");return e.result}async getGenesisHash(){const t=await this._rpcRequest("getGenesisHash",[]),e=(0,Dt.Ue)(t,ir((0,Dt.Z_)()));if("error"in e)throw new Hn(e.error,"failed to get genesis hash");return e.result}async getBlock(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,Dt.Ue)(o,Mi);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,Dt.Ue)(o,ki);if("error"in t)throw t.error;return t.result}default:{const t=(0,Dt.Ue)(o,vi);if("error"in t)throw t.error;const{result:e}=t;return e?{...e,transactions:e.transactions.map((({transaction:t,meta:e,version:n})=>({meta:e,transaction:{...t,message:ar(n,t.message)},version:n})))}:null}}}catch(t){throw new Hn(t,"failed to get confirmed block")}}async getParsedBlock(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const t=(0,Dt.Ue)(o,Si);if("error"in t)throw t.error;return t.result}case"none":{const t=(0,Dt.Ue)(o,Ii);if("error"in t)throw t.error;return t.result}default:{const t=(0,Dt.Ue)(o,Ai);if("error"in t)throw t.error;return t.result}}}catch(t){throw new Hn(t,"failed to get block")}}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=await this._rpcRequest("getBlockProduction",r),o=(0,Dt.Ue)(i,_r);if("error"in o)throw new Hn(o.error,"failed to get block production information");return o.result}async getTransaction(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgsAtLeastConfirmed([t],n,void 0,r),o=await this._rpcRequest("getTransaction",i),s=(0,Dt.Ue)(o,Ti);if("error"in s)throw new Hn(s.error,"failed to get transaction");const a=s.result;return a?{...a,transaction:{...a.transaction,message:ar(a.version,a.transaction.message)}}:a}async getParsedTransaction(t,e){const{commitment:n,config:r}=er(e),i=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r),o=await this._rpcRequest("getTransaction",i),s=(0,Dt.Ue)(o,Pi);if("error"in s)throw new Hn(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){const{commitment:n,config:r}=er(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,Dt.Ue)(t,Pi);if("error"in e)throw new Hn(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const{commitment:n,config:r}=er(e),i=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((t=>{const e=(0,Dt.Ue)(t,Ti);if("error"in e)throw new Hn(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:ar(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,Dt.Ue)(r,xi);if("error"in i)throw new Hn(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");const s={...o,transactions:o.transactions.map((({transaction:t,meta:e})=>{const n=new en(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...s,transactions:s.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:un.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=await this._rpcRequest("getBlocks",r),o=(0,Dt.Ue)(i,ir((0,Dt.IX)((0,Dt.Rx)())));if("error"in o)throw new Hn(o.error,"failed to get blocks");return o.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),i=(0,Dt.Ue)(r,Ei);if("error"in i)throw new Hn(i.error,"failed to get block");const o=i.result;if(!o)throw new Error("Block "+t+" not found");return o}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getConfirmedBlock",n),i=(0,Dt.Ue)(r,Ei);if("error"in i)throw new Hn(i.error,"failed to get confirmed block");const o=i.result;if(!o)throw new Error("Confirmed block "+t+" not found");return o}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,Dt.Ue)(r,Ti);if("error"in i)throw new Hn(i.error,"failed to get transaction");const o=i.result;if(!o)return o;const s=new en(o.transaction.message),a=o.transaction.signatures;return{...o,transaction:un.populate(s,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=await this._rpcRequest("getConfirmedTransaction",n),i=(0,Dt.Ue)(r,Pi);if("error"in i)throw new Hn(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=(0,Dt.Ue)(t,Pi);if("error"in e)throw new Hn(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getConfirmedSignaturesForAddress2",r),o=(0,Dt.Ue)(i,jr);if("error"in o)throw new Hn(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=await this._rpcRequest("getSignaturesForAddress",r),o=(0,Dt.Ue)(i,Yr);if("error"in o)throw new Hn(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=new Vn({key:t,state:Vn.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=xn.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),r=(0,Dt.Ue)(n,Ci);if("error"in r)throw new Hn(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await vn(100);const t=Date.now()-this._blockhashInfo.lastFetch>=tr;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await vn(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:e,config:n}=er(t),r=this._buildArgs([],e,"base64",n),i=await this._rpcRequest("getStakeMinimumDelegation",r),o=(0,Dt.Ue)(i,or((0,Dt.Rx)()));if("error"in o)throw new Hn(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(t,e,n){if("message"in t){const r=t.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(e)||void 0!==n)throw new Error("Invalid arguments");const s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment);const a=[o,s],u=await this._rpcRequest("simulateTransaction",a),c=(0,Dt.Ue)(u,wr);if("error"in c)throw new Error("failed to simulate transaction: "+c.error.message);return c.result}let r;if(t instanceof un){let e=t;r=new un,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=un.populate(t),r._message=r._json=void 0;if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid arguments");const o=e;if(r.nonceInfo&&o)r.sign(...o);else{let t=this._disableBlockhashCaching;for(;;){const e=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=e.lastValidBlockHeight,r.recentBlockhash=e.blockhash,!o)break;if(r.sign(...o),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}t=!0}}const s=r._compile(),a=s.serialize(),u=r._serialize(a).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:s.nonProgramIds()).map((t=>t.toBase58()));c.accounts={encoding:"base64",addresses:t}}o&&(c.sigVerify=!0);const d=[u,c],l=await this._rpcRequest("simulateTransaction",d),h=(0,Dt.Ue)(l,wr);if("error"in h){let t;if("data"in h.error&&(t=h.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(h.error.message,n)}throw new Fn("failed to simulate transaction: "+h.error.message,t)}return h.result}async sendTransaction(t,e,n){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const n=t.serialize();return await this.sendRawTransaction(n,e)}if(void 0===e||!Array.isArray(e))throw new Error("Invalid arguments");const r=e;if(t.nonceInfo)t.sign(...r);else{let e=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(e);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...r),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}e=!0}}const i=t.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(t,e){const n=Ie(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=!0===r?"processed":e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],s=await this._rpcRequest("sendTransaction",o),a=(0,Dt.Ue)(s,Ni);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new Fn("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(t,e){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,n!==e.state){const n=this._subscriptionStateChangeCallbacksByHash[t];n&&n.forEach((t=>{try{t(e.state)}catch{}}))}}_onSubscriptionStateChange(t,e){const n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(e),()=>{r.delete(e),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const e=await this._rpcWebSocket.call(i,r);this._setSubscription(t,{...n,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Fr);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=Un([t.method,e]),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];Ze(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Hr);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Ui);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,qr);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Gr);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Zr);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),s=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=(0,Dt.Ue)(t,Xr);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class Fi{constructor(t){this._keypair=void 0,this._keypair=t??ve()}static generate(){return new Fi(ve())}static fromSecretKey(t,e){if(64!==t.byteLength)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const e=t.slice(0,32),r=ke(e);for(let t=0;t<32;t++)if(n[t]!==r[t])throw new Error("provided secretKey is invalid")}return new Fi({publicKey:n,secretKey:t})}static fromSeed(t){const e=ke(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new Fi({publicKey:e,secretKey:n})}get publicKey(){return new Re(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const Wi=Object.freeze({CreateLookupTable:{index:0,layout:Rt.struct([Rt.u32("instruction"),En("recentSlot"),Rt.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Rt.struct([Rt.u32("instruction")])},ExtendLookupTable:{index:2,layout:Rt.struct([Rt.u32("instruction"),En(),Rt.seq(We(),Rt.offset(Rt.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Rt.struct([Rt.u32("instruction")])},CloseLookupTable:{index:4,layout:Rt.struct([Rt.u32("instruction")])}});class Hi{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Wi))if(r.index==e){n=t;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);const{recentSlot:e}=Mn(Wi.CreateLookupTable,t.data);return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error(`invalid instruction; found ${t.keys.length} keys, expected at least 2`);const{addresses:e}=Mn(Wi.ExtendLookupTable,t.data);return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((t=>new Re(t)))}}static decodeCloseLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}static decodeFreezeLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static decodeDeactivateLookupTable(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(Ki.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(t,e){if(t.lengtht.toBytes()))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Bn.programId,isSigner:!1,isWritable:!1}),new an({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=kn(Wi.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new an({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=kn(Wi.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new an({programId:this.programId,keys:n,data:e})}}Ki.programId=new Re("AddressLookupTab1e1111111111111111111111111");class qi{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u8("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(Vi))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=Mn(Vi.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=Mn(Vi.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=Mn(Vi.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=Mn(Vi.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(Gi.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const Vi=Object.freeze({RequestUnits:{index:0,layout:Rt.struct([Rt.u8("instruction"),Rt.u32("units"),Rt.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:Rt.struct([Rt.u8("instruction"),Rt.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:Rt.struct([Rt.u8("instruction"),Rt.u32("units")])},SetComputeUnitPrice:{index:3,layout:Rt.struct([Rt.u8("instruction"),En("microLamports")])}});class Gi{constructor(){}static requestUnits(t){const e=kn(Vi.RequestUnits,t);return new an({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=kn(Vi.RequestHeapFrame,t);return new an({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=kn(Vi.SetComputeUnitLimit,t);return new an({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=kn(Vi.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new an({keys:[],programId:this.programId,data:e})}}Gi.programId=new Re("ComputeBudget111111111111111111111111111111");const Zi=Rt.struct([Rt.u8("numSignatures"),Rt.u8("padding"),Rt.u16("signatureOffset"),Rt.u16("signatureInstructionIndex"),Rt.u16("publicKeyOffset"),Rt.u16("publicKeyInstructionIndex"),Rt.u16("messageDataOffset"),Rt.u16("messageDataSize"),Rt.u16("messageInstructionIndex")]);class Xi{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:o}=t;Ze(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),Ze(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const s=Zi.span,a=s+e.length,u=a+r.length,c=i.Buffer.alloc(u+n.length),d=null==o?65535:o;return Zi.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},c),c.fill(e,s),c.fill(r,a),c.fill(n,u),new an({keys:[],programId:Xi.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;Ze(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=Fi.fromSecretKey(e),i=t.publicKey.toBytes(),o=Ae(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}Xi.programId=new Re("Ed25519SigVerify111111111111111111111111111"),we.utils.isValidPrivateKey;const Ji=we.getPublicKey,Qi=Rt.struct([Rt.u8("numSignatures"),Rt.u16("signatureOffset"),Rt.u8("signatureInstructionIndex"),Rt.u16("ethAddressOffset"),Rt.u8("ethAddressInstructionIndex"),Rt.u16("messageDataOffset"),Rt.u16("messageDataSize"),Rt.u8("messageInstructionIndex"),Rt.blob(20,"ethAddress"),Rt.blob(64,"signature"),Rt.u8("recoveryId")]);class to{constructor(){}static publicKeyToEthAddress(t){Ze(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return i.Buffer.from(ne(Ie(t))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return to.createInstructionWithEthAddress({ethAddress:to.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:o,instructionIndex:s=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?i.Buffer.from(e.substr(2),"hex"):i.Buffer.from(e,"hex"):e,Ze(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,c=u+r.length+1,d=i.Buffer.alloc(Qi.span+n.length);return Qi.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:s,signature:Ie(r),ethAddress:Ie(a),recoveryId:o},d),d.fill(Ie(n),Qi.span),new an({keys:[],programId:to.programId,data:d})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;Ze(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=Ie(e),o=Ji(t,!1).slice(1),s=i.Buffer.from(ne(Ie(n))),[a,u]=((t,e)=>{const n=we.sign(t,e);return[n.toCompactRawBytes(),n.recovery]})(s,t);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,recoveryId:u,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}var eo;to.programId=new Re("KeccakSecp256k11111111111111111111111111111");const no=new Re("StakeConfig11111111111111111111111111111111");class ro{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class io{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}eo=io,io.default=new eo(0,0,Re.default);class oo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(so))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=Mn(so.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new ro(new Re(e.staker),new Re(e.withdrawer)),lockup:new io(n.unixTimestamp,n.epoch,new Re(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),Mn(so.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=Mn(so.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Re(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Mn(so.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new Re(i),newAuthorizedPubkey:new Re(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Mn(so.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Mn(so.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=Mn(so.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Mn(so.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(uo.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.lengthRt.struct([We("staker"),We("withdrawer")],t))(),((t="lockup")=>Rt.struct([Rt.ns64("unixTimestamp"),Rt.ns64("epoch"),We("custodian")],t))()])},Authorize:{index:1,layout:Rt.struct([Rt.u32("instruction"),We("newAuthorized"),Rt.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:Rt.struct([Rt.u32("instruction")])},Split:{index:3,layout:Rt.struct([Rt.u32("instruction"),Rt.ns64("lamports")])},Withdraw:{index:4,layout:Rt.struct([Rt.u32("instruction"),Rt.ns64("lamports")])},Deactivate:{index:5,layout:Rt.struct([Rt.u32("instruction")])},Merge:{index:7,layout:Rt.struct([Rt.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:Rt.struct([Rt.u32("instruction"),We("newAuthorized"),Rt.u32("stakeAuthorizationType"),Ke("authoritySeed"),We("authorityOwner")])}}),ao=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class uo{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||io.default,o=kn(so.Initialize,{authorized:{staker:Ie(n.staker.toBuffer()),withdrawer:Ie(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Ie(i.custodian.toBuffer())}}),s={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mn,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new an(s)}static createAccountWithSeed(t){const e=new un;e.add(Bn.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new un;e.add(Bn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=kn(so.Delegate);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:wn,isSigner:!1,isWritable:!1},{pubkey:no,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,s=kn(so.Authorize,{newAuthorized:Ie(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new un).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=kn(so.AuthorizeWithSeed,{newAuthorized:Ie(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:Ie(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new un).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=kn(so.Split,{lamports:i});return new an({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t,e){const n=new un;return n.add(Bn.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),n.add(this.splitInstruction(t))}static splitWithSeed(t,e){const{stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,basePubkey:o,seed:s,lamports:a}=t,u=new un;return u.add(Bn.allocate({accountPubkey:i,basePubkey:o,seed:s,space:this.space,programId:this.programId})),e&&e>0&&u.add(Bn.transfer({fromPubkey:t.authorizedPubkey,toPubkey:i,lamports:e})),u.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,lamports:a}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=kn(so.Merge);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:wn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,s=kn(so.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:wn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new un).add({keys:a,programId:this.programId,data:s})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=kn(so.Deactivate);return(new un).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}uo.programId=new Re("Stake11111111111111111111111111111111111111"),uo.space=200;class co{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}class lo{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=Rt.u32("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(ho))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=Mn(ho.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new co(new Re(e.nodePubkey),new Re(e.authorizedVoter),new Re(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=Mn(ho.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new Re(e),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:e,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Mn(ho.AuthorizeWithSeed,t.data);return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new Re(e),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new Re(r),voteAuthorizationType:{index:i},votePubkey:t.keys[0].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=Mn(ho.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(po.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.lengthRt.struct([We("nodePubkey"),We("authorizedVoter"),We("authorizedWithdrawer"),Rt.u8("commission")],t))()])},Authorize:{index:1,layout:Rt.struct([Rt.u32("instruction"),We("newAuthorized"),Rt.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:Rt.struct([Rt.u32("instruction"),Rt.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:Rt.struct([Rt.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:Rt.struct([Rt.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>Rt.struct([Rt.u32("voteAuthorizationType"),We("currentAuthorityDerivedKeyOwnerPubkey"),Ke("currentAuthorityDerivedKeySeed"),We("newAuthorized")],t))()])}}),fo=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class po{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=kn(ho.InitializeAccount,{voteInit:{nodePubkey:Ie(r.nodePubkey.toBuffer()),authorizedVoter:Ie(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Ie(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mn,isSigner:!1,isWritable:!1},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new an(o)}static createAccount(t){const e=new un;return e.add(Bn.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=kn(ho.Authorize,{newAuthorized:Ie(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=kn(ho.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Ie(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Ie(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:ln,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new un).add({keys:u,programId:this.programId,data:a})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=kn(ho.Withdraw,{lamports:r}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return po.withdraw(t)}static updateValidatorIdentity(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,nodePubkey:r}=t,i=kn(ho.UpdateValidatorIdentity),o=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new un).add({keys:o,programId:this.programId,data:i})}}po.programId=new Re("Vote111111111111111111111111111111111111111"),po.space=3762;const mo=new Re("Va1idator1nfo111111111111111111111111111111"),go=(0,Dt.dt)({name:(0,Dt.Z_)(),website:(0,Dt.jt)((0,Dt.Z_)()),details:(0,Dt.jt)((0,Dt.Z_)()),keybaseUsername:(0,Dt.jt)((0,Dt.Z_)())});class yo{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==Ve(e))return null;const n=[];for(let t=0;t<2;t++){const t=new Re(tn(e,0,Le)),r=1===Qe(e);n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(mo)&&n[1].isSigner){const t=Ke().decode(i.Buffer.from(e)),r=JSON.parse(t);return(0,Dt.hu)(r,go),new yo(n[1].publicKey,r)}return null}}const bo=new Re("Vote111111111111111111111111111111111111111"),wo=Rt.struct([We("nodePubkey"),We("authorizedWithdrawer"),Rt.u8("commission"),Rt.nu64(),Rt.seq(Rt.struct([Rt.nu64("slot"),Rt.u32("confirmationCount")]),Rt.offset(Rt.u32(),-8),"votes"),Rt.u8("rootSlotValid"),Rt.nu64("rootSlot"),Rt.nu64(),Rt.seq(Rt.struct([Rt.nu64("epoch"),We("authorizedVoter")]),Rt.offset(Rt.u32(),-8),"authorizedVoters"),Rt.struct([Rt.seq(Rt.struct([We("authorizedPubkey"),Rt.nu64("epochOfLastAuthorizedSwitch"),Rt.nu64("targetEpoch")]),32,"buf"),Rt.nu64("idx"),Rt.u8("isEmpty")],"priorVoters"),Rt.nu64(),Rt.seq(Rt.struct([Rt.nu64("epoch"),Rt.nu64("credits"),Rt.nu64("prevCredits")]),Rt.offset(Rt.u32(),-8),"epochCredits"),Rt.struct([Rt.nu64("slot"),Rt.nu64("timestamp")],"lastTimestamp")]);class _o{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=wo.decode(Ie(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new _o({nodePubkey:new Re(e.nodePubkey),authorizedWithdrawer:new Re(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(vo),priorVoters:Mo(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function vo({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new Re(t)}}function ko({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new Re(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function Mo({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(ko),...t.slice(0,e).map(ko)]}const Ao={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function So(t,e){const n=!1===e?"http":"https";if(!t)return Ao[n].devnet;const r=Ao[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r}async function Io(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await t.sendRawTransaction(e,s),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(a,u),d=(await c).value;if(d.err)throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`);return a}const xo=1e9},39809:(t,e,n)=>{"use strict";const r=e;r.bignum=n(4590),r.define=n(22500).define,r.base=n(71979),r.constants=n(36826),r.decoders=n(78307),r.encoders=n(56579)},22500:(t,e,n)=>{"use strict";const r=n(56579),i=n(78307),o=n(35717);function s(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new s(t,e)},s.prototype._createNamed=function(t){const e=this.name;function n(t){this._initNamed(t,e)}return o(n,t),n.prototype._initNamed=function(e,n){t.call(this,e,n)},new n(this)},s.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i[t])),this.decoders[t]},s.prototype.decode=function(t,e,n){return this._getDecoder(e).decode(t,n)},s.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r[t])),this.encoders[t]},s.prototype.encode=function(t,e,n){return this._getEncoder(e).encode(t,n)}},36625:(t,e,n)=>{"use strict";const r=n(35717),i=n(98465).b,o=n(2399).Buffer;function s(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function a(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return a.isEncoderBuffer(t)||(t=new a(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}r(s,i),e.C=s,s.isDecoderBuffer=function(t){return t instanceof s||"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},s.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function(t){const e=new s(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.R=a,a.isEncoderBuffer=function(t){return t instanceof a||"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},a.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(t,e),e+=n.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},71979:(t,e,n)=>{"use strict";const r=e;r.Reporter=n(98465).b,r.DecoderBuffer=n(36625).C,r.EncoderBuffer=n(36625).R,r.Node=n(41949)},41949:(t,e,n)=>{"use strict";const r=n(98465).b,i=n(36625).R,o=n(36625).C,s=n(79746),a=["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"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function c(t,e,n){const r={};this._baseState=r,r.name=n,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=c;const d=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const t=this._baseState,e={};d.forEach((function(n){e[n]=t[n]}));const n=new this.constructor(e.parent);return n._baseState=e,n},c.prototype._wrap=function(){const t=this._baseState;u.forEach((function(e){this[e]=function(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}}),this)},c.prototype._init=function(t){const e=this._baseState;s(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),s.equal(e.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(t){const e=this._baseState,n=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==n.length&&(s(null===e.children),e.children=n,n.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(s(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(n){n==(0|n)&&(n|=0);const r=t[n];e[r]=n})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){c.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),a.forEach((function(t){c.prototype[t]=function(){const e=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===e.tag),e.tag=t,this._useArgs(n),this}})),c.prototype.use=function(t){s(t);const e=this._baseState;return s(null===e.use),e.use=t,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(t){const e=this._baseState;return s(null===e.default),e.default=t,e.optional=!0,this},c.prototype.explicit=function(t){const e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.explicit=t,this},c.prototype.implicit=function(t){const e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.implicit=t,this},c.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},c.prototype.key=function(t){const e=this._baseState;return s(null===e.key),e.key=t,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(t){const e=this._baseState;return s(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},c.prototype.contains=function(t){const e=this._baseState;return s(null===e.use),e.contains=t,this},c.prototype._decode=function(t,e){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,e));let r,i=n.default,s=!0,a=null;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(s=this._peekTag(t,r,n.any),t.isError(s))return s}else{const r=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e),s=!0}catch(t){s=!1}t.restore(r)}}if(n.obj&&s&&(r=t.enterObject()),s){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const r=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(e&&e.track&&null!==n.tag&&e.track(t.path(),r,t.length,"tagged"),e&&e.track&&null!==n.tag&&e.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(t,e)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const r=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(r,e)}}return n.obj&&s&&(i=t.leaveObject(r)),null===n.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,i),i},c.prototype._decodeGeneric=function(t,e,n){const r=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,r.args[0],n):/str$/.test(t)?this._decodeStr(e,t,n):"objid"===t&&r.args?this._decodeObjid(e,r.args[0],r.args[1],n):"objid"===t?this._decodeObjid(e,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(e,t,n):"null_"===t?this._decodeNull(e,n):"bool"===t?this._decodeBool(e,n):"objDesc"===t?this._decodeStr(e,t,n):"int"===t||"enum"===t?this._decodeInt(e,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,e._reporterState.obj)._decode(e,n):e.error("unknown tag: "+t)},c.prototype._getUse=function(t,e){const n=this._baseState;return n.useDecoder=this._use(t,e),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},c.prototype._decodeChoice=function(t,e){const n=this._baseState;let r=null,i=!1;return Object.keys(n.choice).some((function(o){const s=t.save(),a=n.choice[o];try{const n=a._decode(t,e);if(t.isError(n))return!1;r={type:o,value:n},i=!0}catch(e){return t.restore(s),!1}return!0}),this),i?r:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},c.prototype._encode=function(t,e,n){const r=this._baseState;if(null!==r.default&&r.default===t)return;const i=this._encodeValue(t,e,n);return void 0===i||this._skipDefault(i,e,n)?void 0:i},c.prototype._encodeValue=function(t,e,n){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new r);let o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let s=null,a=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)s=this._getUse(i.contains,n)._encode(t,e),a=!0;else if(i.children)s=i.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,e,t);if(null===n._baseState.key)return e.error("Child should have a key");const r=e.enterKey(n._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=n._encode(t[n._baseState.key],e,t);return e.leaveKey(r),i}),this).filter((function(t){return t})),s=this._createEncoderBuffer(s);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,s=this._createEncoderBuffer(t.map((function(n){const r=this._baseState;return this._getUse(r.args[0],t)._encode(n,e)}),n))}else null!==i.use?o=this._getUse(i.use,n)._encode(t,e):(s=this._encodePrimitive(i.tag,t),a=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,n=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(t,a,n,s))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(t,e){const n=this._baseState,r=n.choice[t.type];return r||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(t.value,e)},c.prototype._encodePrimitive=function(t,e){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&n.args)return this._encodeObjid(e,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},98465:(t,e,n)=>{"use strict";const r=n(35717);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.b=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,n){const r=this._reporterState;this.exitKey(t),null!==r.obj&&(r.obj[e]=n)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){const e=this._reporterState,n=e.obj;return e.obj=t,n},i.prototype.error=function(t){let e;const n=this._reporterState,r=t instanceof o;if(e=r?t:new o(n.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!n.options.partial)throw e;return r||n.errors.push(e),e},i.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},r(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},70160:(t,e)=>{"use strict";function n(t){const e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);const r=t[n];e[r]=n})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=n(e.tagClass),e.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"},e.tagByName=n(e.tag)},36826:(t,e,n)=>{"use strict";const r=e;r._reverse=function(t){const e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);const r=t[n];e[r]=n})),e},r.der=n(70160)},41671:(t,e,n)=>{"use strict";const r=n(35717),i=n(4590),o=n(36625).C,s=n(41949),a=n(70160);function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){s.call(this,"der",t)}function d(t,e){let n=t.readUInt8(e);if(t.isError(n))return n;const r=a.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=t.readUInt8(e),t.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:a.tag[n]}}function l(t,e,n){let r=t.readUInt8(n);if(t.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return t.error("length octect is too long");r=0;for(let e=0;e{"use strict";const r=e;r.der=n(41671),r.pem=n(59631)},59631:(t,e,n)=>{"use strict";const r=n(35717),i=n(2399).Buffer,o=n(41671);function s(t){o.call(this,t),this.enc="pem"}r(s,o),t.exports=s,s.prototype.decode=function(t,e){const n=t.toString().split(/[\r\n]+/g),r=e.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/;let a=-1,u=-1;for(let t=0;t{"use strict";const r=n(35717),i=n(2399).Buffer,o=n(41949),s=n(70160);function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.call(this,"der",t)}function c(t){return t<10?"0"+t:t}t.exports=a,a.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(u,o),u.prototype._encodeComposite=function(t,e,n,r){const o=function(t,e,n,r){let i;if("seqof"===t?t="seq":"setof"===t&&(t="set"),s.tagByName.hasOwnProperty(t))i=s.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return r.error("Unknown tag: "+t);i=t}return i>=31?r.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=s.tagClassByName[n||"universal"]<<6,i)}(t,e,n,this.reporter);if(r.length<128){const t=i.alloc(2);return t[0]=o,t[1]=r.length,this._createEncoderBuffer([t,r])}let a=1;for(let t=r.length;t>=256;t>>=8)a++;const u=i.alloc(2+a);u[0]=o,u[1]=128|a;for(let t=1+a,e=r.length;e>0;t--,e>>=8)u[t]=255&e;return this._createEncoderBuffer([u,r])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=i.alloc(2*t.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let r=0;for(let e=0;e=128;n>>=7)r++}const o=i.alloc(r);let s=o.length-1;for(let e=t.length-1;e>=0;e--){let n=t[e];for(o[s--]=127&n;(n>>=7)>0;)o[s--]=128|127&n}return this._createEncoderBuffer(o)},u.prototype._encodeTime=function(t,e){let n;const r=new Date(t);return"gentime"===e?n=[c(r.getUTCFullYear()),c(r.getUTCMonth()+1),c(r.getUTCDate()),c(r.getUTCHours()),c(r.getUTCMinutes()),c(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?n=[c(r.getUTCFullYear()%100),c(r.getUTCMonth()+1),c(r.getUTCDate()),c(r.getUTCHours()),c(r.getUTCMinutes()),c(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(n,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=i.from(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const n=i.alloc(e);return t.copy(n),0===t.length&&(n[0]=0),this._createEncoderBuffer(n)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let n=1;for(let e=t;e>=256;e>>=8)n++;const r=new Array(n);for(let e=r.length-1;e>=0;e--)r[e]=255&t,t>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(i.from(r))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,n){const r=this._baseState;let i;if(null===r.default)return!1;const o=t.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,e,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i{"use strict";const r=e;r.der=n(66984),r.pem=n(2883)},2883:(t,e,n)=>{"use strict";const r=n(35717),i=n(66984);function o(t){i.call(this,t),this.enc="pem"}r(o,i),t.exports=o,o.prototype.encode=function(t,e){const n=i.prototype.encode.call(this,t).toString("base64"),r=["-----BEGIN "+e.label+"-----"];for(let t=0;t=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},58162:(t,e,n)=>{"use strict";var r=n(89509).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,d=new Uint8Array(s);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,f=s-1;(0!==l||h>>0,d[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,n++}for(var p=s-o;p!==s&&0===d[p];)p++;var m=r.allocUnsafe(i+(s-p));m.fill(0,0,i);for(var g=i;p!==s;)m[g++]=d[p++];return m}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=r.from(e)),!r.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var n=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,n++;for(var c=(s-o)*d+1>>>0,l=new Uint8Array(c);o!==s;){for(var h=e[o],f=0,p=c-1;(0!==h||f>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");i=f,o++}for(var m=c-i;m!==c&&0===l[m];)m++;for(var g=u.repeat(n);m{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],u=o[1],c=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,u)),d=0,l=u>0?s-4:s;for(n=0;n>16&255,c[d++]=e>>8&255,c[d++]=255&e;return 2===u&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,c[d++]=255&e),1===u&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,c[d++]=e>>8&255,c[d++]=255&e),c},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,c=r-i;ac?c:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,r){for(var i,o,s=[],a=e;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},40475:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.toBigIntLE=function(t){{const e=r.from(t);e.reverse();const n=e.toString("hex");return 0===n.length?BigInt(0):BigInt(`0x${n}`)}},e.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}},e.toBufferLE=function(t,e){{const n=t.toString(16),i=r.from(n.padStart(2*e,"0").slice(0,2*e),"hex");return i.reverse(),i}},e.toBufferBE=function(t,e){{const n=t.toString(16);return r.from(n.padStart(2*e,"0").slice(0,2*e),"hex")}}},44431:function(t,e,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",d=c+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,f=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,g=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function b(t){for(var e,n,r=1,i=t.length,o=t[0]+"";rc^n?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;so[s]^n?1:-1;return u==c?0:u>c^n?1:-1}function _(t,e,n,r){if(tn||t!==u(t))throw Error(c+(r||"Argument")+("number"==typeof t?tn?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function v(t){var e=t.c.length-1;return y(t.e/h)==e&&t.c[e]%2!=0}function k(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function M(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else eC?y.c=y.e=null:t.e=10;l/=10,c++);return void(c>C?y.c=y.e=null:(y.e=c,y.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(y,g,p);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(c=g.indexOf("."))>-1&&(g=g.replace(".","")),(l=g.search(/e/i))>0?(c<0&&(c=l),c+=+g.slice(l+1),g=g.substring(0,l)):c<0&&(c=g.length)}else{if(_(e,2,Y.length,"Base"),10==e&&F)return V(y=new W(t),L+y.e+1,$);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(y,g,p,e);if(y.s=1/t<0?(g=g.slice(1),-1):1,W.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(d+t)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(n=Y.slice(0,e),c=l=0,m=g.length;lc){c=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,l=-1,c=0;continue}return i(y,String(t),p,e)}p=!1,(c=(g=r(g,e,10,y.s)).indexOf("."))>-1?g=g.replace(".",""):c=g.length}for(l=0;48===g.charCodeAt(l);l++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(l,++m)){if(m-=l,p&&W.DEBUG&&m>15&&(t>f||t!==u(t)))throw Error(d+y.s*t);if((c=c-l-1)>C)y.c=y.e=null;else if(c=O)?k(u,s):M(u,s,"0");else if(o=(t=V(new W(t),e,n)).e,a=(u=b(t.c)).length,1==r||2==r&&(e<=o||o<=R)){for(;aa){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-a)>0)for(o+1==a&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function K(t,e){for(var n,r,i=1,o=new W(t[0]);i=10;i/=10,r++);return(n=r+n*h-1)>C?t.c=t.e=null:n=10;c/=10,i++);if((o=e-i)<0)o+=h,s=e,d=g[f=0],m=u(d/y[i-s-1]%10);else if((f=a((o+1)/h))>=g.length){if(!r)break t;for(;g.length<=f;g.push(0));d=m=0,i=1,s=(o%=h)-h+1}else{for(d=c=g[f],i=1;c>=10;c/=10,i++);m=(s=(o%=h)-h+i)<0?0:u(d/y[i-s-1]%10)}if(r=r||e<0||null!=g[f+1]||(s<0?d:d%y[i-s-1]),r=n<4?(m||r)&&(0==n||n==(t.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(o>0?s>0?d/y[i-s]:0:g[f-1])%10&1||n==(t.s<0?8:7)),e<1||!g[0])return g.length=0,r?(e-=t.e+1,g[0]=y[(h-e%h)%h],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=f,c=1,f--):(g.length=f+1,c=y[h-o],g[f]=s>0?u(d/y[i-s]%y[s])*c:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(t.e++,g[0]==l&&(g[0]=1));break}if(g[f]+=c,g[f]!=l)break;g[f--]=0,c=1}for(o=g.length;0===g[--o];g.pop());}t.e>C?t.c=t.e=null:t.e=O?k(e,n):M(e,n,"0"),t.s<0?"-"+e:e)}return W.clone=t,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(c+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(_(n=t[e],0,g,e),L=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(_(n=t[e],0,8,e),$=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(_(n[0],-g,0,e),_(n[1],0,g,e),R=n[0],O=n[1]):(_(n,-g,g,e),R=-(O=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)_(n[0],-g,-1,e),_(n[1],1,g,e),D=n[0],C=n[1];else{if(_(n,-g,g,e),!n)throw Error(c+e+" cannot be zero: "+n);D=-(C=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(c+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw N=!n,Error(c+"crypto unavailable");N=n}else N=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(_(n=t[e],0,9,e),z=n),t.hasOwnProperty(e="POW_PRECISION")&&(_(n=t[e],0,g,e),U=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(c+e+" not an object: "+n);j=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(c+e+" invalid: "+n);F="0123456789"==n.slice(0,10),Y=n}}return{DECIMAL_PLACES:L,ROUNDING_MODE:$,EXPONENTIAL_AT:[R,O],RANGE:[D,C],CRYPTO:N,MODULO_MODE:z,POW_PRECISION:U,FORMAT:j,ALPHABET:Y}},W.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!W.DEBUG)return!0;var e,n,r=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===u(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%h)<1&&(e+=h),String(r[0]).length==e){for(e=0;e=l||n!==u(n))break t;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+t)},W.maximum=W.max=function(){return K(arguments,-1)},W.minimum=W.min=function(){return K(arguments,1)},W.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return u(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,o,s=0,d=[],l=new W(B);if(null==t?t=L:_(t,0,g),i=a(t/h),N)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[s]=n[0],e[s+1]=n[1]):(d.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw N=!1,Error(c+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(e,s):(d.push(o%1e14),s+=7);s=i/7}if(!N)for(;s=10;o/=10,s++);sn-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var u,c,d,l,h,f,p,m,g=r.indexOf("."),y=L,w=$;for(g>=0&&(l=U,U=0,r=r.replace(".",""),f=(m=new W(i)).pow(r.length-g),U=l,m.c=e(M(b(f.c),f.e,"0"),10,o,t),m.e=m.c.length),d=l=(p=e(r,i,o,a?(u=Y,t):(u=t,Y))).length;0==p[--l];p.pop());if(!p[0])return u.charAt(0);if(g<0?--d:(f.c=p,f.e=d,f.s=s,p=(f=n(f,m,y,w,o)).c,h=f.r,d=f.e),g=p[c=d+y+1],l=o/2,h=h||c<0||null!=p[c+1],h=w<4?(null!=g||h)&&(0==w||w==(f.s<0?3:2)):g>l||g==l&&(4==w||h||6==w&&1&p[c-1]||w==(f.s<0?8:7)),c<1||!p[0])r=h?M(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(p.length=c,h)for(--o;++p[--c]>o;)p[c]=0,c||(++d,p=[1].concat(p));for(l=p.length;!p[--l];);for(g=0,r="";g<=l;r+=u.charAt(p[g++]));r=M(r,d,u.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,u=t.length,c=e%m,d=e/m|0;for(t=t.slice();u--;)a=((i=c*(o=t[u]%m)+(r=d*o+(s=t[u]/m|0)*c)%m*m+a)/n|0)+(r/m|0)+d*s,t[u]=i%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.splice(0,1));}return function(r,i,o,s,a){var c,d,f,p,m,g,b,w,_,v,k,M,A,S,I,x,E,T=r.s==i.s?1:-1,P=r.c,B=i.c;if(!(P&&P[0]&&B&&B[0]))return new W(r.s&&i.s&&(P?!B||P[0]!=B[0]:B)?P&&0==P[0]||!B?0*T:T/0:NaN);for(_=(w=new W(T)).c=[],T=o+(d=r.e-i.e)+1,a||(a=l,d=y(r.e/h)-y(i.e/h),T=T/h|0),f=0;B[f]==(P[f]||0);f++);if(B[f]>(P[f]||0)&&d--,T<0)_.push(1),p=!0;else{for(S=P.length,x=B.length,f=0,T+=2,(m=u(a/(B[0]+1)))>1&&(B=t(B,m,a),P=t(P,m,a),x=B.length,S=P.length),A=x,k=(v=P.slice(0,x)).length;k=a/2&&I++;do{if(m=0,(c=e(B,v,x,k))<0){if(M=v[0],x!=k&&(M=M*a+(v[1]||0)),(m=u(M/I))>1)for(m>=a&&(m=a-1),b=(g=t(B,m,a)).length,k=v.length;1==e(g,v,b,k);)m--,n(g,x=10;T/=10,f++);V(w,o+(w.e=f+d*h-1)+1,s,p)}else w.e=d,w.r=+p;return w}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,x=/^\.([^.]+)$/,E=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(T,"");if(E.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(S,(function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e})),r&&(i=r,o=o.replace(I,"$1").replace(x,"0.$1")),e!=o))return new W(o,i);if(W.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},P.absoluteValue=P.abs=function(){var t=new W(this);return t.s<0&&(t.s=1),t},P.comparedTo=function(t,e){return w(this,new W(t,e))},P.decimalPlaces=P.dp=function(t,e){var n,r,i,o=this;if(null!=t)return _(t,0,g),null==e?e=$:_(e,0,8),V(new W(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-y(this.e/h))*h,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},P.dividedBy=P.div=function(t,e){return n(this,new W(t,e),L,$)},P.dividedToIntegerBy=P.idiv=function(t,e){return n(this,new W(t,e),0,1)},P.exponentiatedBy=P.pow=function(t,e){var n,r,i,o,s,d,l,f,p=this;if((t=new W(t)).c&&!t.isInteger())throw Error(c+"Exponent not an integer: "+G(t));if(null!=e&&(e=new W(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return f=new W(Math.pow(+G(p),s?t.s*(2-v(t)):+G(t))),e?f.mod(e):f;if(d=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new W(NaN);(r=!d&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&v(t)?-0:0,p.e>-1&&(o=1/o),new W(d?1/o:o);U&&(o=a(U/h+2))}for(s?(n=new W(.5),d&&(t.s=1),l=v(t)):l=(i=Math.abs(+G(t)))%2,f=new W(B);;){if(l){if(!(f=f.times(p)).c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(e))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(V(t=t.times(n),t.e+1,1),t.e>14)l=v(t);else{if(0==(i=+G(t)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(e))}return r?f:(d&&(f=B.div(f)),e?f.mod(e):o?V(f,U,$,void 0):f)},P.integerValue=function(t){var e=new W(this);return null==t?t=$:_(t,0,8),V(e,e.e+1,t)},P.isEqualTo=P.eq=function(t,e){return 0===w(this,new W(t,e))},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(t,e){return w(this,new W(t,e))>0},P.isGreaterThanOrEqualTo=P.gte=function(t,e){return 1===(e=w(this,new W(t,e)))||0===e},P.isInteger=function(){return!!this.c&&y(this.e/h)>this.c.length-2},P.isLessThan=P.lt=function(t,e){return w(this,new W(t,e))<0},P.isLessThanOrEqualTo=P.lte=function(t,e){return-1===(e=w(this,new W(t,e)))||0===e},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.minus=function(t,e){var n,r,i,o,s=this,a=s.s;if(e=(t=new W(t,e)).s,!a||!e)return new W(NaN);if(a!=e)return t.s=-e,s.plus(t);var u=s.e/h,c=t.e/h,d=s.c,f=t.c;if(!u||!c){if(!d||!f)return d?(t.s=-e,t):new W(f?s:NaN);if(!d[0]||!f[0])return f[0]?(t.s=-e,t):new W(d[0]?s:3==$?-0:0)}if(u=y(u),c=y(c),d=d.slice(),a=u-c){for((o=a<0)?(a=-a,i=d):(c=u,i=f),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=d.length)<(e=f.length))?a:e,a=e=0;e0)for(;e--;d[n++]=0);for(e=l-1;r>a;){if(d[--r]=0;){for(n=0,p=M[i]%_,g=M[i]/_|0,o=i+(s=u);o>i;)n=((c=p*(c=k[--s]%_)+(a=g*c+(d=k[s]/_|0)*p)%_*_+b[o]+n)/w|0)+(a/_|0)+g*d,b[o--]=c%w;b[o]=n}return n?++r:b.splice(0,1),q(t,b,r)},P.negated=function(){var t=new W(this);return t.s=-t.s||null,t},P.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new W(t,e)).s,!i||!e)return new W(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/h,s=t.e/h,a=r.c,u=t.c;if(!o||!s){if(!a||!u)return new W(i/0);if(!a[0]||!u[0])return u[0]?t:new W(a[0]?r:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(e=u.length)<0&&(n=u,u=a,a=n,e=i),i=0;e;)i=(a[--e]=a[e]+u[e]+i)/l|0,a[e]=l===a[e]?0:a[e]%l;return i&&(a=[i].concat(a),++s),q(t,a,s)},P.precision=P.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return _(t,1,g),null==e?e=$:_(e,0,8),V(new W(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*h+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},P.shiftedBy=function(t){return _(t,-9007199254740991,f),this.times("1e"+t)},P.squareRoot=P.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,u=s.s,c=s.e,d=L+4,l=new W("0.5");if(1!==u||!a||!a[0])return new W(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+G(s)))||u==1/0?(((e=b(a)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=y((c+1)/2)-(c<0||c%2),r=new W(e=u==1/0?"5e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):r=new W(u+""),r.c[0])for((u=(c=r.e)+d)<3&&(u=0);;)if(o=r,r=l.times(o.plus(n(s,o,d,1))),b(o.c).slice(0,u)===(e=b(r.c)).slice(0,u)){if(r.e0&&m>0){for(o=m%a||a,l=p.substr(0,o);o0&&(l+=d+p.slice(o)),f&&(l="-"+l)}r=h?l+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):l}return(n.prefix||"")+r+(n.suffix||"")},P.toFraction=function(t){var e,r,i,o,s,a,u,d,l,f,m,g,y=this,w=y.c;if(null!=t&&(!(u=new W(t)).isInteger()&&(u.c||1!==u.s)||u.lt(B)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+G(u));if(!w)return new W(y);for(e=new W(B),l=r=new W(B),i=d=new W(B),g=b(w),s=e.e=g.length-y.e-1,e.c[0]=p[(a=s%h)<0?h+a:a],t=!t||u.comparedTo(e)>0?s>0?e:l:u,a=C,C=1/0,u=new W(g),d.c[0]=0;f=n(u,e,0,1),1!=(o=r.plus(f.times(i))).comparedTo(t);)r=i,i=o,l=d.plus(f.times(o=l)),d=o,e=u.minus(f.times(o=e)),u=o;return o=n(t.minus(r),i,0,1),d=d.plus(o.times(l)),r=r.plus(o.times(i)),d.s=l.s=y.s,m=n(l,i,s*=2,$).minus(y).abs().comparedTo(n(d,r,s,$).minus(y).abs())<1?[l,i]:[d,r],C=a,m},P.toNumber=function(){return+G(this)},P.toPrecision=function(t,e){return null!=t&&_(t,1,g),H(this,t,e,2)},P.toString=function(t){var e,n=this,i=n.s,o=n.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=R||o>=O?k(b(n.c),o):M(b(n.c),o,"0"):10===t&&F?e=M(b((n=V(new W(n),L+o+1,$)).c),n.e,"0"):(_(t,2,Y.length,"Base"),e=r(M(b(n.c),o,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},P.valueOf=P.toJSON=function(){return G(this)},P._isBigNumber=!0,null!=e&&W.set(e),W}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(e,n,e,t))||(t.exports=r)}()},13550:function(t,e,n){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(46601).Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),u=e;u=49?c-49+10:c>=17?c-17+10:c,r(c>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],f=[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],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?h[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],d=p[t];n="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(d).toString(t);n=(l=l.idivn(d)).isZero()?m+n:h[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(t[n--]=s>>8&255),n>=0&&(t[n--]=s>>16&255),6===o?(n>=0&&(t[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function y(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function b(t,e,n){return y(t,e,n)}function w(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):n<63?m(this,t,e):n<1024?y(this,t,e):b(this,t,e)},w.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},w.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i&1}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new I(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){I.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(k,v),k.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},k.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new k;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return _[t]=e,e},I.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(d(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},I.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},I.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new x(t)},i(x,I),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},25532:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},u=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeUnchecked=e.deserialize=e.serialize=e.BinaryReader=e.BinaryWriter=e.BorshError=e.baseDecode=e.baseEncode=void 0;const c=u(n(13550)),d=u(n(77191)),l=a(n(21127)),h=new("function"!=typeof TextDecoder?l.TextDecoder:TextDecoder)("utf-8",{fatal:!0});e.baseEncode=function(t){return"string"==typeof t&&(t=r.from(t,"utf8")),d.default.encode(r.from(t))},e.baseDecode=function(t){return r.from(d.default.decode(t))};const f=1024;class p extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}e.BorshError=p;class m{constructor(){this.buf=r.alloc(f),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=r.concat([this.buf,r.alloc(f)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(r.from(new c.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(r.from(new c.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(r.from(new c.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(r.from(new c.default(t).toArray("le",64)))}writeBuffer(t){this.buf=r.concat([r.from(this.buf.subarray(0,this.length)),t,r.alloc(f)]),this.length+=t.length}writeString(t){this.maybeResize();const e=r.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(r.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}}function g(t,e,n){const r=n.value;n.value=function(...t){try{return r.apply(this,t)}catch(t){if(t instanceof RangeError){const e=t.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e)>=0)throw new p("Reached the end of buffer when deserializing")}throw t}}}e.BinaryWriter=m;class y{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new c.default(t,"le")}readU128(){const t=this.readBuffer(16);return new c.default(t,"le")}readU256(){const t=this.readBuffer(32);return new c.default(t,"le")}readU512(){const t=this.readBuffer(64);return new c.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new p(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return h.decode(e)}catch(t){throw new p(`Error decoding UTF-8 string: ${t}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),n=Array();for(let r=0;r{w(t,e,n,r[0],i)}));else if(void 0!==r.kind)switch(r.kind){case"option":null==n?i.writeU8(0):(i.writeU8(1),w(t,e,n,r.type,i));break;case"map":i.writeU32(n.size),n.forEach(((n,o)=>{w(t,e,o,r.key,i),w(t,e,n,r.value,i)}));break;default:throw new p(`FieldType ${r} unrecognized`)}else _(t,n,i)}catch(t){throw t instanceof p&&t.addToFieldPath(e),t}}function _(t,e,n){if("function"==typeof e.borshSerialize)return void e.borshSerialize(n);const r=t.get(e.constructor);if(!r)throw new p(`Class ${e.constructor.name} is missing in schema`);if("struct"===r.kind)r.fields.map((([r,i])=>{w(t,r,e[r],i,n)}));else{if("enum"!==r.kind)throw new p(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`);{const i=e[r.field];for(let o=0;ov(t,e,n[0],r)))}if("option"===n.kind)return r.readU8()?v(t,e,n.type,r):void 0;if("map"===n.kind){let i=new Map;const o=r.readU32();for(let s=0;s=r.values.length)throw new p(`Enum index: ${i} is out of range`);const[o,s]=r.values[i];return new e({[o]:v(t,o,s,n)})}throw new p(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}s([g],y.prototype,"readU8",null),s([g],y.prototype,"readU16",null),s([g],y.prototype,"readU32",null),s([g],y.prototype,"readU64",null),s([g],y.prototype,"readU128",null),s([g],y.prototype,"readU256",null),s([g],y.prototype,"readU512",null),s([g],y.prototype,"readString",null),s([g],y.prototype,"readFixedArray",null),s([g],y.prototype,"readArray",null),e.BinaryReader=y,e.serialize=function(t,e,n=m){const r=new n;return _(t,e,r),r.toArray()},e.deserialize=function(t,e,n,r=y){const i=new r(n),o=k(t,e,i);if(i.offset{var r;function i(t){this.rand=t}if(t.exports=function(t){return r||(r=new i(null)),r.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n{var r=n(89509).Buffer;function i(t){r.isBuffer(t)||(t=r.from(t));for(var e=t.length/4|0,n=new Array(e),i=0;i>>24]^d[p>>>16&255]^l[m>>>8&255]^h[255&g]^e[y++],s=c[p>>>24]^d[m>>>16&255]^l[g>>>8&255]^h[255&f]^e[y++],a=c[m>>>24]^d[g>>>16&255]^l[f>>>8&255]^h[255&p]^e[y++],u=c[g>>>24]^d[f>>>16&255]^l[p>>>8&255]^h[255&m]^e[y++],f=o,p=s,m=a,g=u;return o=(r[f>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^e[y++],s=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&f])^e[y++],a=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[f>>>8&255]<<8|r[255&p])^e[y++],u=(r[g>>>24]<<24|r[f>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^e[y++],[o>>>=0,s>>>=0,a>>>=0,u>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var c=a^a<<1^a<<2^a<<3^a<<4;c=c>>>8^255&c^99,n[s]=c,r[c]=s;var d=t[s],l=t[d],h=t[l],f=257*t[c]^16843008*c;i[0][s]=f<<24|f>>>8,i[1][s]=f<<16|f>>>16,i[2][s]=f<<8|f>>>24,i[3][s]=f,f=16843009*h^65537*l^257*d^16843008*s,o[0][c]=f<<24|f>>>8,o[1][c]=f<<16|f>>>16,o[2][c]=f<<8|f>>>24,o[3][c]=f,0===s?s=a=1:(s=d^t[t[t[h^d]]],a^=t[t[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,n=e+6,r=4*(n+1),i=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/e|0]<<24):e>6&&o%e==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-e]^s}for(var c=[],d=0;d>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return s(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),n=r.allocUnsafe(16);return n.writeUInt32BE(e[0],0),n.writeUInt32BE(e[1],4),n.writeUInt32BE(e[2],8),n.writeUInt32BE(e[3],12),n},c.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var n=s(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},62422:(t,e,n)=>{var r=n(74497),i=n(89509).Buffer,o=n(71027),s=n(35717),a=n(83288),u=n(67295),c=n(20685);function d(t,e,n,s){o.call(this);var u=i.alloc(4,0);this._cipher=new r.AES(e);var d=this._cipher.encryptBlock(u);this._ghash=new a(d),n=function(t,e,n){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var r=new a(n),o=e.length,s=o%16;r.update(e),s&&(s=16-s,r.update(i.alloc(s,0))),r.update(i.alloc(8,0));var u=8*o,d=i.alloc(8);d.writeUIntBE(u,0,8),r.update(d),t._finID=r.state;var l=i.from(t._finID);return c(l),l}(this,n,d),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}s(d,o),d.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var n=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(n),this._len+=t.length,n},d.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var n=0;t.length!==e.length&&n++;for(var r=Math.min(t.length,e.length),i=0;i{var r=n(71494),i=n(66193),o=n(44946);e.createCipher=e.Cipher=r.createCipher,e.createCipheriv=e.Cipheriv=r.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},66193:(t,e,n)=>{var r=n(62422),i=n(89509).Buffer,o=n(45),s=n(25969),a=n(71027),u=n(74497),c=n(13048);function d(t,e,n){a.call(this),this._cache=new l,this._last=void 0,this._cipher=new u.AES(e),this._prev=i.from(n),this._mode=t,this._autopadding=!0}function l(){this.cache=i.allocUnsafe(0)}function h(t,e,n){var a=o[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=i.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof e&&(e=i.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===a.type?new s(a.module,e,n,!0):"auth"===a.type?new r(a.module,e,n,!0):new d(a.module,e,n)}n(35717)(d,a),d.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,e),r.push(n);return i.concat(r)},d.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var n=-1;++n16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var n=o[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=c(e,!1,n.key,n.iv);return h(t,r.key,r.iv)},e.createDecipheriv=h},71494:(t,e,n)=>{var r=n(45),i=n(62422),o=n(89509).Buffer,s=n(25969),a=n(71027),u=n(74497),c=n(13048);function d(t,e,n){a.call(this),this._cache=new h,this._cipher=new u.AES(e),this._prev=o.from(n),this._mode=t,this._autopadding=!0}n(35717)(d,a),d.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get();)n=this._mode.encrypt(this,e),r.push(n);return o.concat(r)};var l=o.alloc(16,16);function h(){this.cache=o.allocUnsafe(0)}function f(t,e,n){var a=r[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===a.type?new s(a.module,e,n):"auth"===a.type?new i(a.module,e,n):new d(a.module,e,n)}d.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},h.prototype.add=function(t){this.cache=o.concat([this.cache,t])},h.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},h.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),n=-1;++n{var r=n(89509).Buffer,i=r.alloc(16,0);function o(t){var e=r.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}s.prototype.ghash=function(t){for(var e=-1;++e0;e--)r[e]=r[e]>>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=r[0]^225<<24)}this.state=o(i)},s.prototype.update=function(t){var e;for(this.cache=r.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=s},20685:t=>{t.exports=function(t){for(var e,n=t.length;n--;){if(255!==(e=t.readUInt8(n))){e++,t.writeUInt8(e,n);break}t.writeUInt8(0,n)}}},25292:(t,e,n)=>{var r=n(67295);e.encrypt=function(t,e){var n=r(e,t._prev);return t._prev=t._cipher.encryptBlock(n),t._prev},e.decrypt=function(t,e){var n=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return r(i,n)}},86311:(t,e,n)=>{var r=n(89509).Buffer,i=n(67295);function o(t,e,n){var o=e.length,s=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=r.concat([t._prev,n?e:s]),s}e.encrypt=function(t,e,n){for(var i,s=r.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=r.allocUnsafe(0)),!(t._cache.length<=e.length)){s=r.concat([s,o(t,e,n)]);break}i=t._cache.length,s=r.concat([s,o(t,e.slice(0,i),n)]),e=e.slice(i)}return s}},21510:(t,e,n)=>{var r=n(89509).Buffer;function i(t,e,n){for(var r,i,s=-1,a=0;++s<8;)r=e&1<<7-s?128:0,a+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^r))>>s%8,t._prev=o(t._prev,n?r:i);return a}function o(t,e){var n=t.length,i=-1,o=r.allocUnsafe(t.length);for(t=r.concat([t,r.from([e])]);++i>7;return o}e.encrypt=function(t,e,n){for(var o=e.length,s=r.allocUnsafe(o),a=-1;++a{var r=n(89509).Buffer;function i(t,e,n){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=r.concat([t._prev.slice(1),r.from([n?e:i])]),i}e.encrypt=function(t,e,n){for(var o=e.length,s=r.allocUnsafe(o),a=-1;++a{var r=n(67295),i=n(89509).Buffer,o=n(20685);function s(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var n=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*n)]);for(var a=0;a{e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},45:(t,e,n)=>{var r={ECB:n(11084),CBC:n(25292),CFB:n(86311),CFB8:n(71964),CFB1:n(21510),OFB:n(18861),CTR:n(96009),GCM:n(96009)},i=n(44946);for(var o in i)i[o].module=r[i[o].mode];t.exports=i},18861:(t,e,n)=>{var r=n(48764).Buffer,i=n(67295);function o(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(t,e){for(;t._cache.length{var r=n(74497),i=n(89509).Buffer,o=n(71027);function s(t,e,n,s){o.call(this),this._cipher=new r.AES(e),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._mode=t}n(35717)(s,o),s.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},53614:(t,e,n)=>{var r=n(47667),i=n(44696),o=n(45),s=n(99715),a=n(13048);function u(t,e,n){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,n);if(s[t])return new r({key:e,iv:n,mode:t});throw new TypeError("invalid suite type")}function c(t,e,n){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,n);if(s[t])return new r({key:e,iv:n,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");n=8*s[t].key,r=s[t].iv}var i=a(e,!1,n,r);return u(t,i.key,i.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");n=8*s[t].key,r=s[t].iv}var i=a(e,!1,n,r);return c(t,i.key,i.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(s).concat(i.getCiphers())}},47667:(t,e,n)=>{var r=n(71027),i=n(15251),o=n(35717),s=n(89509).Buffer,a={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function u(t){r.call(this);var e,n=t.mode.toLowerCase(),i=a[n];e=t.decrypt?"decrypt":"encrypt";var o=t.key;s.isBuffer(o)||(o=s.from(o)),"des-ede"!==n&&"des-ede-cbc"!==n||(o=s.concat([o,o.slice(0,8)]));var u=t.iv;s.isBuffer(u)||(u=s.from(u)),this._des=i.create({key:o,iv:u,type:e})}a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],t.exports=u,o(u,r),u.prototype._update=function(t){return s.from(this._des.update(t))},u.prototype._final=function(){return s.from(this._des.final())}},99715:(t,e)=>{e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},23663:(t,e,n)=>{var r=n(48764).Buffer,i=n(13550),o=n(61798);function s(t){var e,n=t.modulus.byteLength();do{e=new i(o(n))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,e){var n=function(t){var e=s(t);return{blinder:e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),o=e.modulus.byteLength(),a=new i(t).mul(n.blinder).umod(e.modulus),u=a.toRed(i.mont(e.prime1)),c=a.toRed(i.mont(e.prime2)),d=e.coefficient,l=e.prime1,h=e.prime2,f=u.redPow(e.exponent1).fromRed(),p=c.redPow(e.exponent2).fromRed(),m=f.isub(p).imul(d).umod(l).imul(h);return p.iadd(m).imul(n.unblinder).umod(e.modulus).toArrayLike(r,"be",o)}a.getr=s,t.exports=a},56042:(t,e,n)=>{"use strict";t.exports=n(75207)},64743:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=n(23482),o=n(23872),s=n(35717),a=n(82957),u=n(47753),c=n(75207);function d(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){return new d(t)}function f(t){return new l(t)}Object.keys(c).forEach((function(t){c[t].id=r.from(c[t].id,"hex"),c[t.toLowerCase()]=c[t]})),s(d,o.Writable),d.prototype._write=function(t,e,n){this._hash.update(t),n()},d.prototype.update=function(t,e){return this._hash.update("string"==typeof t?r.from(t,e):t),this},d.prototype.sign=function(t,e){this.end();var n=this._hash.digest(),r=a(n,t,this._hashType,this._signType,this._tag);return e?r.toString(e):r},s(l,o.Writable),l.prototype._write=function(t,e,n){this._hash.update(t),n()},l.prototype.update=function(t,e){return this._hash.update("string"==typeof t?r.from(t,e):t),this},l.prototype.verify=function(t,e,n){var i="string"==typeof e?r.from(e,n):e;this.end();var o=this._hash.digest();return u(i,o,t,this._signType,this._tag)},t.exports={Sign:h,Verify:f,createSign:h,createVerify:f}},82957:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=n(58355),o=n(23663),s=n(86266).ec,a=n(13550),u=n(70980),c=n(1308);function d(t,e,n,o){if((t=r.from(t.toArray())).length0&&n.ishrn(r),n}function h(t,e,n){var o,s;do{for(o=r.alloc(0);8*o.length{"use strict";var r=n(89509).Buffer,i=n(13550),o=n(86266).ec,s=n(70980),a=n(1308);function u(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=0)throw new Error("invalid sig")}t.exports=function(t,e,n,c,d){var l=s(n);if("ec"===l.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(t,e,n){var r=a[n.data.algorithm.curve.join(".")];if(!r)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var i=new o(r),s=n.data.subjectPrivateKey.data;return i.verify(e,t,s)}(t,e,l)}if("dsa"===l.type){if("dsa"!==c)throw new Error("wrong public key type");return function(t,e,n){var r=n.data.p,o=n.data.q,a=n.data.g,c=n.data.pub_key,d=s.signature.decode(t,"der"),l=d.s,h=d.r;u(l,o),u(h,o);var f=i.mont(r),p=l.invm(o);return 0===a.toRed(f).redPow(new i(e).mul(p).mod(o)).fromRed().mul(c.toRed(f).redPow(h.mul(p).mod(o)).fromRed()).mod(r).mod(o).cmp(h)}(t,e,l)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");e=r.concat([d,e]);for(var h=l.modulus.byteLength(),f=[1],p=0;e.length+f.length+2{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,4)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-9,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var c=("number"!=typeof u&&(u=0),u+1>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(r(e,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},34390:(t,e,n)=>{"use strict";var r=n(34155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=d;var o=n(44960),s=n(92010);n(35717)(d,o);for(var a=i(s.prototype),u=0;u{"use strict";t.exports=i;var r=n(3912);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(35717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},44960:(t,e,n)=>{"use strict";var r,i=n(34155);t.exports=S,S.ReadableState=A,n(17187).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=n(59819),u=n(48764).Buffer,c=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=n(56353);o=d&&d.debuglog?d.debuglog("stream"):function(){};var l,h,f,p=n(76633),m=n(75997),g=n(898).getHighWaterMark,y=n(84419).q,b=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(35717)(S,a);var k=m.errorOrDestroy,M=["error","close","destroy","pause","resume"];function A(t,e,i){r=r||n(34390),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(72221).s),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function S(t){if(r=r||n(34390),!(this instanceof S))return new S(t);var e=this instanceof r;this._readableState=new A(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function I(t,e,n,r,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(i||(s=function(t,e){var n,r;return r=e,u.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],e)),n}(a,e)),s)k(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r)a.endEmitted?k(t,new v):x(t,a,e,!0);else if(a.ended)k(t,new w);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):L(t,a)):x(t,a,e,!1)}else r||(a.reading=!1,L(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function P(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(B,t))}function B(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function L(t,e){e.readingMore||(e.readingMore=!0,i.nextTick($,t,e))}function $(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function z(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function j(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?z(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&z(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&z(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(t){k(this,new _("_read()"))},S.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?m:u;function u(){o("onend"),t.end()}r.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",f),t.removeListener("finish",p),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",e),n.removeListener("end",u),n.removeListener("end",m),n.removeListener("data",l),d=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(n);t.on("drain",c);var d=!1;function l(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==j(r.pipes,t))&&!d&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function h(e){o("onerror",e),m(),t.removeListener("error",h),0===s(t,"error")&&k(t,e)}function f(){t.removeListener("finish",p),m()}function p(){o("onfinish"),t.removeListener("close",f),m()}function m(){o("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",h),t.once("close",f),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?P(this):r.reading||i.nextTick(O,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(R,this),n},S.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(R,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(D,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s{"use strict";t.exports=d;var r=n(84419).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(34390);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var r,i=n(34155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=S,S.WritableState=A;var s,a={deprecate:n(94927)},u=n(59819),c=n(48764).Buffer,d=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=n(75997),h=n(898).getHighWaterMark,f=n(84419).q,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,w=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,v=f.ERR_UNKNOWN_ENCODING,k=l.errorOrDestroy;function M(){}function A(t,e,s){r=r||n(34390),t=t||{},"boolean"!=typeof s&&(s=e instanceof r),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(B,t,e),t._writableState.errorEmitted=!0,k(t,r)):(o(r),t._writableState.errorEmitted=!0,k(t,r),B(t,e))}(t,n,r,e,o);else{var s=T(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(t,n),r?i.nextTick(x,t,n,s,o):x(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function S(t){var e=this instanceof(r=r||n(34390));if(!e&&!s.call(S,this))return new S(t);this._writableState=new A(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function I(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function x(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),B(t,e)}function E(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,I(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,d=n.encoding,l=n.callback;if(I(t,e,!1,e.objectMode?1:c.length,c,d,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(n){e.pendingcb--,n&&k(t,n),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var n=T(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(35717)(S,u),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===S&&t&&t._writableState instanceof A}})):s=function(t){return t instanceof this},S.prototype.pipe=function(){k(this,new y)},S.prototype.write=function(t,e,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=t,c.isBuffer(r)||r instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=M),o.ending?function(t,e){var n=new _;k(t,n),i.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o;return null===n?o=new w:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(k(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,n){n(new m("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,B(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(t,e){e(t)}},54887:(t,e,n)=>{"use strict";var r,i=n(34155);function o(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=n(5800),a=Symbol("lastResolve"),u=Symbol("lastReject"),c=Symbol("error"),d=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(t,e){return{value:t,done:e}}function m(t){var e=t[a];if(null!==e){var n=t[f].read();null!==n&&(t[l]=null,t[a]=null,t[u]=null,e(p(n,!1)))}}function g(t){i.nextTick(m,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(r={get stream(){return this[f]},next:function(){var t=this,e=this[c];if(null!==e)return Promise.reject(e);if(this[d])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[c]?n(t[c]):e(p(void 0,!0))}))}));var n,r=this[l];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[d]?n(p(void 0,!0)):e[h](n,r)}),r)}}(r,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),y);t.exports=function(t){var e,n=Object.create(b,(o(e={},f,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,c,{value:null,writable:!0}),o(e,d,{value:t._readableState.endEmitted,writable:!0}),o(e,h,{value:function(t,e){var r=n[f].read();r?(n[l]=null,n[a]=null,n[u]=null,t(p(r,!1))):(n[a]=t,n[u]=e)},writable:!0}),e));return n[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[u];return null!==e&&(n[l]=null,n[a]=null,n[u]=null,e(t)),void(n[c]=t)}var r=n[a];null!==r&&(n[l]=null,n[a]=null,n[u]=null,r(p(void 0,!0))),n[d]=!0})),t.on("readable",g.bind(null,n)),n}},76633:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return u.alloc(0);for(var e,n,r,i=u.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,u.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=u.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:d,value:function(t,e){return c(this,i(i({},e),{},{depth:0,customInspect:!1}))}}])&&s(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},75997:(t,e,n)=>{"use strict";var r=n(34155);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(s,this,t)):r.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},5800:(t,e,n)=>{"use strict";var r=n(84419).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},37065:(t,e,n)=>{"use strict";var r,i=n(84419).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t){t()}function c(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),i=0;i0,(function(t){d||(d=t),t&&h.forEach(u),o||(h.forEach(u),l(d))}))}));return e.reduce(c)}},898:(t,e,n)=>{"use strict";var r=n(84419).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},59819:(t,e,n)=>{t.exports=n(17187).EventEmitter},23872:(t,e,n)=>{(e=t.exports=n(44960)).Stream=e,e.Readable=e,e.Writable=n(92010),e.Duplex=n(34390),e.Transform=n(3912),e.PassThrough=n(41294),e.finished=n(5800),e.pipeline=n(37065)},72221:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=d,this.end=l,e=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function d(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},77191:(t,e,n)=>{var r=n(58162);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},20698:(t,e,n)=>{"use strict";var r=n(48764).Buffer;class i{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function o(t,e){return e.property?t+"["+e.property+"]":t}e.Layout=i,e.nameWithProperty=o,e.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof i))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class s extends i{isCount(){throw new Error("ExternalLayout is abstract")}}class a extends s{constructor(t,e){if(void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class u extends s{constructor(t,e,n){if(!(t instanceof i))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof c||this.layout instanceof d}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class c extends i{constructor(t,e){if(super(t,e),6t+r.encode(i,e,n+t)),0);return this.count instanceof s&&this.count.encode(t.length,e,n),i}}class S extends i{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof i),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0s&&(s=r.getSpan(e,n)))}i=n,n+=s}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class I{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class x extends I{constructor(t,e){if(!(t instanceof s&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class E extends i{constructor(t,e,n){const r=t instanceof c||t instanceof d;if(r)t=new x(new u(t));else if(t instanceof s&&t.isCount())t=new x(t);else if(!(t instanceof I))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof i))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&r&&(o+=t.layout.span)),super(o,n),this.discriminator=t,this.usesPrefixDiscriminator=r,this.defaultLayout=e,this.registry={};let a=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return a(t)},this.configGetSourceVariant=function(t){a=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+s)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new T(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return r.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class T extends i{constructor(t,e,n,r){if(!(t instanceof E))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof i))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=n?n.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function P(t){return 0>t&&(t+=4294967296),t}class B extends i{constructor(t,e,n){if(!(t instanceof c||t instanceof d))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==P(t&this.valueMask))throw new TypeError(o("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=P(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let i=this.length;if(this.length instanceof s&&(i=t.length),!r.isBuffer(t)||i!==t.length)throw new TypeError(o("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,i,"hex"),this.length instanceof s&&this.length.encode(i,e,n),i}}class O extends i{constructor(t){super(-1,t)}getSpan(t,e){if(!r.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return i.copy(e,n),e[n+o]=0,o+1}}class D extends i{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!r.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return i.copy(e,n),o}}class C extends i{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}e.ExternalLayout=s,e.GreedyCount=a,e.OffsetLayout=u,e.UInt=c,e.UIntBE=d,e.Int=l,e.IntBE=h,e.Float=_,e.FloatBE=v,e.Double=k,e.DoubleBE=M,e.Sequence=A,e.Structure=S,e.UnionDiscriminator=I,e.UnionLayoutDiscriminator=x,e.Union=E,e.VariantLayout=T,e.BitStructure=B,e.BitField=L,e.Boolean=$,e.Blob=R,e.CString=O,e.UTF8=D,e.Constant=C,e.greedy=(t,e)=>new a(t,e),e.offset=(t,e,n)=>new u(t,e,n),e.u8=t=>new c(1,t),e.u16=t=>new c(2,t),e.u24=t=>new c(3,t),e.u32=t=>new c(4,t),e.u40=t=>new c(5,t),e.u48=t=>new c(6,t),e.nu64=t=>new g(t),e.u16be=t=>new d(2,t),e.u24be=t=>new d(3,t),e.u32be=t=>new d(4,t),e.u40be=t=>new d(5,t),e.u48be=t=>new d(6,t),e.nu64be=t=>new y(t),e.s8=t=>new l(1,t),e.s16=t=>new l(2,t),e.s24=t=>new l(3,t),e.s32=t=>new l(4,t),e.s40=t=>new l(5,t),e.s48=t=>new l(6,t),e.ns64=t=>new b(t),e.s16be=t=>new h(2,t),e.s24be=t=>new h(3,t),e.s32be=t=>new h(4,t),e.s40be=t=>new h(5,t),e.s48be=t=>new h(6,t),e.ns64be=t=>new w(t),e.f32=t=>new _(t),e.f32be=t=>new v(t),e.f64=t=>new k(t),e.f64be=t=>new M(t),e.struct=(t,e,n)=>new S(t,e,n),e.bits=(t,e,n)=>new B(t,e,n),e.seq=(t,e,n)=>new A(t,e,n),e.union=(t,e,n)=>new E(t,e,n),e.unionLayoutDiscriminator=(t,e)=>new x(t,e),e.blob=(t,e)=>new R(t,e),e.cstr=t=>new O(t),e.utf8=(t,e)=>new D(t,e),e.const=(t,e)=>new C(t,e)},67295:(t,e,n)=>{var r=n(48764).Buffer;t.exports=function(t,e){for(var n=Math.min(t.length,e.length),i=new r(n),o=0;o{"use strict";const r=n(79742),i=n(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return f(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return u.from(r,e,n);const i=function(t){if(u.isBuffer(t)){const e=0|p(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?a(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function d(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return d(t),a(t<0?0:0|p(t))}function h(t){const e=t.length<0?0:0|p(t.length),n=a(e);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(i)return r?-1:K(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return T(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function I(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=x)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,r,i){if(G(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(r,i),d=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return k(this,t,e,n);case"base64":return M(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function $(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){Y(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function O(t,e,n,r,i){Y(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function C(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function N(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=J((function(t){F(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=J((function(t){F(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||L(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||$(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||$(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=J((function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);$(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);$(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||$(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=J((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,n){return C(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return C(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return N(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function Y(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function F(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw F(t,n),new z.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=j(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function K(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},23204:t=>{"use strict";const e=/[\p{Lu}]/u,n=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,i=/([\p{Alpha}\p{N}_]|$)/u,o=/[_.\- ]+/,s=new RegExp("^"+o.source),a=new RegExp(o.source+i.source,"gu"),u=new RegExp("\\d+"+i.source,"gu"),c=(t,i)=>{if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("Expected the input to be `string | string[]`");if(i={pascalCase:!1,preserveConsecutiveUppercase:!1,...i},0===(t=Array.isArray(t)?t.map((t=>t.trim())).filter((t=>t.length)).join("-"):t.trim()).length)return"";const o=!1===i.locale?t=>t.toLowerCase():t=>t.toLocaleLowerCase(i.locale),c=!1===i.locale?t=>t.toUpperCase():t=>t.toLocaleUpperCase(i.locale);return 1===t.length?i.pascalCase?c(t):o(t):(t!==o(t)&&(t=((t,r,i)=>{let o=!1,s=!1,a=!1;for(let u=0;u(r.lastIndex=0,t.replace(r,(t=>e(t)))))(t,o):o(t),i.pascalCase&&(t=c(t.charAt(0))+t.slice(1)),((t,e)=>(a.lastIndex=0,u.lastIndex=0,t.replace(a,((t,n)=>e(n))).replace(u,(t=>e(t)))))(t,c))};t.exports=c,t.exports.default=c},71027:(t,e,n)=>{var r=n(89509).Buffer,i=n(42830).Transform,o=n(6941).s;function s(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(35717)(s,i),s.prototype.update=function(t,e,n){"string"==typeof t&&(t=r.from(t,e));var i=this._update(t);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,n){var r;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){r=t}finally{n(r)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||r.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,n){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var r=this._decoder.write(t);return n&&(r+=this._decoder.end()),r},t.exports=s},76393:(t,e,n)=>{var r=n(48764).Buffer,i=n(86266),o=n(16426);t.exports=function(t){return new a(t)};var s={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}};function a(t){this.curveType=s[t],this.curveType||(this.curveType={name:t}),this.curve=new i.ec(this.curveType.name),this.keys=void 0}function u(t,e,n){Array.isArray(t)||(t=t.toArray());var i=new r(t);if(n&&i.length=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},23482:(t,e,n)=>{"use strict";var r=n(35717),i=n(62318),o=n(79785),s=n(89072),a=n(71027);function u(t){a.call(this,"digest"),this._hash=t}r(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},78028:(t,e,n)=>{var r=n(62318);t.exports=function(t){return(new r).update(t).digest()}},58355:(t,e,n)=>{"use strict";var r=n(35717),i=n(51031),o=n(71027),s=n(89509).Buffer,a=n(78028),u=n(79785),c=n(89072),d=s.alloc(128);function l(t,e){o.call(this,"digest"),"string"==typeof e&&(e=s.from(e));var n="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>n?e=("rmd160"===t?new u:c(t)).update(e).digest():e.length{"use strict";var r=n(35717),i=n(89509).Buffer,o=n(71027),s=i.alloc(128),a=64;function u(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length{"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=n(61798),e.createHash=e.Hash=n(23482),e.createHmac=e.Hmac=n(58355);var r=n(56042),i=Object.keys(r),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var s=n(25632);e.pbkdf2=s.pbkdf2,e.pbkdf2Sync=s.pbkdf2Sync;var a=n(53614);e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var u=n(62607);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var c=n(64743);e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=n(76393);var d=n(7900);e.publicEncrypt=d.publicEncrypt,e.privateEncrypt=d.privateEncrypt,e.publicDecrypt=d.publicDecrypt,e.privateDecrypt=d.privateDecrypt;var l=n(77963);e.randomFill=l.randomFill,e.randomFillSync=l.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.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}},93776:function(t,e,n){var r;!function(i){"use strict";var o,s,a,u=9e15,c=1e9,d="0123456789abcdef",l="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",h="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",f={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-u,maxE:u,crypto:!1},p=!0,m="[DecimalError] ",g=m+"Invalid argument: ",y=m+"Precision limit exceeded",b=m+"crypto unavailable",w="[object Decimal]",_=Math.floor,v=Math.pow,k=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,M=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,A=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,S=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,I=1e7,x=7,E=l.length-1,T=h.length-1,P={toStringTag:w};function B(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;en)throw Error(g+t)}function $(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=x,i=0):(i=Math.ceil((e+1)/x),e%=x),o=v(10,x-e),a=t[i]%o|0,null==r?e<3?(0==e?a=a/100|0:1==e&&(a=a/10|0),s=n<4&&99999==a||n>3&&49999==a||5e4==a||0==a):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(t[i+1]/o/100|0)==v(10,e-2)-1||(a==o/2||0==a)&&0==(t[i+1]/o/100|0):e<4?(0==e?a=a/1e3|0:1==e?a=a/100|0:2==e&&(a=a/10|0),s=(r||n<4)&&9999==a||!r&&n>3&&4999==a):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==v(10,e-3)-1,s}function R(t,e,n){for(var r,i,o=[0],s=0,a=t.length;sn-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}P.absoluteValue=P.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),D(t)},P.ceil=function(){return D(new this.constructor(this),this.e+1,2)},P.clampedTo=P.clamp=function(t,e){var n=this,r=n.constructor;if(t=new r(t),e=new r(e),!t.s||!e.s)return new r(NaN);if(t.gt(e))throw Error(g+e);return n.cmp(t)<0?t:n.cmp(e)>0?e:new r(n)},P.comparedTo=P.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,u=o.s,c=t.s;if(!s||!a)return u&&c?u!==c?u:s===a?0:!s^u<0?1:-1:NaN;if(!s[0]||!a[0])return s[0]?u:a[0]?-c:0;if(u!==c)return u;if(o.e!==t.e)return o.e>t.e^u<0?1:-1;for(e=0,n=(r=s.length)<(i=a.length)?r:i;ea[e]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1},P.cosine=P.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+x,r.rounding=1,n=function(t,e){var n,r,i;if(e.isZero())return e;(r=e.d.length)<32?i=(1/J(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=X(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}(r,Q(r,n)),r.precision=t,r.rounding=e,D(2==a||3==a?n.neg():n,t,e,!0)):new r(1):new r(NaN)},P.cubeRoot=P.cbrt=function(){var t,e,n,r,i,o,s,a,u,c,d=this,l=d.constructor;if(!d.isFinite()||d.isZero())return new l(d);for(p=!1,(o=d.s*v(d.s*d,1/3))&&Math.abs(o)!=1/0?r=new l(o.toString()):(n=B(d.d),(o=((t=d.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=v(n,1/3),t=_((t+1)/3)-(t%3==(t<0?-1:2)),(r=new l(n=o==1/0?"5e"+t:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+t)).s=d.s),s=(t=l.precision)+3;;)if(c=(u=(a=r).times(a).times(a)).plus(d),r=O(c.plus(d).times(a),c.plus(u),s+2,1),B(a.d).slice(0,s)===(n=B(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(D(r,t+1,1),e=!r.times(r).times(r).eq(d));break}if(!i&&(D(a,t+1,0),a.times(a).times(a).eq(d))){r=a;break}s+=4,i=1}return p=!0,D(r,t,l.rounding,e)},P.decimalPlaces=P.dp=function(){var t,e=this.d,n=NaN;if(e){if(n=((t=e.length-1)-_(this.e/x))*x,t=e[t])for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},P.dividedBy=P.div=function(t){return O(this,new this.constructor(t))},P.dividedToIntegerBy=P.divToInt=function(t){var e=this.constructor;return D(O(this,new e(t),0,1,1),e.precision,e.rounding)},P.equals=P.eq=function(t){return 0===this.cmp(t)},P.floor=function(){return D(new this.constructor(this),this.e+1,3)},P.greaterThan=P.gt=function(t){return this.cmp(t)>0},P.greaterThanOrEqualTo=P.gte=function(t){var e=this.cmp(t);return 1==e||0===e},P.hyperbolicCosine=P.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?e=(1/J(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),o=X(s,1,o.times(e),new s(1),!0);for(var u,c=t,d=new s(8);c--;)u=o.times(o),o=a.minus(u.times(d.minus(u.times(d))));return D(o,s.precision=n,s.rounding=r,!0)},P.hyperbolicSine=P.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=X(o,2,i,i,!0);else{t=(t=1.4*Math.sqrt(r))>16?16:0|t,i=X(o,2,i=i.times(1/J(5,t)),i,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=n,D(i,e,n,!0)},P.hyperbolicTangent=P.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,O(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},P.inverseCosine=P.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?e.isNeg()?U(n,i,o):new n(0):new n(NaN):e.isZero()?U(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=U(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))},P.inverseHyperbolicCosine=P.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,p=!1,n=n.times(n).minus(1).sqrt().plus(n),p=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)},P.inverseHyperbolicSine=P.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,p=!1,n=n.times(n).plus(1).sqrt().plus(n),p=!0,r.precision=t,r.rounding=e,n.ln())},P.inverseHyperbolicTangent=P.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?D(new o(i),t,e,!0):(o.precision=n=r-i.e,i=O(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)},P.inverseSine=P.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==e?0===e?((t=U(o,n+4,r).times(.5)).s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},P.inverseTangent=P.atan=function(){var t,e,n,r,i,o,s,a,u,c=this,d=c.constructor,l=d.precision,h=d.rounding;if(c.isFinite()){if(c.isZero())return new d(c);if(c.abs().eq(1)&&l+4<=T)return(s=U(d,l+4,h).times(.25)).s=c.s,s}else{if(!c.s)return new d(NaN);if(l+4<=T)return(s=U(d,l+4,h).times(.5)).s=c.s,s}for(d.precision=a=l+10,d.rounding=1,t=n=Math.min(28,a/x+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(p=!1,e=Math.ceil(a/x),r=1,u=c.times(c),s=new d(c),i=c;-1!==t;)if(i=i.times(u),o=s.minus(i.div(r+=2)),i=i.times(u),void 0!==(s=o.plus(i.div(r+=2))).d[e])for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<this.d.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isPositive=P.isPos=function(){return this.s>0},P.isZero=function(){return!!this.d&&0===this.d[0]},P.lessThan=P.lt=function(t){return this.cmp(t)<0},P.lessThanOrEqualTo=P.lte=function(t){return this.cmp(t)<1},P.logarithm=P.log=function(t){var e,n,r,i,o,s,a,u,c=this,d=c.constructor,l=d.precision,h=d.rounding;if(null==t)t=new d(10),e=!0;else{if(n=(t=new d(t)).d,t.s<0||!n||!n[0]||t.eq(1))return new d(NaN);e=t.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new d(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(p=!1,s=q(c,a=l+5),r=e?z(d,a+10):q(t,a),$((u=O(s,r,a,1)).d,i=l,h))do{if(s=q(c,a+=10),r=e?z(d,a+10):q(t,a),u=O(s,r,a,1),!o){+B(u.d).slice(i+1,i+15)+1==1e14&&(u=D(u,l+1,0));break}}while($(u.d,i+=10,h));return p=!0,D(u,l,h)},P.minus=P.sub=function(t){var e,n,r,i,o,s,a,u,c,d,l,h,f=this,m=f.constructor;if(t=new m(t),!f.d||!t.d)return f.s&&t.s?f.d?t.s=-t.s:t=new m(t.d||f.s!==t.s?f:NaN):t=new m(NaN),t;if(f.s!=t.s)return t.s=-t.s,f.plus(t);if(c=f.d,h=t.d,a=m.precision,u=m.rounding,!c[0]||!h[0]){if(h[0])t.s=-t.s;else{if(!c[0])return new m(3===u?-0:0);t=new m(f)}return p?D(t,a,u):t}if(n=_(t.e/x),d=_(f.e/x),c=c.slice(),o=d-n){for((l=o<0)?(e=c,o=-o,s=h.length):(e=h,n=d,s=c.length),o>(r=Math.max(Math.ceil(a/x),s)+2)&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for((l=(r=c.length)<(s=h.length))&&(s=r),r=0;r0;--r)c[s++]=0;for(r=h.length;r>o;){if(c[--r](s=(o=Math.ceil(a/x))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=c.length)-(i=d.length)<0&&(i=s,n=d,d=c,c=n),e=0;i;)e=(c[--i]=c[i]+d[i]+e)/I|0,c[i]%=I;for(e&&(c.unshift(e),++r),s=c.length;0==c[--s];)c.pop();return t.d=c,t.e=N(c,r),p?D(t,a,u):t},P.precision=P.sd=function(t){var e,n=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(g+t);return n.d?(e=j(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},P.round=function(){var t=this,e=t.constructor;return D(new e(t),t.e+1,e.rounding)},P.sine=P.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+x,r.rounding=1,n=function(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:X(t,2,e,e);n=(n=1.4*Math.sqrt(r))>16?16:0|n,e=X(t,2,e=e.times(1/J(5,n)),e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}(r,Q(r,n)),r.precision=t,r.rounding=e,D(a>2?n.neg():n,t,e,!0)):new r(NaN)},P.squareRoot=P.sqrt=function(){var t,e,n,r,i,o,s=this,a=s.d,u=s.e,c=s.s,d=s.constructor;if(1!==c||!a||!a[0])return new d(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);for(p=!1,0==(c=Math.sqrt(+s))||c==1/0?(((e=B(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=_((u+1)/2)-(u<0||u%2),r=new d(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new d(c.toString()),n=(u=d.precision)+3;;)if(r=(o=r).plus(O(s,o,n+2,1)).times(.5),B(o.d).slice(0,n)===(e=B(r.d)).slice(0,n)){if("9999"!=(e=e.slice(n-3,n+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(D(r,u+1,1),t=!r.times(r).eq(s));break}if(!i&&(D(o,u+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}return p=!0,D(r,u,d.rounding,t)},P.tangent=P.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,(n=n.sin()).s=1,n=O(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,D(2==a||4==a?n.neg():n,t,e,!0)):new r(NaN)},P.times=P.mul=function(t){var e,n,r,i,o,s,a,u,c,d=this,l=d.constructor,h=d.d,f=(t=new l(t)).d;if(t.s*=d.s,!(h&&h[0]&&f&&f[0]))return new l(!t.s||h&&!h[0]&&!f||f&&!f[0]&&!h?NaN:h&&f?0*t.s:t.s/0);for(n=_(d.e/x)+_(t.e/x),(u=h.length)<(c=f.length)&&(o=h,h=f,f=o,s=u,u=c,c=s),o=[],r=s=u+c;r--;)o.push(0);for(r=c;--r>=0;){for(e=0,i=u+r;i>r;)a=o[i]+f[r]*h[i-r-1]+e,o[i--]=a%I|0,e=a/I|0;o[i]=(o[i]+e)%I|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=N(o,n),p?D(t,l.precision,l.rounding):t},P.toBinary=function(t,e){return tt(this,2,t,e)},P.toDecimalPlaces=P.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),void 0===t?n:(L(t,0,c),void 0===e?e=r.rounding:L(e,0,8),D(n,t+n.e+1,e))},P.toExponential=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=C(r,!0):(L(t,0,c),void 0===e?e=i.rounding:L(e,0,8),n=C(r=D(new i(r),t+1,e),!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},P.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return void 0===t?n=C(i):(L(t,0,c),void 0===e?e=o.rounding:L(e,0,8),n=C(r=D(new o(i),t+i.e+1,e),!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},P.toFraction=function(t){var e,n,r,i,o,s,a,u,c,d,l,h,f=this,m=f.d,y=f.constructor;if(!m)return new y(f);if(c=n=new y(1),r=u=new y(0),s=(o=(e=new y(r)).e=j(m)-f.e-1)%x,e.d[0]=v(10,s<0?x+s:s),null==t)t=o>0?e:c;else{if(!(a=new y(t)).isInt()||a.lt(c))throw Error(g+a);t=a.gt(e)?o>0?e:c:a}for(p=!1,a=new y(B(m)),d=y.precision,y.precision=o=m.length*x*2;l=O(a,e,0,1,1),1!=(i=n.plus(l.times(r))).cmp(t);)n=r,r=i,i=c,c=u.plus(l.times(i)),u=i,i=e,e=a.minus(l.times(i)),a=i;return i=O(t.minus(n),r,0,1,1),u=u.plus(i.times(c)),n=n.plus(i.times(r)),u.s=c.s=f.s,h=O(c,r,o,1).minus(f).abs().cmp(O(u,n,o,1).minus(f).abs())<1?[c,r]:[u,n],y.precision=d,p=!0,h},P.toHexadecimal=P.toHex=function(t,e){return tt(this,16,t,e)},P.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),null==t){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),void 0===e?e=r.rounding:L(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(p=!1,n=O(n,t,0,e,1).times(t),p=!0,D(n)):(t.s=n.s,n=t),n},P.toNumber=function(){return+this},P.toOctal=function(t,e){return tt(this,8,t,e)},P.toPower=P.pow=function(t){var e,n,r,i,o,s,a=this,u=a.constructor,c=+(t=new u(t));if(!(a.d&&t.d&&a.d[0]&&t.d[0]))return new u(v(+a,c));if((a=new u(a)).eq(1))return a;if(r=u.precision,o=u.rounding,t.eq(1))return D(a,r,o);if((e=_(t.e/x))>=t.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=F(u,a,n,r),t.s<0?new u(1).div(i):D(i,r,o);if((s=a.s)<0){if(eu.maxE+1||e0?s/0:0):(p=!1,u.rounding=a.s=1,n=Math.min(12,(e+"").length),(i=K(t.times(q(a,r+n)),r)).d&&$((i=D(i,r+5,1)).d,r,o)&&(e=r+10,+B((i=D(K(t.times(q(a,e+n)),e),e+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=D(i,r+1,0))),i.s=s,p=!0,u.rounding=o,D(i,r,o))},P.toPrecision=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=C(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(L(t,1,c),void 0===e?e=i.rounding:L(e,0,8),n=C(r=D(new i(r),t,e),t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},P.toSignificantDigits=P.toSD=function(t,e){var n=this.constructor;return void 0===t?(t=n.precision,e=n.rounding):(L(t,1,c),void 0===e?e=n.rounding:L(e,0,8)),D(new n(this),t,e)},P.toString=function(){var t=this,e=t.constructor,n=C(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},P.truncated=P.trunc=function(){return D(new this.constructor(this),this.e+1,1)},P.valueOf=P.toJSON=function(){var t=this,e=t.constructor,n=C(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};var O=function(){function t(t,e,n){var r,i=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+i,t[o]=r%n|0,i=r/n|0;return i&&t.unshift(i),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;)t.shift()}return function(r,i,o,a,u,c){var d,l,h,f,p,m,g,y,b,w,v,k,M,A,S,E,T,P,B,L,$=r.constructor,R=r.s==i.s?1:-1,O=r.d,C=i.d;if(!(O&&O[0]&&C&&C[0]))return new $(r.s&&i.s&&(O?!C||O[0]!=C[0]:C)?O&&0==O[0]||!C?0*R:R/0:NaN);for(c?(p=1,l=r.e-i.e):(c=I,p=x,l=_(r.e/p)-_(i.e/p)),B=C.length,T=O.length,w=(b=new $(R)).d=[],h=0;C[h]==(O[h]||0);h++);if(C[h]>(O[h]||0)&&l--,null==o?(A=o=$.precision,a=$.rounding):A=u?o+(r.e-i.e)+1:o,A<0)w.push(1),m=!0;else{if(A=A/p+2|0,h=0,1==B){for(f=0,C=C[0],A++;(h1&&(C=t(C,f,c),O=t(O,f,c),B=C.length,T=O.length),E=B,k=(v=O.slice(0,B)).length;k=c/2&&++P;do{f=0,(d=e(C,v,B,k))<0?(M=v[0],B!=k&&(M=M*c+(v[1]||0)),(f=M/P|0)>1?(f>=c&&(f=c-1),1==(d=e(g=t(C,f,c),v,y=g.length,k=v.length))&&(f--,n(g,B=10;f/=10)h++;b.e=h+l*p-1,D(b,u?o+b.e+1:o,a,m)}return b}}();function D(t,e,n,r){var i,o,s,a,u,c,d,l,h,f=t.constructor;t:if(null!=e){if(!(l=t.d))return t;for(i=1,a=l[0];a>=10;a/=10)i++;if((o=e-i)<0)o+=x,s=e,u=(d=l[h=0])/v(10,i-s-1)%10|0;else if((h=Math.ceil((o+1)/x))>=(a=l.length)){if(!r)break t;for(;a++<=h;)l.push(0);d=u=0,i=1,s=(o%=x)-x+1}else{for(d=a=l[h],i=1;a>=10;a/=10)i++;u=(s=(o%=x)-x+i)<0?0:d/v(10,i-s-1)%10|0}if(r=r||e<0||void 0!==l[h+1]||(s<0?d:d%v(10,i-s-1)),c=n<4?(u||r)&&(0==n||n==(t.s<0?3:2)):u>5||5==u&&(4==n||r||6==n&&(o>0?s>0?d/v(10,i-s):0:l[h-1])%10&1||n==(t.s<0?8:7)),e<1||!l[0])return l.length=0,c?(e-=t.e+1,l[0]=v(10,(x-e%x)%x),t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=h,a=1,h--):(l.length=h+1,a=v(10,x-o),l[h]=s>0?(d/v(10,i-s)%v(10,s)|0)*a:0),c)for(;;){if(0==h){for(o=1,s=l[0];s>=10;s/=10)o++;for(s=l[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,l[0]==I&&(l[0]=1));break}if(l[h]+=a,l[h]!=I)break;l[h--]=0,a=1}for(o=l.length;0===l[--o];)l.pop()}return p&&(t.e>f.maxE?(t.d=null,t.e=NaN):t.e0?o=o.charAt(0)+"."+o.slice(1)+Y(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+Y(-i-1)+o,n&&(r=n-s)>0&&(o+=Y(r))):i>=s?(o+=Y(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+Y(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=Y(r))),o}function N(t,e){var n=t[0];for(e*=x;n>=10;n/=10)e++;return e}function z(t,e,n){if(e>E)throw p=!0,n&&(t.precision=n),Error(y);return D(new t(l),e,1,!0)}function U(t,e,n){if(e>T)throw Error(y);return D(new t(h),e,n,!0)}function j(t){var e=t.length-1,n=e*x+1;if(e=t[e]){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function Y(t){for(var e="";t--;)e+="0";return e}function F(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/x+4);for(p=!1;;){if(n%2&&et((o=o.times(e)).d,s)&&(i=!0),0===(n=_(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}et((e=e.times(e)).d,s)}return p=!0,o}function W(t){return 1&t.d[t.d.length-1]}function H(t,e,n){for(var r,i=new t(e[0]),o=0;++o17)return new h(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(p=!1,u=m):u=e,a=new h(.03125);t.e>-2;)t=t.times(a),l+=5;for(u+=r=Math.log(v(2,l))/Math.LN10*2+5|0,n=o=s=new h(1),h.precision=u;;){if(o=D(o.times(t),u,1),n=n.times(++d),B((a=s.plus(O(o,n,u,1))).d).slice(0,u)===B(s.d).slice(0,u)){for(i=l;i--;)s=D(s.times(s),u,1);if(null!=e)return h.precision=m,s;if(!(c<3&&$(s.d,u-r,f,c)))return D(s,h.precision=m,f,p=!0);h.precision=u+=10,n=o=a=new h(1),d=0,c++}s=a}}function q(t,e){var n,r,i,o,s,a,u,c,d,l,h,f=1,m=t,g=m.d,y=m.constructor,b=y.rounding,w=y.precision;if(m.s<0||!g||!g[0]||!m.e&&1==g[0]&&1==g.length)return new y(g&&!g[0]?-1/0:1!=m.s?NaN:g?0:m);if(null==e?(p=!1,d=w):d=e,y.precision=d+=10,r=(n=B(g)).charAt(0),!(Math.abs(o=m.e)<15e14))return c=z(y,d+2,w).times(o+""),m=q(new y(r+"."+n.slice(1)),d-10).plus(c),y.precision=w,null==e?D(m,w,b,p=!0):m;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=B((m=m.times(t)).d)).charAt(0),f++;for(o=m.e,r>1?(m=new y("0."+n),o++):m=new y(r+"."+n.slice(1)),l=m,u=s=m=O(m.minus(1),m.plus(1),d,1),h=D(m.times(m),d,1),i=3;;){if(s=D(s.times(h),d,1),B((c=u.plus(O(s,new y(i),d,1))).d).slice(0,d)===B(u.d).slice(0,d)){if(u=u.times(2),0!==o&&(u=u.plus(z(y,d+2,w).times(o+""))),u=O(u,new y(f),d,1),null!=e)return y.precision=w,u;if(!$(u.d,d-10,b,a))return D(u,y.precision=w,b,p=!0);y.precision=d+=10,c=s=m=O(l.minus(1),l.plus(1),d,1),h=D(m.times(m),d,1),i=a=1}u=c,i+=2}}function V(t){return String(t.s*t.s/0)}function G(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;48===e.charCodeAt(r);r++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(r,i)){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%x,n<0&&(r+=x),rt.constructor.maxE?(t.d=null,t.e=NaN):t.e-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),S.test(e))return G(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(M.test(e))n=16,e=e.toLowerCase();else if(k.test(e))n=2;else{if(!A.test(e))throw Error(g+e);n=8}for((s=e.search(/p/i))>0?(c=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),a=(s=e.indexOf("."))>=0,r=t.constructor,a&&(s=(u=(e=e.replace(".","")).length)-s,i=F(r,new r(n),s,2*s)),s=l=(d=R(e,n,I)).length-1;0===d[s];--s)d.pop();return s<0?new r(0*t.s):(t.e=N(d,l),t.d=d,p=!1,a&&(t=O(t,i,4*u)),c&&(t=t.times(Math.abs(c)<54?v(2,c):o.pow(2,c))),p=!0,t)}function X(t,e,n,r,i){var o,s,a,u,c=t.precision,d=Math.ceil(c/x);for(p=!1,u=n.times(n),a=new t(r);;){if(s=O(a.times(u),new t(e++*e++),c,1),a=i?r.plus(s):r.minus(s),r=O(s.times(u),new t(e++*e++),c,1),void 0!==(s=a.plus(r)).d[d]){for(o=d;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=r,r=s,s=o}return p=!0,s.d.length=d+1,s}function J(t,e){for(var n=t;--e;)n*=t;return n}function Q(t,e){var n,r=e.s<0,i=U(t,t.precision,1),o=i.times(.5);if((e=e.abs()).lte(o))return a=r?4:1,e;if((n=e.divToInt(i)).isZero())a=r?3:2;else{if((e=e.minus(n.times(i))).lte(o))return a=W(n)?r?2:3:r?4:1,e;a=W(n)?r?1:4:r?3:2}return e.minus(i).abs()}function tt(t,e,n,r){var i,o,a,u,l,h,f,p,m,g=t.constructor,y=void 0!==n;if(y?(L(n,1,c),void 0===r?r=g.rounding:L(r,0,8)):(n=g.precision,r=g.rounding),t.isFinite()){for(y?(i=2,16==e?n=4*n-3:8==e&&(n=3*n-2)):i=e,(a=(f=C(t)).indexOf("."))>=0&&(f=f.replace(".",""),(m=new g(1)).e=f.length-a,m.d=R(C(m),10,i),m.e=m.d.length),o=l=(p=R(f,10,i)).length;0==p[--l];)p.pop();if(p[0]){if(a<0?o--:((t=new g(t)).d=p,t.e=o,p=(t=O(t,m,n,r,0,i)).d,o=t.e,h=s),a=p[n],u=i/2,h=h||void 0!==p[n+1],h=r<4?(void 0!==a||h)&&(0===r||r===(t.s<0?3:2)):a>u||a===u&&(4===r||h||6===r&&1&p[n-1]||r===(t.s<0?8:7)),p.length=n,h)for(;++p[--n]>i-1;)p[n]=0,n||(++o,p.unshift(1));for(l=p.length;!p[l-1];--l);for(a=0,f="";a1)if(16==e||8==e){for(a=16==e?4:3,--l;l%a;l++)f+="0";for(l=(p=R(f,i,e)).length;!p[l-1];--l);for(a=1,f="1.";al)for(o-=l;o--;)f+="0";else oe)return t.length=e,!0}function nt(t){return new this(t).abs()}function rt(t){return new this(t).acos()}function it(t){return new this(t).acosh()}function ot(t,e){return new this(t).plus(e)}function st(t){return new this(t).asin()}function at(t){return new this(t).asinh()}function ut(t){return new this(t).atan()}function ct(t){return new this(t).atanh()}function dt(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(n=e.s<0?U(this,r,i):new this(0)).s=t.s:!t.d||e.isZero()?(n=U(this,o,1).times(.5)).s=t.s:e.s<0?(this.precision=o,this.rounding=1,n=this.atan(O(t,e,o,1)),e=U(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(O(t,e,o,1)):(n=U(this,o,1).times(e.s>0?.25:.75)).s=t.s:n=new this(NaN),n}function lt(t){return new this(t).cbrt()}function ht(t){return D(t=new this(t),t.e+1,2)}function ft(t,e,n){return new this(t).clamp(e,n)}function pt(t){if(!t||"object"!=typeof t)throw Error(m+"Object expected");var e,n,r,i=!0===t.defaults,o=["precision",1,c,"rounding",0,8,"toExpNeg",-u,0,"toExpPos",0,u,"maxE",0,u,"minE",-u,0,"modulo",0,9];for(e=0;e=o[e+1]&&r<=o[e+2]))throw Error(g+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=f[n]),void 0!==(r=t[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(g+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(b);this[n]=!0}else this[n]=!1}return this}function mt(t){return new this(t).cos()}function gt(t){return new this(t).cosh()}function yt(t,e){return new this(t).div(e)}function bt(t){return new this(t).exp()}function wt(t){return D(t=new this(t),t.e+1,3)}function _t(){var t,e,n=new this(0);for(p=!1,t=0;t=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(b);for(e=crypto.randomBytes(r*=4);o=214e7?crypto.randomBytes(4).copy(e,o):(a.push(i%1e7),o+=4);o=r/4}else for(;o=10;i/=10)r++;ro.maxE?(i.e=NaN,i.d=null):t.e=10;n/=10)e++;return void(p?e>o.maxE?(i.e=NaN,i.d=null):e{"use strict";e.utils=n(11278),e.Cipher=n(55756),e.DES=n(70778),e.CBC=n(39051),e.EDE=n(50651)},39051:(t,e,n)=>{"use strict";var r=n(79746),i=n(35717),o={};function s(t){r.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e{"use strict";var r=n(79746);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==t.padding}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var n=Math.min(this.buffer.length-this.bufferOff,t.length-e),r=0;r0;r--)e+=this._buffer(t,e),n+=this._flushBuffer(i,n);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,n;return t&&(e=this.update(t)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(n):n},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e{"use strict";var r=n(79746),i=n(35717),o=n(11278),s=n(55756);function a(){this.tmp=new Array(2),this.keys=null}function u(t){s.call(this,t);var e=new a;this._desState=e,this.deriveKeys(e,t.key)}i(u,s),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),r.equal(e.length,this.blockSize,"Invalid key length");var n=o.readUInt32BE(e,0),i=o.readUInt32BE(e,4);o.pc1(n,i,t.tmp,0),n=t.tmp[0],i=t.tmp[1];for(var s=0;s>>1];n=o.r28shl(n,a),i=o.r28shl(i,a),o.pc2(n,i,t.keys,s)}},u.prototype._update=function(t,e,n,r){var i=this._desState,s=o.readUInt32BE(t,e),a=o.readUInt32BE(t,e+4);o.ip(s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,s,a,i.tmp,0):this._decrypt(i,s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],o.writeUInt32BE(n,s,r),o.writeUInt32BE(n,a,r+4)},u.prototype._pad=function(t,e){if(!1===this.padding)return!1;for(var n=t.length-e,r=e;r>>0,s=h}o.rip(a,s,r,i)},u.prototype._decrypt=function(t,e,n,r,i){for(var s=n,a=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],d=t.keys[u+1];o.expand(s,t.tmp,0),c^=t.tmp[0],d^=t.tmp[1];var l=o.substitute(c,d),h=s;s=(a^o.permute(l))>>>0,a=h}o.rip(s,a,r,i)}},50651:(t,e,n)=>{"use strict";var r=n(79746),i=n(35717),o=n(55756),s=n(70778);function a(t,e){r.equal(e.length,24,"Invalid key length");var n=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:o})]:[s.create({type:"decrypt",key:o}),s.create({type:"encrypt",key:i}),s.create({type:"decrypt",key:n})]}function u(t){o.call(this,t);var e=new a(this.type,this.options.key);this._edeState=e}i(u,o),t.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,n,r){var i=this._edeState;i.ciphers[0]._update(t,e,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},u.prototype._pad=s.prototype._pad,u.prototype._unpad=s.prototype._unpad},11278:(t,e)=>{"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,n){t[0+n]=e>>>24,t[1+n]=e>>>16&255,t[2+n]=e>>>8&255,t[3+n]=255&e},e.ip=function(t,e,n,r){for(var i=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1}n[r+0]=i>>>0,n[r+1]=o>>>0},e.rip=function(t,e,n,r){for(var i=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+s&1,i<<=1,i|=t>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=e>>>a+s&1,o<<=1,o|=t>>>a+s&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.pc1=function(t,e,n,r){for(var i=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1}for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.r28shl=function(t,e){return t<>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,r,i){for(var o=0,s=0,a=n.length>>>1,u=0;u>>n[u]&1;for(u=a;u>>n[u]&1;r[i+0]=o>>>0,r[i+1]=s>>>0},e.expand=function(t,e,n){var r=0,i=0;r=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[n+0]=r>>>0,e[n+1]=i>>>0};var r=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var n=0,i=0;i<4;i++)n<<=4,n|=r[64*i+(t>>>18-6*i&63)];for(i=0;i<4;i++)n<<=4,n|=r[256+64*i+(e>>>18-6*i&63)];return n>>>0};var i=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,n=0;n>>i[n]&1;return e>>>0},e.padSplit=function(t,e,n){for(var r=t.toString(2);r.length{var r=n(48764).Buffer,i=n(43590),o=n(29799),s=n(57426),a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(t){var e=new r(o[t].prime,"hex"),n=new r(o[t].gen,"hex");return new s(e,n)},e.createDiffieHellman=e.DiffieHellman=function t(e,n,o,u){return r.isBuffer(n)||void 0===a[n]?t(e,"binary",n,o):(n=n||"binary",u=u||"binary",o=o||new r([2]),r.isBuffer(o)||(o=new r(o,u)),"number"==typeof e?new s(i(e,o),o,!0):(r.isBuffer(e)||(e=new r(e,n)),new s(e,o,!0)))}},57426:(t,e,n)=>{var r=n(48764).Buffer,i=n(83620),o=new(n(63047)),s=new i(24),a=new i(11),u=new i(10),c=new i(3),d=new i(7),l=n(43590),h=n(61798);function f(t,e){return e=e||"utf8",r.isBuffer(t)||(t=new r(t,e)),this._pub=new i(t),this}function p(t,e){return e=e||"utf8",r.isBuffer(t)||(t=new r(t,e)),this._priv=new i(t),this}t.exports=g;var m={};function g(t,e,n){this.setGenerator(e),this.__prime=new i(t),this._prime=i.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=f,this.setPrivateKey=p):this._primeCode=8}function y(t,e){var n=new r(t.toArray());return e?n.toString(e):n}Object.defineProperty(g.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var n=e.toString("hex"),r=[n,t.toString(16)].join("_");if(r in m)return m[r];var i,h=0;if(t.isEven()||!l.simpleSieve||!l.fermatTest(t)||!o.test(t))return h+=1,h+="02"===n||"05"===n?8:4,m[r]=h,h;switch(o.test(t.shrn(1))||(h+=2),n){case"02":t.mod(s).cmp(a)&&(h+=8);break;case"05":(i=t.mod(u)).cmp(c)&&i.cmp(d)&&(h+=8);break;default:h+=4}return m[r]=h,h}(this.__prime,this.__gen)),this._primeCode}}),g.prototype.generateKeys=function(){return this._priv||(this._priv=new i(h(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},g.prototype.computeSecret=function(t){var e=(t=(t=new i(t)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new r(e.toArray()),o=this.getPrime();if(n.length{var r=n(61798);t.exports=b,b.simpleSieve=g,b.fermatTest=y;var i=n(83620),o=new i(24),s=new(n(63047)),a=new i(1),u=new i(2),c=new i(5),d=(new i(16),new i(8),new i(10)),l=new i(3),h=(new i(7),new i(11)),f=new i(4),p=(new i(12),null);function m(){if(null!==p)return p;var t=[];t[0]=2;for(var e=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),i=0;it;)n.ishrn(1);if(n.isEven()&&n.iadd(a),n.testn(1)||n.iadd(u),e.cmp(u)){if(!e.cmp(c))for(;n.mod(d).cmp(l);)n.iadd(f)}else for(;n.mod(o).cmp(h);)n.iadd(f);if(g(p=n.shrn(1))&&g(n)&&y(p)&&y(n)&&s.test(p)&&s.test(n))return n}}},83620:function(t,e,n){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(7748).Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},86266:(t,e,n)=>{"use strict";var r=e;r.version=n(18597).i8,r.utils=n(80953),r.rand=n(29931),r.curve=n(88254),r.curves=n(45427),r.ec=n(57954),r.eddsa=n(65980)},4918:(t,e,n)=>{"use strict";var r=n(73785),i=n(80953),o=i.getNAF,s=i.getJSF,a=i.assert;function u(t,e){this.type=t,this.p=new r(e.p,16),this.red=e.prime?r.red(e.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=e.n&&new r(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var n=t._getDoubles(),r=o(e,1,this._bitLength),i=(1<=s;d--)u=(u<<1)+r[d];c.push(u)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=i;f>0;f--){for(s=0;s=0;c--){for(var d=0;c>=0&&0===s[c];c--)d++;if(c>=0&&d++,u=u.dblp(d),c<0)break;var l=s[c];a(0!==l),u="affine"===t.type?l>0?u.mixedAdd(i[l-1>>1]):u.mixedAdd(i[-l-1>>1].neg()):l>0?u.add(i[l-1>>1]):u.add(i[-l-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,n,r,i){var a,u,c,d=this._wnafT1,l=this._wnafT2,h=this._wnafT3,f=0;for(a=0;a=1;a-=2){var m=a-1,g=a;if(1===d[m]&&1===d[g]){var y=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(y[1]=e[m].add(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].add(e[g].neg())):(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],w=s(n[m],n[g]);for(f=Math.max(w[0].length,f),h[m]=new Array(f),h[g]=new Array(f),u=0;u=0;a--){for(var A=0;a>=0;){var S=!0;for(u=0;u=0&&A++,k=k.dblp(A),a<0)break;for(u=0;u0?c=l[u][I-1>>1]:I<0&&(c=l[u][-I-1>>1].neg()),k="affine"===c.type?k.mixedAdd(c):k.add(c))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i{"use strict";var r=n(80953),i=n(73785),o=n(35717),s=n(4918),a=r.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function c(t,e,n,r,o){s.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(n,16),this.z=r?new i(r,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,s),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),s=r.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),s=r.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},o(c,s.BasePoint),u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},u.prototype.point=function(t,e,n,r){return new c(this,t,e,n,r)},c.fromJSON=function(t,e){return new c(t,e[0],e[1],e[2])},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),s=o.redSub(n),a=r.redSub(e),u=i.redMul(s),c=o.redMul(a),d=i.redMul(a),l=s.redMul(o);return this.curve.point(u,c,l,d)},c.prototype._projDbl=function(){var t,e,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(r=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(r.redSub(u)),n=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=s.redSub(a).redISub(u).redMul(o),e=c.redMul(r.redSub(u)),n=c.redMul(o))}else r=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(r)).redMul(o),e=this.curve._mulC(r).redMul(a.redISub(u)),n=r.redMul(o);return this.curve.point(t,e,n)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),s=i.redSub(r),a=i.redAdd(r),u=n.redAdd(e),c=o.redMul(s),d=a.redMul(u),l=o.redMul(u),h=s.redMul(a);return this.curve.point(c,d,h,l)},c.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),c=i.redAdd(a),d=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),l=r.redMul(u).redMul(d);return this.curve.twisted?(e=r.redMul(c).redMul(s.redSub(this.curve._mulA(o))),n=u.redMul(c)):(e=r.redMul(c).redMul(s.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(l,e,n)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},c.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},88254:(t,e,n)=>{"use strict";var r=e;r.base=n(4918),r.short=n(6673),r.mont=n(22881),r.edwards=n(31138)},22881:(t,e,n)=>{"use strict";var r=n(73785),i=n(35717),o=n(4918),s=n(80953);function a(t){o.call(this,"mont",t),this.a=new r(t.a,16).toRed(this.red),this.b=new r(t.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,n){o.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(e,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},i(u,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),s=i.redMul(r),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},6673:(t,e,n)=>{"use strict";var r=n(80953),i=n(73785),o=n(35717),s=n(4918),a=r.assert;function u(t){s.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,n,r){s.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function d(t,e,n,r){s.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,s),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);e=(e=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(t.lambda)n=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?n=o[0]:(n=o[1],a(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:n,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(n)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),n=new i(2).toRed(e).redInvm(),r=n.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,n,r,o,s,a,u,c,d,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=t,f=this.n.clone(),p=new i(1),m=new i(0),g=new i(0),y=new i(1),b=0;0!==h.cmpn(0);){var w=f.div(h);c=f.sub(w.mul(h)),d=g.sub(w.mul(p));var _=y.sub(w.mul(m));if(!r&&c.cmp(l)<0)e=u.neg(),n=p,r=c.neg(),o=d;else if(r&&2==++b)break;u=c,f=h,h=c,g=p,p=d,y=m,m=_}s=c.neg(),a=d;var v=r.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(v)>=0&&(s=e,a=n),r.negative&&(r=r.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:o},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(s).sub(a),k2:u.add(c).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(e&&!o||!e&&o)&&(r=r.redNeg()),this.point(t,r)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},c.prototype.isInfinity=function(){return this.inf},c.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(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},c.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},c.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(d,s.BasePoint),u.prototype.jpoint=function(t,e,n){return new d(this,t,e,n)},d.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},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 e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(n.redMul(this.z)),a=r.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),l=r.redMul(c),h=u.redSqr().redIAdd(d).redISub(l).redISub(l),f=u.redMul(l.redISub(h)).redISub(o.redMul(d)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(h,f,p)},d.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),d=n.redMul(u),l=a.redSqr().redIAdd(c).redISub(d).redISub(d),h=a.redMul(d.redISub(l)).redISub(i.redMul(c)),f=this.z.redMul(s);return this.curve.jpoint(l,h,f)},d.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},d.prototype.inspect=function(){return this.isInfinity()?"":""},d.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},45427:(t,e,n)=>{"use strict";var r,i=e,o=n(33715),s=n(88254),a=n(80953).assert;function u(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var n=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=u,c("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("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:o.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"]}),c("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:o.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"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(91037)}catch(t){r=void 0}c("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},57954:(t,e,n)=>{"use strict";var r=n(73785),i=n(2156),o=n(80953),s=n(45427),a=n(29931),u=o.assert,c=n(31251),d=n(90611);function l(t){if(!(this instanceof l))return new l(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=l,l.prototype.keyPair=function(t){return new c(this,t)},l.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},l.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},l.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var s=new r(e.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},l.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,n,o){"object"==typeof n&&(o=n,n=null),o||(o={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new r(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),u=t.toArray("be",s),c=new i({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new r(1)),h=0;;h++){var f=o.k?o.k(h):new r(c.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(l)>=0)){var p=this.g.mul(f);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var y=f.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new d({r:g,s:y,recoveryParam:b})}}}}}},l.prototype.verify=function(t,e,n,i){t=this._truncateToN(new r(t,16)),n=this.keyFromPublic(n,i);var o=(e=new d(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),c=u.mul(t).umod(this.n),l=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,n.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,n.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(t,e,n,i){u((3&n)===n,"The recovery param is more than two bits"),e=new d(e,i);var o=this.n,s=new r(t),a=e.r,c=e.s,l=1&n,h=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var f=e.r.invm(o),p=o.sub(s).mul(f).umod(o),m=c.mul(f).umod(o);return this.g.mulAdd(p,a,m)},l.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new d(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},31251:(t,e,n)=>{"use strict";var r=n(73785),i=n(80953).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,n){return e instanceof o?e:new o(t,{pub:e,pubEnc:n})},o.fromPrivate=function(t,e,n){return e instanceof o?e:new o(t,{priv:e,privEnc:n})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new r(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},90611:(t,e,n)=>{"use strict";var r=n(73785),i=n(80953),o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new r(t.r,16),this.s=new r(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function c(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var n=new a;if(48!==t[n.place++])return!1;var o=u(t,n);if(!1===o)return!1;if(o+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var s=u(t,n);if(!1===s)return!1;var c=t.slice(n.place,s+n.place);if(n.place+=s,2!==t[n.place++])return!1;var d=u(t,n);if(!1===d)return!1;if(t.length!==d+n.place)return!1;var l=t.slice(n.place,d+n.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new r(c),this.s=new r(l),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=c(e),n=c(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];d(r,e.length),(r=r.concat(e)).push(2),d(r,n.length);var o=r.concat(n),s=[48];return d(s,o.length),s=s.concat(o),i.encode(s,t)}},65980:(t,e,n)=>{"use strict";var r=n(33715),i=n(45427),o=n(80953),s=o.assert,a=o.parseBytes,u=n(79087),c=n(23622);function d(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof d))return new d(t);t=i[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=r.sha512}t.exports=d,d.prototype.sign=function(t,e){t=a(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),u=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},d.prototype.verify=function(t,e,n){t=a(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},d.prototype.hashInt=function(){for(var t=this.hash(),e=0;e{"use strict";var r=n(80953),i=r.assert,o=r.parseBytes,s=r.cachedProperty;function a(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),r.encode(this.secret(),t)},a.prototype.getPublic=function(t){return r.encode(this.pubBytes(),t)},t.exports=a},23622:(t,e,n)=>{"use strict";var r=n(73785),i=n(80953),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof r&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},91037:t=>{t.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"]]}}},80953:(t,e,n)=>{"use strict";var r=e,i=n(73785),o=n(79746),s=n(34504);r.assert=o,r.toArray=s.toArray,r.zero2=s.zero2,r.toHex=s.toHex,r.encode=s.encode,r.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,r[s]=a,o.iushrn(1)}return r},r.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),s=0==(1&u)?0:3!=(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(s),a=0==(1&c)?0:3!=(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},r.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new i(t,"hex","le")}},73785:function(t,e,n){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(85568).Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},26729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],a]:t._events[u].push(a):(t._events[u]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i{"use strict";var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var i,o,s,c;if(a(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=t,d.type=e,d.count=s.length,c=d,console&&console.warn&&console.warn(c)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function h(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var c=u.length,d=p(u,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return h(this,t,!0)},o.prototype.rawListeners=function(t){return h(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},13048:(t,e,n)=>{var r=n(89509).Buffer,i=n(62318);t.exports=function(t,e,n,o){if(r.isBuffer(t)||(t=r.from(t,"binary")),e&&(r.isBuffer(e)||(e=r.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=n/8,a=r.alloc(s),u=r.alloc(o||0),c=r.alloc(0);s>0||o>0;){var d=new i;d.update(c),d.update(t),e&&d.update(e),c=d.digest();var l=0;if(s>0){var h=a.length-s;l=Math.min(s,c.length),c.copy(a,h,0,l),s-=l}if(l0){var f=u.length-o,p=Math.min(o,c.length-l);c.copy(u,f,l,l+p),o-=p}}return c.fill(0),{key:a,iv:u}}},3349:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=n(70326).Transform;function o(t){i.call(this),this._block=r.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(35717)(o,i),o.prototype._transform=function(t,e,n){var r=null;try{this.update(t,e)}catch(t){r=t}n(r)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=r.from(t,e));for(var n=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},9786:t=>{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,4)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-9,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var c=("number"!=typeof u&&(u=0),u+1>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(r(e,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},62910:(t,e,n)=>{"use strict";var r=n(34155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=d;var o=n(45789),s=n(70469);n(35717)(d,o);for(var a=i(s.prototype),u=0;u{"use strict";t.exports=i;var r=n(70421);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(35717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},45789:(t,e,n)=>{"use strict";var r,i=n(34155);t.exports=S,S.ReadableState=A,n(17187).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=n(50677),u=n(48764).Buffer,c=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=n(31616);o=d&&d.debuglog?d.debuglog("stream"):function(){};var l,h,f,p=n(98354),m=n(35072),g=n(31222).getHighWaterMark,y=n(9786).q,b=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(35717)(S,a);var k=m.errorOrDestroy,M=["error","close","destroy","pause","resume"];function A(t,e,i){r=r||n(62910),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(33893).s),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function S(t){if(r=r||n(62910),!(this instanceof S))return new S(t);var e=this instanceof r;this._readableState=new A(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function I(t,e,n,r,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(i||(s=function(t,e){var n,r;return r=e,u.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],e)),n}(a,e)),s)k(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r)a.endEmitted?k(t,new v):x(t,a,e,!0);else if(a.ended)k(t,new w);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):L(t,a)):x(t,a,e,!1)}else r||(a.reading=!1,L(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function P(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(B,t))}function B(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function L(t,e){e.readingMore||(e.readingMore=!0,i.nextTick($,t,e))}function $(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function z(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function j(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?z(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&z(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&z(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(t){k(this,new _("_read()"))},S.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?m:u;function u(){o("onend"),t.end()}r.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",f),t.removeListener("finish",p),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",e),n.removeListener("end",u),n.removeListener("end",m),n.removeListener("data",l),d=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(n);t.on("drain",c);var d=!1;function l(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==j(r.pipes,t))&&!d&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function h(e){o("onerror",e),m(),t.removeListener("error",h),0===s(t,"error")&&k(t,e)}function f(){t.removeListener("finish",p),m()}function p(){o("onfinish"),t.removeListener("close",f),m()}function m(){o("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",h),t.once("close",f),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?P(this):r.reading||i.nextTick(O,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(R,this),n},S.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(R,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(D,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s{"use strict";t.exports=d;var r=n(9786).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(62910);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var r,i=n(34155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=S,S.WritableState=A;var s,a={deprecate:n(94927)},u=n(50677),c=n(48764).Buffer,d=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=n(35072),h=n(31222).getHighWaterMark,f=n(9786).q,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,w=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,v=f.ERR_UNKNOWN_ENCODING,k=l.errorOrDestroy;function M(){}function A(t,e,s){r=r||n(62910),t=t||{},"boolean"!=typeof s&&(s=e instanceof r),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(B,t,e),t._writableState.errorEmitted=!0,k(t,r)):(o(r),t._writableState.errorEmitted=!0,k(t,r),B(t,e))}(t,n,r,e,o);else{var s=T(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(t,n),r?i.nextTick(x,t,n,s,o):x(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function S(t){var e=this instanceof(r=r||n(62910));if(!e&&!s.call(S,this))return new S(t);this._writableState=new A(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function I(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function x(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),B(t,e)}function E(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,I(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,d=n.encoding,l=n.callback;if(I(t,e,!1,e.objectMode?1:c.length,c,d,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(n){e.pendingcb--,n&&k(t,n),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var n=T(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(35717)(S,u),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===S&&t&&t._writableState instanceof A}})):s=function(t){return t instanceof this},S.prototype.pipe=function(){k(this,new y)},S.prototype.write=function(t,e,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=t,c.isBuffer(r)||r instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=M),o.ending?function(t,e){var n=new _;k(t,n),i.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o;return null===n?o=new w:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(k(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,n){n(new m("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,B(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(t,e){e(t)}},30527:(t,e,n)=>{"use strict";var r,i=n(34155);function o(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=n(28640),a=Symbol("lastResolve"),u=Symbol("lastReject"),c=Symbol("error"),d=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(t,e){return{value:t,done:e}}function m(t){var e=t[a];if(null!==e){var n=t[f].read();null!==n&&(t[l]=null,t[a]=null,t[u]=null,e(p(n,!1)))}}function g(t){i.nextTick(m,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(r={get stream(){return this[f]},next:function(){var t=this,e=this[c];if(null!==e)return Promise.reject(e);if(this[d])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[c]?n(t[c]):e(p(void 0,!0))}))}));var n,r=this[l];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[d]?n(p(void 0,!0)):e[h](n,r)}),r)}}(r,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),y);t.exports=function(t){var e,n=Object.create(b,(o(e={},f,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,c,{value:null,writable:!0}),o(e,d,{value:t._readableState.endEmitted,writable:!0}),o(e,h,{value:function(t,e){var r=n[f].read();r?(n[l]=null,n[a]=null,n[u]=null,t(p(r,!1))):(n[a]=t,n[u]=e)},writable:!0}),e));return n[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[u];return null!==e&&(n[l]=null,n[a]=null,n[u]=null,e(t)),void(n[c]=t)}var r=n[a];null!==r&&(n[l]=null,n[a]=null,n[u]=null,r(p(void 0,!0))),n[d]=!0})),t.on("readable",g.bind(null,n)),n}},98354:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return u.alloc(0);for(var e,n,r,i=u.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,u.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=u.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:d,value:function(t,e){return c(this,i(i({},e),{},{depth:0,customInspect:!1}))}}])&&s(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},35072:(t,e,n)=>{"use strict";var r=n(34155);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(s,this,t)):r.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},28640:(t,e,n)=>{"use strict";var r=n(9786).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},64218:(t,e,n)=>{"use strict";var r,i=n(9786).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t){t()}function c(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),i=0;i0,(function(t){d||(d=t),t&&h.forEach(u),o||(h.forEach(u),l(d))}))}));return e.reduce(c)}},31222:(t,e,n)=>{"use strict";var r=n(9786).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},50677:(t,e,n)=>{t.exports=n(17187).EventEmitter},70326:(t,e,n)=>{(e=t.exports=n(45789)).Stream=e,e.Readable=e,e.Writable=n(70469),e.Duplex=n(62910),e.Transform=n(70421),e.PassThrough=n(58994),e.finished=n(28640),e.pipeline=n(64218)},33893:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=d,this.end=l,e=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function d(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},33715:(t,e,n)=>{var r=e;r.utils=n(26436),r.common=n(95772),r.sha=n(89041),r.ripemd=n(12949),r.hmac=n(52344),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},95772:(t,e,n)=>{"use strict";var r=n(26436),i=n(79746);function o(){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}e.BlockHash=o,o.prototype.update=function(t,e){if(t=r.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=r.join32(t,0,t.length-n,this.endian);for(var i=0;i>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o{"use strict";var r=n(26436),i=n(79746);function o(t,e,n){if(!(this instanceof o))return new o(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(e,n))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e{"use strict";var r=n(26436),i=n(95772),o=r.rotl32,s=r.sum32,a=r.sum32_3,u=r.sum32_4,c=i.BlockHash;function d(){if(!(this instanceof d))return new d;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function h(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function f(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}r.inherits(d,c),e.ripemd160=d,d.blockSize=512,d.outSize=160,d.hmacStrength=192,d.padLength=64,d.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],c=this.h[3],d=this.h[4],b=n,w=r,_=i,v=c,k=d,M=0;M<80;M++){var A=s(o(u(n,l(M,r,i,c),t[p[M]+e],h(M)),g[M]),d);n=d,d=c,c=o(i,10),i=r,r=A,A=s(o(u(b,l(79-M,w,_,v),t[m[M]+e],f(M)),y[M]),k),b=k,k=v,v=o(_,10),_=w,w=A}A=a(this.h[1],i,v),this.h[1]=a(this.h[2],c,k),this.h[2]=a(this.h[3],d,b),this.h[3]=a(this.h[4],n,w),this.h[4]=a(this.h[0],r,_),this.h[0]=A},d.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"little"):r.split32(this.h,"little")};var p=[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],m=[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],g=[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],y=[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]},89041:(t,e,n)=>{"use strict";e.sha1=n(84761),e.sha224=n(10799),e.sha256=n(89344),e.sha384=n(80772),e.sha512=n(45900)},84761:(t,e,n)=>{"use strict";var r=n(26436),i=n(95772),o=n(37038),s=r.rotl32,a=r.sum32,u=r.sum32_5,c=o.ft_1,d=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;d.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(h,d),t.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r{"use strict";var r=n(26436),i=n(89344);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}r.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}},89344:(t,e,n)=>{"use strict";var r=n(26436),i=n(95772),o=n(37038),s=n(79746),a=r.sum32,u=r.sum32_4,c=r.sum32_5,d=o.ch32,l=o.maj32,h=o.s0_256,f=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,y=[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;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}r.inherits(b,g),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r{"use strict";var r=n(26436),i=n(45900);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}r.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}},45900:(t,e,n)=>{"use strict";var r=n(26436),i=n(95772),o=n(79746),s=r.rotr64_hi,a=r.rotr64_lo,u=r.shr64_hi,c=r.shr64_lo,d=r.sum64,l=r.sum64_hi,h=r.sum64_lo,f=r.sum64_4_hi,p=r.sum64_4_lo,m=r.sum64_5_hi,g=r.sum64_5_lo,y=i.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 w(){if(!(this instanceof w))return new w;y.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=new Array(160)}function _(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function v(t,e,n,r,i,o){var s=e&r^~e&o;return s<0&&(s+=4294967296),s}function k(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function M(t,e,n,r,i,o){var s=e&r^e&o^r&o;return s<0&&(s+=4294967296),s}function A(t,e){var n=s(t,e,28)^s(e,t,2)^s(e,t,7);return n<0&&(n+=4294967296),n}function S(t,e){var n=a(t,e,28)^a(e,t,2)^a(e,t,7);return n<0&&(n+=4294967296),n}function I(t,e){var n=a(t,e,14)^a(t,e,18)^a(e,t,9);return n<0&&(n+=4294967296),n}function x(t,e){var n=s(t,e,1)^s(t,e,8)^u(t,e,7);return n<0&&(n+=4294967296),n}function E(t,e){var n=a(t,e,1)^a(t,e,8)^c(t,e,7);return n<0&&(n+=4294967296),n}function T(t,e){var n=a(t,e,19)^a(e,t,29)^c(t,e,6);return n<0&&(n+=4294967296),n}r.inherits(w,y),t.exports=w,w.blockSize=1024,w.outSize=512,w.hmacStrength=192,w.padLength=128,w.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r{"use strict";var r=n(26436).rotr32;function i(t,e,n){return t&e^~t&n}function o(t,e,n){return t&e^t&n^e&n}function s(t,e,n){return t^e^n}e.ft_1=function(t,e,n,r){return 0===t?i(e,n,r):1===t||3===t?s(e,n,r):2===t?o(e,n,r):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return r(t,2)^r(t,13)^r(t,22)},e.s1_256=function(t){return r(t,6)^r(t,11)^r(t,25)},e.g0_256=function(t){return r(t,7)^r(t,18)^t>>>3},e.g1_256=function(t){return r(t,17)^r(t,19)^t>>>10}},26436:(t,e,n)=>{"use strict";var r=n(79746),i=n(35717);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>0}return s},e.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},e.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},e.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,r){return(e+r>>>0>>0},e.sum64_lo=function(t,e,n,r){return e+r>>>0},e.sum64_4_hi=function(t,e,n,r,i,o,s,a){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,n,r,i,o,s,a){return e+r+o+a>>>0},e.sum64_5_hi=function(t,e,n,r,i,o,s,a,u,c){var d=0,l=e;return d+=(l=l+r>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,n,r,i,o,s,a,u,c){return e+r+o+a+c>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},2156:(t,e,n)=>{"use strict";var r=n(33715),i=n(34504),o=n(79746);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),n=i.toArray(t.nonce,t.nonceEnc||"hex"),r=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}t.exports=s,s.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},s.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=i.toArray(n,r||"hex"),this._update(n));for(var o=[];o.length{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,d=-7,l=n?i-1:0,h=n?-1:1,f=t[e+l];for(l+=h,o=f&(1<<-d)-1,f>>=-d,d+=a;d>0;o=256*o+t[e+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+t[e+l],l+=h,d-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,d=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;t[n+f]=255&s,f+=p,s/=256,c-=8);t[n+f-p]|=128*m}},35717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},31198:(t,e,n)=>{"use strict";const r=n(74608).v4,i=n(17741),o=function(t,e){if(!(this instanceof o))return new o(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return r()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};t.exports=o,o.prototype.request=function(t,e,n,r){const o=this;let s=null;const a=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&t&&"object"==typeof t&&"function"==typeof e)r=e,s=t;else{"function"==typeof n&&(r=n,n=void 0);const o="function"==typeof r;try{s=i(t,e,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(o)return r(t);throw t}if(!o)return s}let u;try{u=JSON.stringify(s,this.options.replacer)}catch(t){return r(t)}return this.callServer(u,(function(t,e){o._parseResponse(t,e,r)})),s},o.prototype._parseResponse=function(t,e,n){if(t)return void n(t);if(!e)return n();let r;try{r=JSON.parse(e,this.options.reviver)}catch(t){return n(t)}if(3===n.length){if(Array.isArray(r)){const t=function(t){return void 0!==t.error},e=function(e){return!t(e)};return n(null,r.filter(t),r.filter(e))}return n(null,r.error,r.result)}n(null,r)}},17741:(t,e,n)=>{"use strict";const r=n(74608).v4;t.exports=function(t,e,n,i){if("string"!=typeof t)throw new TypeError(t+" must be a string");const o="number"==typeof(i=i||{}).version?i.version:2;if(1!==o&&2!==o)throw new TypeError(o+" must be 1 or 2");const s={method:t};if(2===o&&(s.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");s.params=e}if(void 0===n){const t="function"==typeof i.generator?i.generator:function(){return r()};s.id=t(s,i)}else 2===o&&null===n?i.notificationIdNull&&(s.id=null):s.id=n;return s}},55733:(t,e,n)=>{var r=n(48764).Buffer,i=n(34155);t.exports=function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[s]={exports:{}};e[s][0].call(c.exports,(function(t){return i(e[s][1][t]||t)}),c,c.exports,t,e,n,r)}return n[s].exports}for(var o=void 0,s=0;s>2,a=(3&e)<<4|n>>4,u=1>6:64,c=2>4,n=(15&s)<<4|(a=o.indexOf(t.charAt(c++)))>>2,r=(3&a)<<6|(u=o.indexOf(t.charAt(c++))),h[d++]=e,64!==a&&(h[d++]=n),64!==u&&(h[d++]=r);return h}},{"./support":30,"./utils":32}],2:[function(t,e,n){"use strict";var r=t("./external"),i=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),s=t("./stream/DataLengthProbe");function a(t,e,n,r,i){this.compressedSize=t,this.uncompressedSize=e,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var t=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(t,e,n){return t.pipe(new o).pipe(new s("uncompressedSize")).pipe(e.compressWorker(n)).pipe(new s("compressedSize")).withStreamInfo("compression",e)},e.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,n){"use strict";var r=t("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,n){"use strict";var r=t("./utils"),i=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==r.getTypeOf(t)?function(t,e,n,r){var o=i,s=0+n;t^=-1;for(var a=0;a>>8^o[255&(t^e[a])];return-1^t}(0|e,t,t.length):function(t,e,n,r){var o=i,s=0+n;t^=-1;for(var a=0;a>>8^o[255&(t^e.charCodeAt(a))];return-1^t}(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(t,e,n){"use strict";var r;r="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:r}},{lie:37}],7:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=t("pako"),o=t("./utils"),s=t("./stream/GenericWorker"),a=r?"uint8array":"array";function u(t,e){s.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}n.magic="\b\0",o.inherits(u,s),u.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(a,t.data),!1)},u.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},n.compressWorker=function(t){return new u("Deflate",t)},n.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,n){"use strict";function r(t,e){var n,r="";for(n=0;n>>=8;return r}function i(t,e,n,i,s,d){var l,h,f=t.file,p=t.compression,m=d!==a.utf8encode,g=o.transformTo("string",d(f.name)),y=o.transformTo("string",a.utf8encode(f.name)),b=f.comment,w=o.transformTo("string",d(b)),_=o.transformTo("string",a.utf8encode(b)),v=y.length!==f.name.length,k=_.length!==b.length,M="",A="",S="",I=f.dir,x=f.date,E={crc32:0,compressedSize:0,uncompressedSize:0};e&&!n||(E.crc32=t.crc32,E.compressedSize=t.compressedSize,E.uncompressedSize=t.uncompressedSize);var T=0;e&&(T|=8),m||!v&&!k||(T|=2048);var P=0,B=0;I&&(P|=16),"UNIX"===s?(B=798,P|=function(t,e){var n=t;return t||(n=e?16893:33204),(65535&n)<<16}(f.unixPermissions,I)):(B=20,P|=function(t){return 63&(t||0)}(f.dosPermissions)),l=x.getUTCHours(),l<<=6,l|=x.getUTCMinutes(),l<<=5,l|=x.getUTCSeconds()/2,h=x.getUTCFullYear()-1980,h<<=4,h|=x.getUTCMonth()+1,h<<=5,h|=x.getUTCDate(),v&&(A=r(1,1)+r(u(g),4)+y,M+="up"+r(A.length,2)+A),k&&(S=r(1,1)+r(u(w),4)+_,M+="uc"+r(S.length,2)+S);var L="";return L+="\n\0",L+=r(T,2),L+=p.magic,L+=r(l,2),L+=r(h,2),L+=r(E.crc32,4),L+=r(E.compressedSize,4),L+=r(E.uncompressedSize,4),L+=r(g.length,2),L+=r(M.length,2),{fileRecord:c.LOCAL_FILE_HEADER+L+g+M,dirRecord:c.CENTRAL_FILE_HEADER+r(B,2)+L+r(w.length,2)+"\0\0\0\0"+r(P,4)+r(i,4)+g+M+w}}var o=t("../utils"),s=t("../stream/GenericWorker"),a=t("../utf8"),u=t("../crc32"),c=t("../signature");function d(t,e,n,r){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(d,s),d.prototype.push=function(t){var e=t.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,s.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:n?(e+100*(n-r-1))/n:100}}))},d.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var n=i(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,n=i(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),e)this.push({data:function(t){return c.DATA_DESCRIPTOR+r(t.crc32,4)+r(t.compressedSize,4)+r(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e=this.index;e--)n=(n<<8)+this.byteAt(e);return this.index+=t,n},readString:function(t){return r.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=i},{"../utils":32}],19:[function(t,e,n){"use strict";var r=t("./Uint8ArrayReader");function i(t){r.call(this,t)}t("../utils").inherits(i,r),i.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,n){"use strict";var r=t("./DataReader");function i(t){r.call(this,t)}t("../utils").inherits(i,r),i.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},i.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},i.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},i.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./DataReader":18}],21:[function(t,e,n){"use strict";var r=t("./ArrayReader");function i(t){r.call(this,t)}t("../utils").inherits(i,r),i.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,n){"use strict";var r=t("../utils"),i=t("../support"),o=t("./ArrayReader"),s=t("./StringReader"),a=t("./NodeBufferReader"),u=t("./Uint8ArrayReader");e.exports=function(t){var e=r.getTypeOf(t);return r.checkSupport(e),"string"!==e||i.uint8array?"nodebuffer"===e?new a(t):i.uint8array?new u(r.transformTo("uint8array",t)):new o(r.transformTo("array",t)):new s(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,n){"use strict";var r=t("./GenericWorker"),i=t("../utils");function o(t){r.call(this,"ConvertWorker to "+t),this.destType=t}i.inherits(o,r),o.prototype.processChunk=function(t){this.push({data:i.transformTo(this.destType,t.data),meta:t.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,n){"use strict";var r=t("./GenericWorker"),i=t("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,r),o.prototype.processChunk=function(t){this.streamInfo.crc32=i(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,n){"use strict";var r=t("../utils"),i=t("./GenericWorker");function o(t){i.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}r.inherits(o,i),o.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}i.prototype.processChunk.call(this,t)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,n){"use strict";var r=t("../utils"),i=t("./GenericWorker");function o(t){i.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=r.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}r.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,n){"use strict";function r(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var n=0;n "+t:t}},e.exports=r},{}],29:[function(t,e,n){"use strict";var i=t("../utils"),o=t("./ConvertWorker"),s=t("./GenericWorker"),a=t("../base64"),u=t("../support"),c=t("../external"),d=null;if(u.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function l(t,e,n){var r=e;switch(e){case"blob":case"arraybuffer":r="uint8array";break;case"base64":r="string"}try{this._internalType=r,this._outputType=e,this._mimeType=n,i.checkSupport(r),this._worker=t.pipe(new o(r)),t.lock()}catch(t){this._worker=new s("error"),this._worker.error(t)}}l.prototype={accumulate:function(t){return function(t,e){return new c.Promise((function(n,o){var s=[],u=t._internalType,c=t._outputType,d=t._mimeType;t.on("data",(function(t,n){s.push(t),e&&e(n)})).on("error",(function(t){s=[],o(t)})).on("end",(function(){try{var t=function(t,e,n){switch(t){case"blob":return i.newBlob(i.transformTo("arraybuffer",e),n);case"base64":return a.encode(e);default:return i.transformTo(t,e)}}(c,function(t,e){var n,i=0,o=null,s=0;for(n=0;n>>6:(n<65536?e[s++]=224|n>>>12:(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63),e[s++]=128|n>>>6&63),e[s++]=128|63&n);return e}(t)},n.utf8decode=function(t){return i.nodebuffer?r.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,n,i,o,s=t.length,u=new Array(2*s);for(e=n=0;e>10&1023,u[n++]=56320|1023&i)}return u.length!==n&&(u.subarray?u=u.subarray(0,n):u.length=n),r.applyFromCharCode(u)}(t=r.transformTo(i.uint8array?"uint8array":"array",t))},r.inherits(c,s),c.prototype.processChunk=function(t){var e=r.transformTo(i.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=e;(e=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),e.set(o,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var s=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return n<0||0===n?e:n+a[t[n]]>e?n:e}(e),u=e;s!==e.length&&(i.uint8array?(u=e.subarray(0,s),this.leftOver=e.subarray(s,e.length)):(u=e.slice(0,s),this.leftOver=e.slice(s,e.length))),this.push({data:n.utf8decode(u),meta:t.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,r.inherits(d,s),d.prototype.processChunk=function(t){this.push({data:n.utf8encode(t.data),meta:t.meta})},n.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,n){"use strict";var r=t("./support"),i=t("./base64"),o=t("./nodejsUtils"),s=t("./external");function a(t){return t}function u(t,e){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,n,r,i=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4>>6:(n<65536?e[s++]=224|n>>>12:(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63),e[s++]=128|n>>>6&63),e[s++]=128|63&n);return e},n.buf2binstring=function(t){return u(t,t.length)},n.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n>10&1023,c[r++]=56320|1023&i)}return u(c,r)},n.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return n<0||0===n?e:n+s[t[n]]>e?n:e}},{"./common":41}],43:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,s=0;0!==n;){for(n-=s=2e3>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e,n,i){var o=r,s=i+n;t^=-1;for(var a=i;a>>8^o[255&(t^e[a])];return-1^t}},{}],46:[function(t,e,n){"use strict";var r,i=t("../utils/common"),o=t("./trees"),s=t("./adler32"),a=t("./crc32"),u=t("./messages"),c=0,d=0,l=-2,h=2,f=8,p=286,m=30,g=19,y=2*p+1,b=15,w=3,_=258,v=_+w+1,k=42,M=113;function A(t,e){return t.msg=u[e],e}function S(t){return(t<<1)-(4t.avail_out&&(n=t.avail_out),0!==n&&(i.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function E(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,x(t.strm)}function T(t,e){t.pending_buf[t.pending++]=e}function P(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function B(t,e){var n,r,i=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match,u=t.strstart>t.w_size-v?t.strstart-(t.w_size-v):0,c=t.window,d=t.w_mask,l=t.prev,h=t.strstart+_,f=c[o+s-1],p=c[o+s];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(c[(n=e)+s]===p&&c[n+s-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&ou&&0!=--i);return s<=t.lookahead?s:t.lookahead}function L(t){var e,n,r,o,u,c,d,l,h,f,p=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=p+(p-v)){for(i.arraySet(t.window,t.window,p,p,0),t.match_start-=p,t.strstart-=p,t.block_start-=p,e=n=t.hash_size;r=t.head[--e],t.head[e]=p<=r?r-p:0,--n;);for(e=n=p;r=t.prev[--e],t.prev[e]=p<=r?r-p:0,--n;);o+=p}if(0===t.strm.avail_in)break;if(c=t.strm,d=t.window,l=t.strstart+t.lookahead,f=void 0,(h=o)<(f=c.avail_in)&&(f=h),n=0===f?0:(c.avail_in-=f,i.arraySet(d,c.input,c.next_in,f,l),1===c.state.wrap?c.adler=s(c.adler,d,f,l):2===c.state.wrap&&(c.adler=a(c.adler,d,f,l)),c.next_in+=f,c.total_in+=f,f),t.lookahead+=n,t.lookahead+t.insert>=w)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<=w&&(t.ins_h=(t.ins_h<=w)if(r=o._tr_tally(t,t.strstart-t.match_start,t.match_length-w),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=w){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=w&&(t.ins_h=(t.ins_h<=w&&t.match_length<=t.prev_length){for(i=t.strstart+t.lookahead-w,r=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-w),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=i&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(L(t),0===t.lookahead&&e===c)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,E(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-v&&(E(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(E(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(E(t,!1),t.strm.avail_out),1)})),new O(4,4,8,4,$),new O(4,5,16,8,$),new O(4,6,32,32,$),new O(4,4,16,16,R),new O(8,16,32,32,R),new O(8,16,128,128,R),new O(8,32,128,256,R),new O(32,128,258,1024,R),new O(32,258,258,4096,R)],n.deflateInit=function(t,e){return z(t,e,f,15,8,0)},n.deflateInit2=z,n.deflateReset=N,n.deflateResetKeep=C,n.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?l:(t.state.gzhead=e,d):l},n.deflate=function(t,e){var n,i,s,u;if(!t||!t.state||5>8&255),T(i,i.gzhead.time>>16&255),T(i,i.gzhead.time>>24&255),T(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),T(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(T(i,255&i.gzhead.extra.length),T(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=a(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(T(i,0),T(i,0),T(i,0),T(i,0),T(i,0),T(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),T(i,3),i.status=M);else{var h=f+(i.w_bits-8<<4)<<8;h|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(h|=32),h+=31-h%31,i.status=M,P(i,h),0!==i.strstart&&(P(i,t.adler>>>16),P(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),x(t),s=i.pending,i.pending!==i.pending_buf_size));)T(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),x(t),s=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexs&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),x(t),s=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexs&&(t.adler=a(t.adler,i.pending_buf,i.pending-s,s)),0===u&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&x(t),i.pending+2<=i.pending_buf_size&&(T(i,255&t.adler),T(i,t.adler>>8&255),t.adler=0,i.status=M)):i.status=M),0!==i.pending){if(x(t),0===t.avail_out)return i.last_flush=-1,d}else if(0===t.avail_in&&S(e)<=S(n)&&4!==e)return A(t,-5);if(666===i.status&&0!==t.avail_in)return A(t,-5);if(0!==t.avail_in||0!==i.lookahead||e!==c&&666!==i.status){var p=2===i.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(L(t),0===t.lookahead)){if(e===c)return 1;break}if(t.match_length=0,n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(E(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(E(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(E(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var n,r,i,s,a=t.window;;){if(t.lookahead<=_){if(L(t),t.lookahead<=_&&e===c)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=w&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=w?(n=o._tr_tally(t,1,t.match_length-w),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(E(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(E(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(E(t,!1),0===t.strm.avail_out)?1:2}(i,e):r[i.level].func(i,e);if(3!==p&&4!==p||(i.status=666),1===p||3===p)return 0===t.avail_out&&(i.last_flush=-1),d;if(2===p&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(I(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),x(t),0===t.avail_out))return i.last_flush=-1,d}return 4!==e?d:i.wrap<=0?1:(2===i.wrap?(T(i,255&t.adler),T(i,t.adler>>8&255),T(i,t.adler>>16&255),T(i,t.adler>>24&255),T(i,255&t.total_in),T(i,t.total_in>>8&255),T(i,t.total_in>>16&255),T(i,t.total_in>>24&255)):(P(i,t.adler>>>16),P(i,65535&t.adler)),x(t),0=n.w_size&&(0===a&&(I(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,e,p-n.w_size,n.w_size,0),e=f,p=n.w_size),u=t.avail_in,c=t.next_in,h=t.input,t.avail_in=p,t.next_in=0,t.input=e,L(n);n.lookahead>=w;){for(r=n.strstart,o=n.lookahead-(w-1);n.ins_h=(n.ins_h<>>=_=w>>>24,p-=_,0==(_=w>>>16&255))I[o++]=65535&w;else{if(!(16&_)){if(0==(64&_)){w=m[(65535&w)+(f&(1<<_)-1)];continue e}if(32&_){n.mode=12;break t}t.msg="invalid literal/length code",n.mode=30;break t}v=65535&w,(_&=15)&&(p<_&&(f+=S[r++]<>>=_,p-=_),p<15&&(f+=S[r++]<>>=_=w>>>24,p-=_,!(16&(_=w>>>16&255))){if(0==(64&_)){w=g[(65535&w)+(f&(1<<_)-1)];continue n}t.msg="invalid distance code",n.mode=30;break t}if(k=65535&w,p<(_&=15)&&(f+=S[r++]<>>=_,p-=_,(_=o-s)>3,f&=(1<<(p-=v<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function p(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function m(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=d,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(l),e.distcode=e.distdyn=new r.Buf32(h),e.sane=1,e.back=-1,u):c}function g(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,m(t)):c}function y(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15=s.wsize?(r.arraySet(s.window,e,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(o=s.wsize-s.wnext)&&(o=i),r.arraySet(s.window,e,n-i,o,s.wnext),(i-=o)?(r.arraySet(s.window,e,n-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,n.check=o(n.check,N,2,0),w=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){t.msg="incorrect header check",n.mode=30;break}if(8!=(15&b)){t.msg="unknown compression method",n.mode=30;break}if(w-=4,$=8+(15&(b>>>=4)),0===n.wbits)n.wbits=$;else if($>n.wbits){t.msg="invalid window size",n.mode=30;break}n.dmax=1<<$,t.adler=n.check=1,n.mode=512&b?10:12,w=b=0;break;case 2:for(;w<16;){if(0===g)break t;g--,b+=l[p++]<>8&1),512&n.flags&&(N[0]=255&b,N[1]=b>>>8&255,n.check=o(n.check,N,2,0)),w=b=0,n.mode=3;case 3:for(;w<32;){if(0===g)break t;g--,b+=l[p++]<>>8&255,N[2]=b>>>16&255,N[3]=b>>>24&255,n.check=o(n.check,N,4,0)),w=b=0,n.mode=4;case 4:for(;w<16;){if(0===g)break t;g--,b+=l[p++]<>8),512&n.flags&&(N[0]=255&b,N[1]=b>>>8&255,n.check=o(n.check,N,2,0)),w=b=0,n.mode=5;case 5:if(1024&n.flags){for(;w<16;){if(0===g)break t;g--,b+=l[p++]<>>8&255,n.check=o(n.check,N,2,0)),w=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(g<(A=n.length)&&(A=g),A&&(n.head&&($=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,l,p,A,$)),512&n.flags&&(n.check=o(n.check,l,A,p)),g-=A,p+=A,n.length-=A),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===g)break t;for(A=0;$=l[p+A++],n.head&&$&&n.length<65536&&(n.head.name+=String.fromCharCode($)),$&&A>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=12;break;case 10:for(;w<32;){if(0===g)break t;g--,b+=l[p++]<>>=7&w,w-=7&w,n.mode=27;break}for(;w<3;){if(0===g)break t;g--,b+=l[p++]<>>=1)){case 0:n.mode=14;break;case 1:if(k(n),n.mode=20,6!==e)break;b>>>=2,w-=2;break t;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=30}b>>>=2,w-=2;break;case 14:for(b>>>=7&w,w-=7&w;w<32;){if(0===g)break t;g--,b+=l[p++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&b,w=b=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(A=n.length){if(g>>=5,w-=5,n.ndist=1+(31&b),b>>>=5,w-=5,n.ncode=4+(15&b),b>>>=4,w-=4,286>>=3,w-=3}for(;n.have<19;)n.lens[z[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,O={bits:n.lenbits},R=a(0,n.lens,0,19,n.lencode,0,n.work,O),n.lenbits=O.bits,R){t.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,T=65535&C,!((x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>>=x,w-=x,n.lens[n.have++]=T;else{if(16===T){for(D=x+2;w>>=x,w-=x,0===n.have){t.msg="invalid bit length repeat",n.mode=30;break}$=n.lens[n.have-1],A=3+(3&b),b>>>=2,w-=2}else if(17===T){for(D=x+3;w>>=x)),b>>>=3,w-=3}else{for(D=x+7;w>>=x)),b>>>=7,w-=7}if(n.have+A>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=30;break}for(;A--;)n.lens[n.have++]=$}}if(30===n.mode)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,O={bits:n.lenbits},R=a(1,n.lens,0,n.nlen,n.lencode,0,n.work,O),n.lenbits=O.bits,R){t.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,O={bits:n.distbits},R=a(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,O),n.distbits=O.bits,R){t.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(6<=g&&258<=y){t.next_out=m,t.avail_out=y,t.next_in=p,t.avail_in=g,n.hold=b,n.bits=w,s(t,v),m=t.next_out,h=t.output,y=t.avail_out,p=t.next_in,l=t.input,g=t.avail_in,b=n.hold,w=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;E=(C=n.lencode[b&(1<>>16&255,T=65535&C,!((x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>P)])>>>16&255,T=65535&C,!(P+(x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>>=P,w-=P,n.back+=P}if(b>>>=x,w-=x,n.back+=x,n.length=T,0===E){n.mode=26;break}if(32&E){n.back=-1,n.mode=12;break}if(64&E){t.msg="invalid literal/length code",n.mode=30;break}n.extra=15&E,n.mode=22;case 22:if(n.extra){for(D=n.extra;w>>=n.extra,w-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;E=(C=n.distcode[b&(1<>>16&255,T=65535&C,!((x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>P)])>>>16&255,T=65535&C,!(P+(x=C>>>24)<=w);){if(0===g)break t;g--,b+=l[p++]<>>=P,w-=P,n.back+=P}if(b>>>=x,w-=x,n.back+=x,64&E){t.msg="invalid distance code",n.mode=30;break}n.offset=T,n.extra=15&E,n.mode=24;case 24:if(n.extra){for(D=n.extra;w>>=n.extra,w-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===y)break t;if(A=v-y,n.offset>A){if((A=n.offset-A)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=30;break}S=A>n.wnext?(A-=n.wnext,n.wsize-A):n.wnext-A,A>n.length&&(A=n.length),I=n.window}else I=h,S=m-n.offset,A=n.length;for(yb?(_=C[N+l[A]],$[R+l[A]]):(_=96,0),f=1<>T)+(p-=f)]=w<<24|_<<16|v|0,0!==p;);for(f=1<>=1;if(0!==f?(L&=f-1,L+=f):L=0,A++,0==--O[M]){if(M===I)break;M=e[n+l[A]]}if(x>>7)]}function I(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function x(t,e,n){t.bi_valid>c-n?(t.bi_buf|=e<>c-t.bi_valid,t.bi_valid+=n-c):(t.bi_buf|=e<>>=1,n<<=1,0<--e;);return n>>>1}function P(t,e,n){var r,i,o=new Array(u+1),s=0;for(r=1;r<=u;r++)o[r]=s=s+n[r-1]<<1;for(i=0;i<=e;i++){var a=t[2*i+1];0!==a&&(t[2*i]=T(o[a]++,a))}}function B(t){var e;for(e=0;e>1;1<=n;n--)R(t,o,n);for(i=c;n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],R(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,R(t,o,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,s,a,c=e.dyn_tree,d=e.max_code,l=e.stat_desc.static_tree,h=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,m=e.stat_desc.max_length,g=0;for(o=0;o<=u;o++)t.bl_count[o]=0;for(c[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<573;n++)m<(o=c[2*c[2*(r=t.heap[n])+1]+1]+1)&&(o=m,g++),c[2*r+1]=o,d>=7;r>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e>>3,(s=t.static_len+3+7>>>3)<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==e?U(t,e,n,r):4===t.strategy||s===i?(x(t,2+(r?1:0),3),O(t,p,m)):(x(t,4+(r?1:0),3),function(t,e,n,r){var i;for(x(t,e-257,5),x(t,n-1,5),x(t,r-4,4),i=0;i>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(y[n]+o+1)]++,t.dyn_dtree[2*S(e)]++),t.last_lit===t.lit_bufsize-1},n._tr_align=function(t){x(t,2,3),E(t,256,p),function(t){16===t.bi_valid?(I(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":41}],53:[function(t,e,n){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,r){(function(t){!function(t,e){"use strict";if(!t.setImmediate){var n,r,o,s,a=1,u={},c=!1,d=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,n="[object process]"==={}.toString.call(t.process)?function(t){i.nextTick((function(){f(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?(s="setImmediate$"+Math.random()+"$",t.addEventListener?t.addEventListener("message",p,!1):t.attachEvent("onmessage",p),function(e){t.postMessage(s+e,"*")}):t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},function(t){o.port2.postMessage(t)}):d&&"onreadystatechange"in d.createElement("script")?(r=d.documentElement,function(t){var e=d.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):function(t){setTimeout(f,0,t)},l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r{"use strict";var r=n(35717),i=n(3349),o=n(89509).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function c(t,e,n,r,i,o,s){return u(t+(e&n|~e&r)+i+o|0,s)+e|0}function d(t,e,n,r,i,o,s){return u(t+(e&r|n&~r)+i+o|0,s)+e|0}function l(t,e,n,r,i,o,s){return u(t+(e^n^r)+i+o|0,s)+e|0}function h(t,e,n,r,i,o,s){return u(t+(n^(e|~r))+i+o|0,s)+e|0}r(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var n=this._a,r=this._b,i=this._c,o=this._d;n=c(n,r,i,o,t[0],3614090360,7),o=c(o,n,r,i,t[1],3905402710,12),i=c(i,o,n,r,t[2],606105819,17),r=c(r,i,o,n,t[3],3250441966,22),n=c(n,r,i,o,t[4],4118548399,7),o=c(o,n,r,i,t[5],1200080426,12),i=c(i,o,n,r,t[6],2821735955,17),r=c(r,i,o,n,t[7],4249261313,22),n=c(n,r,i,o,t[8],1770035416,7),o=c(o,n,r,i,t[9],2336552879,12),i=c(i,o,n,r,t[10],4294925233,17),r=c(r,i,o,n,t[11],2304563134,22),n=c(n,r,i,o,t[12],1804603682,7),o=c(o,n,r,i,t[13],4254626195,12),i=c(i,o,n,r,t[14],2792965006,17),n=d(n,r=c(r,i,o,n,t[15],1236535329,22),i,o,t[1],4129170786,5),o=d(o,n,r,i,t[6],3225465664,9),i=d(i,o,n,r,t[11],643717713,14),r=d(r,i,o,n,t[0],3921069994,20),n=d(n,r,i,o,t[5],3593408605,5),o=d(o,n,r,i,t[10],38016083,9),i=d(i,o,n,r,t[15],3634488961,14),r=d(r,i,o,n,t[4],3889429448,20),n=d(n,r,i,o,t[9],568446438,5),o=d(o,n,r,i,t[14],3275163606,9),i=d(i,o,n,r,t[3],4107603335,14),r=d(r,i,o,n,t[8],1163531501,20),n=d(n,r,i,o,t[13],2850285829,5),o=d(o,n,r,i,t[2],4243563512,9),i=d(i,o,n,r,t[7],1735328473,14),n=l(n,r=d(r,i,o,n,t[12],2368359562,20),i,o,t[5],4294588738,4),o=l(o,n,r,i,t[8],2272392833,11),i=l(i,o,n,r,t[11],1839030562,16),r=l(r,i,o,n,t[14],4259657740,23),n=l(n,r,i,o,t[1],2763975236,4),o=l(o,n,r,i,t[4],1272893353,11),i=l(i,o,n,r,t[7],4139469664,16),r=l(r,i,o,n,t[10],3200236656,23),n=l(n,r,i,o,t[13],681279174,4),o=l(o,n,r,i,t[0],3936430074,11),i=l(i,o,n,r,t[3],3572445317,16),r=l(r,i,o,n,t[6],76029189,23),n=l(n,r,i,o,t[9],3654602809,4),o=l(o,n,r,i,t[12],3873151461,11),i=l(i,o,n,r,t[15],530742520,16),n=h(n,r=l(r,i,o,n,t[2],3299628645,23),i,o,t[0],4096336452,6),o=h(o,n,r,i,t[7],1126891415,10),i=h(i,o,n,r,t[14],2878612391,15),r=h(r,i,o,n,t[5],4237533241,21),n=h(n,r,i,o,t[12],1700485571,6),o=h(o,n,r,i,t[3],2399980690,10),i=h(i,o,n,r,t[10],4293915773,15),r=h(r,i,o,n,t[1],2240044497,21),n=h(n,r,i,o,t[8],1873313359,6),o=h(o,n,r,i,t[15],4264355552,10),i=h(i,o,n,r,t[6],2734768916,15),r=h(r,i,o,n,t[13],1309151649,21),n=h(n,r,i,o,t[4],4149444226,6),o=h(o,n,r,i,t[11],3174756917,10),i=h(i,o,n,r,t[2],718787259,15),r=h(r,i,o,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){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 t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},63047:(t,e,n)=>{var r=n(96240),i=n(29931);function o(t){this.rand=t||new i.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var i=new r(this.rand.generate(n))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var n=e.sub(t);return t.add(this._randbelow(n))},o.prototype.test=function(t,e,n){var i=t.bitLength(),o=r.mont(t),s=new r(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var a=t.subn(1),u=0;!a.testn(u);u++);for(var c=t.shrn(u),d=a.toRed(o);e>0;e--){var l=this._randrange(new r(2),a);n&&n(l);var h=l.toRed(o).redPow(c);if(0!==h.cmp(s)&&0!==h.cmp(d)){for(var f=1;f0;e--){var d=this._randrange(new r(2),s),l=t.gcd(d);if(0!==l.cmpn(1))return l;var h=d.toRed(i).redPow(u);if(0!==h.cmp(o)&&0!==h.cmp(c)){for(var f=1;f=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},79746:t=>{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},34504:(t,e)=>{"use strict";var n=e;function r(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",n=0;n>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}},42786:function(t,e,n){!function(t){"use strict";t.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(t){return/^nm$/i.test(t)},meridiem:function(t,e,n){return t<12?n?"vm":"VM":n?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[Môre om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",ss:"%d sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},14130:function(t,e,n){!function(t){"use strict";var e=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},n={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},r=function(t){return function(r,i,o,s){var a=e(r),u=n[t][e(r)];return 2===a&&(u=u[i?0:1]),u.replace(/%d/i,r)}},i=["جانفي","فيفري","مارس","أفريل","ماي","جوان","جويلية","أوت","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];t.defineLocale("ar-dz",{months:i,monthsShort:i,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:r("s"),ss:r("s"),m:r("m"),mm:r("m"),h:r("h"),hh:r("h"),d:r("d"),dd:r("d"),M:r("M"),MM:r("M"),y:r("y"),yy:r("y")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:0,doy:4}})}(n(30381))},96135:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-kw",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:0,doy:12}})}(n(30381))},56440:function(t,e,n){!function(t){"use strict";var e={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},n=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},r={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},i=function(t){return function(e,i,o,s){var a=n(e),u=r[t][n(e)];return 2===a&&(u=u[i?0:1]),u.replace(/%d/i,e)}},o=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];t.defineLocale("ar-ly",{months:o,monthsShort:o,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:i("s"),ss:i("s"),m:i("m"),mm:i("m"),h:i("h"),hh:i("h"),d:i("d"),dd:i("d"),M:i("M"),MM:i("M"),y:i("y"),yy:i("y")},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n(30381))},47702:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n(30381))},20315:function(t,e,n){!function(t){"use strict";var e={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};t.defineLocale("ar-ps",{months:"كانون الثاني_شباط_آذار_نيسان_أيّار_حزيران_تمّوز_آب_أيلول_تشري الأوّل_تشرين الثاني_كانون الأوّل".split("_"),monthsShort:"ك٢_شباط_آذار_نيسان_أيّار_حزيران_تمّوز_آب_أيلول_ت١_ت٢_ك١".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(t){return t.replace(/[٣٤٥٦٧٨٩٠]/g,(function(t){return n[t]})).split("").reverse().join("").replace(/[١٢](?![\u062a\u0643])/g,(function(t){return n[t]})).split("").reverse().join("").replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:0,doy:6}})}(n(30381))},16040:function(t,e,n){!function(t){"use strict";var e={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};t.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(t){return t.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(t){return n[t]})).replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:0,doy:6}})}(n(30381))},37100:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-tn",{months:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n(30381))},30867:function(t,e,n){!function(t){"use strict";var e={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},r=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},i={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},o=function(t){return function(e,n,o,s){var a=r(e),u=i[t][r(e)];return 2===a&&(u=u[n?0:1]),u.replace(/%d/i,e)}},s=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];t.defineLocale("ar",{months:s,monthsShort:s,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(t){return"م"===t},meridiem:function(t,e,n){return t<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:o("s"),ss:o("s"),m:o("m"),mm:o("m"),h:o("h"),hh:o("h"),d:o("d"),dd:o("d"),M:o("M"),MM:o("M"),y:o("y"),yy:o("y")},preparse:function(t){return t.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(t){return n[t]})).replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n(30381))},31083:function(t,e,n){!function(t){"use strict";var e={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-üncü",4:"-üncü",100:"-üncü",6:"-ncı",9:"-uncu",10:"-uncu",30:"-uncu",60:"-ıncı",90:"-ıncı"};t.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),weekdaysShort:"Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),weekdaysMin:"Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[gələn həftə] dddd [saat] LT",lastDay:"[dünən] LT",lastWeek:"[keçən həftə] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s əvvəl",s:"bir neçə saniyə",ss:"%d saniyə",m:"bir dəqiqə",mm:"%d dəqiqə",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gecə|səhər|gündüz|axşam/,isPM:function(t){return/^(gündüz|axşam)$/.test(t)},meridiem:function(t,e,n){return t<4?"gecə":t<12?"səhər":t<17?"gündüz":"axşam"},dayOfMonthOrdinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(t){if(0===t)return t+"-ıncı";var n=t%10;return t+(e[n]||e[t%100-n]||e[t>=100?100:null])},week:{dow:1,doy:7}})}(n(30381))},9808:function(t,e,n){!function(t){"use strict";function e(t,e,n){return"m"===n?e?"хвіліна":"хвіліну":"h"===n?e?"гадзіна":"гадзіну":t+" "+(r=+t,i={ss:e?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:e?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:e?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"}[n].split("_"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2]);var r,i}t.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:e,mm:e,h:e,hh:e,d:"дзень",dd:e,M:"месяц",MM:e,y:"год",yy:e},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(t){return/^(дня|вечара)$/.test(t)},meridiem:function(t,e,n){return t<4?"ночы":t<12?"раніцы":t<17?"дня":"вечара"},dayOfMonthOrdinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":case"w":case"W":return t%10!=2&&t%10!=3||t%100==12||t%100==13?t+"-ы":t+"-і";case"D":return t+"-га";default:return t}},week:{dow:1,doy:7}})}(n(30381))},68338:function(t,e,n){!function(t){"use strict";t.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Миналата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[Миналия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",ss:"%d секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",w:"седмица",ww:"%d седмици",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(t){var e=t%10,n=t%100;return 0===t?t+"-ев":0===n?t+"-ен":n>10&&n<20?t+"-ти":1===e?t+"-ви":2===e?t+"-ри":7===e||8===e?t+"-ми":t+"-ти"},week:{dow:1,doy:7}})}(n(30381))},67438:function(t,e,n){!function(t){"use strict";t.defineLocale("bm",{months:"Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo".split("_"),monthsShort:"Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des".split("_"),weekdays:"Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri".split("_"),weekdaysShort:"Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib".split("_"),weekdaysMin:"Ka_Nt_Ta_Ar_Al_Ju_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"MMMM [tile] D [san] YYYY",LLL:"MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm",LLLL:"dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm"},calendar:{sameDay:"[Bi lɛrɛ] LT",nextDay:"[Sini lɛrɛ] LT",nextWeek:"dddd [don lɛrɛ] LT",lastDay:"[Kunu lɛrɛ] LT",lastWeek:"dddd [tɛmɛnen lɛrɛ] LT",sameElse:"L"},relativeTime:{future:"%s kɔnɔ",past:"a bɛ %s bɔ",s:"sanga dama dama",ss:"sekondi %d",m:"miniti kelen",mm:"miniti %d",h:"lɛrɛ kelen",hh:"lɛrɛ %d",d:"tile kelen",dd:"tile %d",M:"kalo kelen",MM:"kalo %d",y:"san kelen",yy:"san %d"},week:{dow:1,doy:4}})}(n(30381))},76225:function(t,e,n){!function(t){"use strict";var e={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};t.defineLocale("bn-bd",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(t){return t.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/রাত|ভোর|সকাল|দুপুর|বিকাল|সন্ধ্যা|রাত/,meridiemHour:function(t,e){return 12===t&&(t=0),"রাত"===e?t<4?t:t+12:"ভোর"===e||"সকাল"===e?t:"দুপুর"===e?t>=3?t:t+12:"বিকাল"===e||"সন্ধ্যা"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"রাত":t<6?"ভোর":t<12?"সকাল":t<15?"দুপুর":t<18?"বিকাল":t<20?"সন্ধ্যা":"রাত"},week:{dow:0,doy:6}})}(n(30381))},8905:function(t,e,n){!function(t){"use strict";var e={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};t.defineLocale("bn",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(t){return t.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(t,e){return 12===t&&(t=0),"রাত"===e&&t>=4||"দুপুর"===e&&t<5||"বিকাল"===e?t+12:t},meridiem:function(t,e,n){return t<4?"রাত":t<10?"সকাল":t<17?"দুপুর":t<20?"বিকাল":"রাত"},week:{dow:0,doy:6}})}(n(30381))},11560:function(t,e,n){!function(t){"use strict";var e={1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"},n={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"};t.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12".split("_"),monthsShortRegex:/^(ཟླ་\d{1,2})/,monthsParseExact:!0,weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",ss:"%d སྐར་ཆ།",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(t){return t.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(t,e){return 12===t&&(t=0),"མཚན་མོ"===e&&t>=4||"ཉིན་གུང"===e&&t<5||"དགོང་དག"===e?t+12:t},meridiem:function(t,e,n){return t<4?"མཚན་མོ":t<10?"ཞོགས་ཀས":t<17?"ཉིན་གུང":t<20?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}})}(n(30381))},1278:function(t,e,n){!function(t){"use strict";function e(t,e,n){return t+" "+function(t,e){return 2===e?function(t){var e={m:"v",b:"v",d:"z"};return void 0===e[t.charAt(0)]?t:e[t.charAt(0)]+t.substring(1)}(t):t}({mm:"munutenn",MM:"miz",dd:"devezh"}[n],t)}function n(t){return t>9?n(t%10):t}var r=[/^gen/i,/^c[ʼ\']hwe/i,/^meu/i,/^ebr/i,/^mae/i,/^(mez|eve)/i,/^gou/i,/^eos/i,/^gwe/i,/^her/i,/^du/i,/^ker/i],i=/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,o=[/^Su/i,/^Lu/i,/^Me([^r]|$)/i,/^Mer/i,/^Ya/i,/^Gw/i,/^Sa/i];t.defineLocale("br",{months:"Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParse:o,fullWeekdaysParse:[/^sul/i,/^lun/i,/^meurzh/i,/^merc[ʼ\']her/i,/^yaou/i,/^gwener/i,/^sadorn/i],shortWeekdaysParse:[/^Sul/i,/^Lun/i,/^Meu/i,/^Mer/i,/^Yao/i,/^Gwe/i,/^Sad/i],minWeekdaysParse:o,monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,monthsShortStrictRegex:/^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY HH:mm",LLLL:"dddd, D [a viz] MMMM YYYY HH:mm"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warcʼhoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Decʼh da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s ʼzo",s:"un nebeud segondennoù",ss:"%d eilenn",m:"ur vunutenn",mm:e,h:"un eur",hh:"%d eur",d:"un devezh",dd:e,M:"ur miz",MM:e,y:"ur bloaz",yy:function(t){switch(n(t)){case 1:case 3:case 4:case 5:case 9:return t+" bloaz";default:return t+" vloaz"}}},dayOfMonthOrdinalParse:/\d{1,2}(añ|vet)/,ordinal:function(t){return t+(1===t?"añ":"vet")},week:{dow:1,doy:4},meridiemParse:/a.m.|g.m./,isPM:function(t){return"g.m."===t},meridiem:function(t,e,n){return t<12?"a.m.":"g.m."}})}(n(30381))},80622:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=t+" ";switch(n){case"ss":return r+(1===t?"sekunda":2===t||3===t||4===t?"sekunde":"sekundi");case"mm":return r+(1===t?"minuta":2===t||3===t||4===t?"minute":"minuta");case"h":return"jedan sat";case"hh":return r+(1===t?"sat":2===t||3===t||4===t?"sata":"sati");case"dd":return r+(1===t?"dan":"dana");case"MM":return r+(1===t?"mjesec":2===t||3===t||4===t?"mjeseca":"mjeseci");case"yy":return r+(1===t?"godina":2===t||3===t||4===t?"godine":"godina")}}t.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:e,m:function(t,e,n,r){if("m"===n)return e?"jedna minuta":r?"jednu minutu":"jedne minute"},mm:e,h:e,hh:e,d:"dan",dd:e,M:"mjesec",MM:e,y:"godinu",yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},2468:function(t,e,n){!function(t){"use strict";t.defineLocale("ca",{months:{standalone:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),format:"de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dt_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a les] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a les] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"uns segons",ss:"%d segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(t,e){var n=1===t?"r":2===t?"n":3===t?"r":4===t?"t":"è";return"w"!==e&&"W"!==e||(n="a"),t+n},week:{dow:1,doy:4}})}(n(30381))},5822:function(t,e,n){!function(t){"use strict";var e={standalone:"leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),format:"ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince".split("_"),isFormat:/DD?[o.]?(\[[^\[\]]*\]|\s)+MMMM/},n="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),r=[/^led/i,/^úno/i,/^bře/i,/^dub/i,/^kvě/i,/^(čvn|červen$|června)/i,/^(čvc|červenec|července)/i,/^srp/i,/^zář/i,/^říj/i,/^lis/i,/^pro/i],i=/^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;function o(t){return t>1&&t<5&&1!=~~(t/10)}function s(t,e,n,r){var i=t+" ";switch(n){case"s":return e||r?"pár sekund":"pár sekundami";case"ss":return e||r?i+(o(t)?"sekundy":"sekund"):i+"sekundami";case"m":return e?"minuta":r?"minutu":"minutou";case"mm":return e||r?i+(o(t)?"minuty":"minut"):i+"minutami";case"h":return e?"hodina":r?"hodinu":"hodinou";case"hh":return e||r?i+(o(t)?"hodiny":"hodin"):i+"hodinami";case"d":return e||r?"den":"dnem";case"dd":return e||r?i+(o(t)?"dny":"dní"):i+"dny";case"M":return e||r?"měsíc":"měsícem";case"MM":return e||r?i+(o(t)?"měsíce":"měsíců"):i+"měsíci";case"y":return e||r?"rok":"rokem";case"yy":return e||r?i+(o(t)?"roky":"let"):i+"lety"}}t.defineLocale("cs",{months:e,monthsShort:n,monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s,ss:s,m:s,mm:s,h:s,hh:s,d:s,dd:s,M:s,MM:s,y:s,yy:s},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},50877:function(t,e,n){!function(t){"use strict";t.defineLocale("cv",{months:"кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),monthsShort:"кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кҫ_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",LLL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",LLLL:"dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ӗнер] LT [сехетре]",nextWeek:"[Ҫитес] dddd LT [сехетре]",lastWeek:"[Иртнӗ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(t){return t+(/сехет$/i.exec(t)?"рен":/ҫул$/i.exec(t)?"тан":"ран")},past:"%s каялла",s:"пӗр-ик ҫеккунт",ss:"%d ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},dayOfMonthOrdinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}})}(n(30381))},47373:function(t,e,n){!function(t){"use strict";t.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",ss:"%d eiliad",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},dayOfMonthOrdinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(t){var e="";return t>20?e=40===t||50===t||60===t||80===t||100===t?"fed":"ain":t>0&&(e=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"][t]),t+e},week:{dow:1,doy:4}})}(n(30381))},24780:function(t,e,n){!function(t){"use strict";t.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"på dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[i] dddd[s kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",ss:"%d sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},60217:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},60894:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de-ch",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},59740:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},5300:function(t,e,n){!function(t){"use strict";var e=["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"],n=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"];t.defineLocale("dv",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:"އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/މކ|މފ/,isPM:function(t){return"މފ"===t},meridiem:function(t,e,n){return t<12?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] LT",lastWeek:"[ފާއިތުވި] dddd LT",sameElse:"L"},relativeTime:{future:"ތެރޭގައި %s",past:"ކުރިން %s",s:"ސިކުންތުކޮޅެއް",ss:"d% ސިކުންތު",m:"މިނިޓެއް",mm:"މިނިޓު %d",h:"ގަޑިއިރެއް",hh:"ގަޑިއިރު %d",d:"ދުވަހެއް",dd:"ދުވަސް %d",M:"މަހެއް",MM:"މަސް %d",y:"އަހަރެއް",yy:"އަހަރު %d"},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:7,doy:12}})}(n(30381))},50837:function(t,e,n){!function(t){"use strict";t.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(t,e){return t?"string"==typeof e&&/D/.test(e.substring(0,e.indexOf("MMMM")))?this._monthsGenitiveEl[t.month()]:this._monthsNominativeEl[t.month()]:this._monthsNominativeEl},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(t,e,n){return t>11?n?"μμ":"ΜΜ":n?"πμ":"ΠΜ"},isPM:function(t){return"μ"===(t+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){return 6===this.day()?"[το προηγούμενο] dddd [{}] LT":"[την προηγούμενη] dddd [{}] LT"},sameElse:"L"},calendar:function(t,e){var n,r=this._calendarEl[t],i=e&&e.hours();return n=r,("undefined"!=typeof Function&&n instanceof Function||"[object Function]"===Object.prototype.toString.call(n))&&(r=r.apply(e)),r.replace("{}",i%12==1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",ss:"%d δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},dayOfMonthOrdinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}})}(n(30381))},78348:function(t,e,n){!function(t){"use strict";t.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:0,doy:4}})}(n(30381))},77925:function(t,e,n){!function(t){"use strict";t.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}})}(n(30381))},22243:function(t,e,n){!function(t){"use strict";t.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},46436:function(t,e,n){!function(t){"use strict";t.defineLocale("en-ie",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},47207:function(t,e,n){!function(t){"use strict";t.defineLocale("en-il",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}})}(n(30381))},44175:function(t,e,n){!function(t){"use strict";t.defineLocale("en-in",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:0,doy:6}})}(n(30381))},76319:function(t,e,n){!function(t){"use strict";t.defineLocale("en-nz",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},31662:function(t,e,n){!function(t){"use strict";t.defineLocale("en-sg",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},92915:function(t,e,n){!function(t){"use strict";t.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec".split("_"),weekdays:"dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato".split("_"),weekdaysShort:"dim_lun_mard_merk_ĵaŭ_ven_sab".split("_"),weekdaysMin:"di_lu_ma_me_ĵa_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"[la] D[-an de] MMMM, YYYY",LLL:"[la] D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd[n], [la] D[-an de] MMMM, YYYY HH:mm",llll:"ddd, [la] D[-an de] MMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(t){return"p"===t.charAt(0).toLowerCase()},meridiem:function(t,e,n){return t>11?n?"p.t.m.":"P.T.M.":n?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd[n je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasintan] dddd[n je] LT",sameElse:"L"},relativeTime:{future:"post %s",past:"antaŭ %s",s:"kelkaj sekundoj",ss:"%d sekundoj",m:"unu minuto",mm:"%d minutoj",h:"unu horo",hh:"%d horoj",d:"unu tago",dd:"%d tagoj",M:"unu monato",MM:"%d monatoj",y:"unu jaro",yy:"%d jaroj"},dayOfMonthOrdinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}})}(n(30381))},55251:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-do",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},96112:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-mx",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:4},invalidDate:"Fecha inválida"})}(n(30381))},71146:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-us",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"MM/DD/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:6}})}(n(30381))},55655:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4},invalidDate:"Fecha inválida"})}(n(30381))},5603:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["mõne sekundi","mõni sekund","paar sekundit"],ss:[t+"sekundi",t+"sekundit"],m:["ühe minuti","üks minut"],mm:[t+" minuti",t+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[t+" tunni",t+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[t+" kuu",t+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[t+" aasta",t+" aastat"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}t.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:"%d päeva",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},77763:function(t,e,n){!function(t){"use strict";t.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",ss:"%d segundo",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},76959:function(t,e,n){!function(t){"use strict";var e={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},n={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};t.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(t){return/بعد از ظهر/.test(t)},meridiem:function(t,e,n){return t<12?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",ss:"%d ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(t){return t.replace(/[۰-۹]/g,(function(t){return n[t]})).replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},dayOfMonthOrdinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}})}(n(30381))},11897:function(t,e,n){!function(t){"use strict";var e="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),n=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",e[7],e[8],e[9]];function r(t,r,i,o){var s="";switch(i){case"s":return o?"muutaman sekunnin":"muutama sekunti";case"ss":s=o?"sekunnin":"sekuntia";break;case"m":return o?"minuutin":"minuutti";case"mm":s=o?"minuutin":"minuuttia";break;case"h":return o?"tunnin":"tunti";case"hh":s=o?"tunnin":"tuntia";break;case"d":return o?"päivän":"päivä";case"dd":s=o?"päivän":"päivää";break;case"M":return o?"kuukauden":"kuukausi";case"MM":s=o?"kuukauden":"kuukautta";break;case"y":return o?"vuoden":"vuosi";case"yy":s=o?"vuoden":"vuotta"}return function(t,r){return t<10?r?n[t]:e[t]:t}(t,o)+" "+s}t.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},42549:function(t,e,n){!function(t){"use strict";t.defineLocale("fil",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},94694:function(t,e,n){!function(t){"use strict";t.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",ss:"%d sekundir",m:"ein minuttur",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaður",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},63049:function(t,e,n){!function(t){"use strict";t.defineLocale("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(t,e){switch(e){default:case"M":case"Q":case"D":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}}})}(n(30381))},52330:function(t,e,n){!function(t){"use strict";t.defineLocale("fr-ch",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(t,e){switch(e){default:case"M":case"Q":case"D":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}},week:{dow:1,doy:4}})}(n(30381))},94470:function(t,e,n){!function(t){"use strict";var e=/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,n=[/^janv/i,/^févr/i,/^mars/i,/^avr/i,/^mai/i,/^juin/i,/^juil/i,/^août/i,/^sept/i,/^oct/i,/^nov/i,/^déc/i];t.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsRegex:e,monthsShortRegex:e,monthsStrictRegex:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,monthsShortStrictRegex:/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",w:"une semaine",ww:"%d semaines",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|)/,ordinal:function(t,e){switch(e){case"D":return t+(1===t?"er":"");default:case"M":case"Q":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}},week:{dow:1,doy:4}})}(n(30381))},5044:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_"),n="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_");t.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsParseExact:!0,weekdays:"snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),weekdaysShort:"si._mo._ti._wo._to._fr._so.".split("_"),weekdaysMin:"Si_Mo_Ti_Wo_To_Fr_So".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[hjoed om] LT",nextDay:"[moarn om] LT",nextWeek:"dddd [om] LT",lastDay:"[juster om] LT",lastWeek:"[ôfrûne] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oer %s",past:"%s lyn",s:"in pear sekonden",ss:"%d sekonden",m:"ien minút",mm:"%d minuten",h:"ien oere",hh:"%d oeren",d:"ien dei",dd:"%d dagen",M:"ien moanne",MM:"%d moannen",y:"ien jier",yy:"%d jierren"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},29295:function(t,e,n){!function(t){"use strict";t.defineLocale("ga",{months:["Eanáir","Feabhra","Márta","Aibreán","Bealtaine","Meitheamh","Iúil","Lúnasa","Meán Fómhair","Deireadh Fómhair","Samhain","Nollaig"],monthsShort:["Ean","Feabh","Márt","Aib","Beal","Meith","Iúil","Lún","M.F.","D.F.","Samh","Noll"],monthsParseExact:!0,weekdays:["Dé Domhnaigh","Dé Luain","Dé Máirt","Dé Céadaoin","Déardaoin","Dé hAoine","Dé Sathairn"],weekdaysShort:["Domh","Luan","Máirt","Céad","Déar","Aoine","Sath"],weekdaysMin:["Do","Lu","Má","Cé","Dé","A","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Inniu ag] LT",nextDay:"[Amárach ag] LT",nextWeek:"dddd [ag] LT",lastDay:"[Inné ag] LT",lastWeek:"dddd [seo caite] [ag] LT",sameElse:"L"},relativeTime:{future:"i %s",past:"%s ó shin",s:"cúpla soicind",ss:"%d soicind",m:"nóiméad",mm:"%d nóiméad",h:"uair an chloig",hh:"%d uair an chloig",d:"lá",dd:"%d lá",M:"mí",MM:"%d míonna",y:"bliain",yy:"%d bliain"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(t){return t+(1===t?"d":t%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n(30381))},2101:function(t,e,n){!function(t){"use strict";t.defineLocale("gd",{months:["Am Faoilleach","An Gearran","Am Màrt","An Giblean","An Cèitean","An t-Ògmhios","An t-Iuchar","An Lùnastal","An t-Sultain","An Dàmhair","An t-Samhain","An Dùbhlachd"],monthsShort:["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],monthsParseExact:!0,weekdays:["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],weekdaysShort:["Did","Dil","Dim","Dic","Dia","Dih","Dis"],weekdaysMin:["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-màireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-dè aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",ss:"%d diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"mìos",MM:"%d mìosan",y:"bliadhna",yy:"%d bliadhna"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(t){return t+(1===t?"d":t%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n(30381))},38794:function(t,e,n){!function(t){"use strict";t.defineLocale("gl",{months:"xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro".split("_"),monthsShort:"xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"domingo_luns_martes_mércores_xoves_venres_sábado".split("_"),weekdaysShort:"dom._lun._mar._mér._xov._ven._sáb.".split("_"),weekdaysMin:"do_lu_ma_mé_xo_ve_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(t){return 0===t.indexOf("un")?"n"+t:"en "+t},past:"hai %s",s:"uns segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},27884:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["थोडया सॅकंडांनी","थोडे सॅकंड"],ss:[t+" सॅकंडांनी",t+" सॅकंड"],m:["एका मिणटान","एक मिनूट"],mm:[t+" मिणटांनी",t+" मिणटां"],h:["एका वरान","एक वर"],hh:[t+" वरांनी",t+" वरां"],d:["एका दिसान","एक दीस"],dd:[t+" दिसांनी",t+" दीस"],M:["एका म्हयन्यान","एक म्हयनो"],MM:[t+" म्हयन्यानी",t+" म्हयने"],y:["एका वर्सान","एक वर्स"],yy:[t+" वर्सांनी",t+" वर्सां"]};return r?i[n][0]:i[n][1]}t.defineLocale("gom-deva",{months:{standalone:"जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),format:"जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार".split("_"),weekdaysShort:"आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.".split("_"),weekdaysMin:"आ_सो_मं_बु_ब्रे_सु_शे".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [वाजतां]",LTS:"A h:mm:ss [वाजतां]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [वाजतां]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [वाजतां]",llll:"ddd, D MMM YYYY, A h:mm [वाजतां]"},calendar:{sameDay:"[आयज] LT",nextDay:"[फाल्यां] LT",nextWeek:"[फुडलो] dddd[,] LT",lastDay:"[काल] LT",lastWeek:"[फाटलो] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s आदीं",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}(वेर)/,ordinal:function(t,e){return"D"===e?t+"वेर":t},week:{dow:0,doy:3},meridiemParse:/राती|सकाळीं|दनपारां|सांजे/,meridiemHour:function(t,e){return 12===t&&(t=0),"राती"===e?t<4?t:t+12:"सकाळीं"===e?t:"दनपारां"===e?t>12?t:t+12:"सांजे"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"राती":t<12?"सकाळीं":t<16?"दनपारां":t<20?"सांजे":"राती"}})}(n(30381))},23168:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["thoddea sekondamni","thodde sekond"],ss:[t+" sekondamni",t+" sekond"],m:["eka mintan","ek minut"],mm:[t+" mintamni",t+" mintam"],h:["eka voran","ek vor"],hh:[t+" voramni",t+" voram"],d:["eka disan","ek dis"],dd:[t+" disamni",t+" dis"],M:["eka mhoinean","ek mhoino"],MM:[t+" mhoineamni",t+" mhoine"],y:["eka vorsan","ek voros"],yy:[t+" vorsamni",t+" vorsam"]};return r?i[n][0]:i[n][1]}t.defineLocale("gom-latn",{months:{standalone:"Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr".split("_"),format:"Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split("_"),weekdaysShort:"Ait._Som._Mon._Bud._Bre._Suk._Son.".split("_"),weekdaysMin:"Ai_Sm_Mo_Bu_Br_Su_Sn".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [vazta]",LTS:"A h:mm:ss [vazta]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [vazta]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [vazta]",llll:"ddd, D MMM YYYY, A h:mm [vazta]"},calendar:{sameDay:"[Aiz] LT",nextDay:"[Faleam] LT",nextWeek:"[Fuddlo] dddd[,] LT",lastDay:"[Kal] LT",lastWeek:"[Fattlo] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s adim",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}(er)/,ordinal:function(t,e){return"D"===e?t+"er":t},week:{dow:0,doy:3},meridiemParse:/rati|sokallim|donparam|sanje/,meridiemHour:function(t,e){return 12===t&&(t=0),"rati"===e?t<4?t:t+12:"sokallim"===e?t:"donparam"===e?t>12?t:t+12:"sanje"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"rati":t<12?"sokallim":t<16?"donparam":t<20?"sanje":"rati"}})}(n(30381))},95349:function(t,e,n){!function(t){"use strict";var e={1:"૧",2:"૨",3:"૩",4:"૪",5:"૫",6:"૬",7:"૭",8:"૮",9:"૯",0:"૦"},n={"૧":"1","૨":"2","૩":"3","૪":"4","૫":"5","૬":"6","૭":"7","૮":"8","૯":"9","૦":"0"};t.defineLocale("gu",{months:"જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર".split("_"),monthsShort:"જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.".split("_"),monthsParseExact:!0,weekdays:"રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર".split("_"),weekdaysShort:"રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ".split("_"),weekdaysMin:"ર_સો_મં_બુ_ગુ_શુ_શ".split("_"),longDateFormat:{LT:"A h:mm વાગ્યે",LTS:"A h:mm:ss વાગ્યે",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm વાગ્યે",LLLL:"dddd, D MMMM YYYY, A h:mm વાગ્યે"},calendar:{sameDay:"[આજ] LT",nextDay:"[કાલે] LT",nextWeek:"dddd, LT",lastDay:"[ગઇકાલે] LT",lastWeek:"[પાછલા] dddd, LT",sameElse:"L"},relativeTime:{future:"%s મા",past:"%s પહેલા",s:"અમુક પળો",ss:"%d સેકંડ",m:"એક મિનિટ",mm:"%d મિનિટ",h:"એક કલાક",hh:"%d કલાક",d:"એક દિવસ",dd:"%d દિવસ",M:"એક મહિનો",MM:"%d મહિનો",y:"એક વર્ષ",yy:"%d વર્ષ"},preparse:function(t){return t.replace(/[૧૨૩૪૫૬૭૮૯૦]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/રાત|બપોર|સવાર|સાંજ/,meridiemHour:function(t,e){return 12===t&&(t=0),"રાત"===e?t<4?t:t+12:"સવાર"===e?t:"બપોર"===e?t>=10?t:t+12:"સાંજ"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"રાત":t<10?"સવાર":t<17?"બપોર":t<20?"સાંજ":"રાત"},week:{dow:0,doy:6}})}(n(30381))},24206:function(t,e,n){!function(t){"use strict";t.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",ss:"%d שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(t){return 2===t?"שעתיים":t+" שעות"},d:"יום",dd:function(t){return 2===t?"יומיים":t+" ימים"},M:"חודש",MM:function(t){return 2===t?"חודשיים":t+" חודשים"},y:"שנה",yy:function(t){return 2===t?"שנתיים":t%10==0&&10!==t?t+" שנה":t+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(t){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(t)},meridiem:function(t,e,n){return t<5?"לפנות בוקר":t<10?"בבוקר":t<12?n?'לפנה"צ':"לפני הצהריים":t<18?n?'אחה"צ':"אחרי הצהריים":"בערב"}})}(n(30381))},30094:function(t,e,n){!function(t){"use strict";var e={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},r=[/^जन/i,/^फ़र|फर/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सितं|सित/i,/^अक्टू/i,/^नव|नवं/i,/^दिसं|दिस/i];t.defineLocale("hi",{months:{format:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),standalone:"जनवरी_फरवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितंबर_अक्टूबर_नवंबर_दिसंबर".split("_")},monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",LTS:"A h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm बजे",LLLL:"dddd, D MMMM YYYY, A h:mm बजे"},monthsParse:r,longMonthsParse:r,shortMonthsParse:[/^जन/i,/^फ़र/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सित/i,/^अक्टू/i,/^नव/i,/^दिस/i],monthsRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsShortRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsStrictRegex:/^(जनवरी?|फ़रवरी|फरवरी?|मार्च?|अप्रैल?|मई?|जून?|जुलाई?|अगस्त?|सितम्बर|सितंबर|सित?\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर?|दिसम्बर|दिसंबर?)/i,monthsShortStrictRegex:/^(जन\.?|फ़र\.?|मार्च?|अप्रै\.?|मई?|जून?|जुल\.?|अग\.?|सित\.?|अक्टू\.?|नव\.?|दिस\.?)/i,calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",ss:"%d सेकंड",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(t){return t.replace(/[१२३४५६७८९०]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(t,e){return 12===t&&(t=0),"रात"===e?t<4?t:t+12:"सुबह"===e?t:"दोपहर"===e?t>=10?t:t+12:"शाम"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"रात":t<10?"सुबह":t<17?"दोपहर":t<20?"शाम":"रात"},week:{dow:0,doy:6}})}(n(30381))},30316:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=t+" ";switch(n){case"ss":return r+(1===t?"sekunda":2===t||3===t||4===t?"sekunde":"sekundi");case"m":return e?"jedna minuta":"jedne minute";case"mm":return r+(1===t?"minuta":2===t||3===t||4===t?"minute":"minuta");case"h":return e?"jedan sat":"jednog sata";case"hh":return r+(1===t?"sat":2===t||3===t||4===t?"sata":"sati");case"dd":return r+(1===t?"dan":"dana");case"MM":return r+(1===t?"mjesec":2===t||3===t||4===t?"mjeseca":"mjeseci");case"yy":return r+(1===t?"godina":2===t||3===t||4===t?"godine":"godina")}}t.defineLocale("hr",{months:{format:"siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),standalone:"siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")},monthsShort:"sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"Do MMMM YYYY",LLL:"Do MMMM YYYY H:mm",LLLL:"dddd, Do MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:return"[prošlu] [nedjelju] [u] LT";case 3:return"[prošlu] [srijedu] [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:e,m:e,mm:e,h:e,hh:e,d:"dan",dd:e,M:"mjesec",MM:e,y:"godinu",yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},22138:function(t,e,n){!function(t){"use strict";var e="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");function n(t,e,n,r){var i=t;switch(n){case"s":return r||e?"néhány másodperc":"néhány másodperce";case"ss":return i+(r||e)?" másodperc":" másodperce";case"m":return"egy"+(r||e?" perc":" perce");case"mm":return i+(r||e?" perc":" perce");case"h":return"egy"+(r||e?" óra":" órája");case"hh":return i+(r||e?" óra":" órája");case"d":return"egy"+(r||e?" nap":" napja");case"dd":return i+(r||e?" nap":" napja");case"M":return"egy"+(r||e?" hónap":" hónapja");case"MM":return i+(r||e?" hónap":" hónapja");case"y":return"egy"+(r||e?" év":" éve");case"yy":return i+(r||e?" év":" éve")}return""}function r(t){return(t?"":"[múlt] ")+"["+e[this.day()]+"] LT[-kor]"}t.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(t){return"u"===t.charAt(1).toLowerCase()},meridiem:function(t,e,n){return t<12?!0===n?"de":"DE":!0===n?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return r.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return r.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:n,ss:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},11423:function(t,e,n){!function(t){"use strict";t.defineLocale("hy-am",{months:{format:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_"),standalone:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_")},monthsShort:"հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_"),weekdays:"կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_"),weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., HH:mm",LLLL:"dddd, D MMMM YYYY թ., HH:mm"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",ss:"%d վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(t){return/^(ցերեկվա|երեկոյան)$/.test(t)},meridiem:function(t){return t<4?"գիշերվա":t<12?"առավոտվա":t<17?"ցերեկվա":"երեկոյան"},dayOfMonthOrdinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(t,e){switch(e){case"DDD":case"w":case"W":case"DDDo":return 1===t?t+"-ին":t+"-րդ";default:return t}},week:{dow:1,doy:7}})}(n(30381))},29218:function(t,e,n){!function(t){"use strict";t.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"siang"===e?t>=11?t:t+12:"sore"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"siang":t<19?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",ss:"%d detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:0,doy:6}})}(n(30381))},90135:function(t,e,n){!function(t){"use strict";function e(t){return t%100==11||t%10!=1}function n(t,n,r,i){var o=t+" ";switch(r){case"s":return n||i?"nokkrar sekúndur":"nokkrum sekúndum";case"ss":return e(t)?o+(n||i?"sekúndur":"sekúndum"):o+"sekúnda";case"m":return n?"mínúta":"mínútu";case"mm":return e(t)?o+(n||i?"mínútur":"mínútum"):n?o+"mínúta":o+"mínútu";case"hh":return e(t)?o+(n||i?"klukkustundir":"klukkustundum"):o+"klukkustund";case"d":return n?"dagur":i?"dag":"degi";case"dd":return e(t)?n?o+"dagar":o+(i?"daga":"dögum"):n?o+"dagur":o+(i?"dag":"degi");case"M":return n?"mánuður":i?"mánuð":"mánuði";case"MM":return e(t)?n?o+"mánuðir":o+(i?"mánuði":"mánuðum"):n?o+"mánuður":o+(i?"mánuð":"mánuði");case"y":return n||i?"ár":"ári";case"yy":return e(t)?o+(n||i?"ár":"árum"):o+(n||i?"ár":"ári")}}t.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:n,ss:n,m:n,mm:n,h:"klukkustund",hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},10150:function(t,e,n){!function(t){"use strict";t.defineLocale("it-ch",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){return 0===this.day()?"[la scorsa] dddd [alle] LT":"[lo scorso] dddd [alle] LT"},sameElse:"L"},relativeTime:{future:function(t){return(/^[0-9].+$/.test(t)?"tra":"in")+" "+t},past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},90626:function(t,e,n){!function(t){"use strict";t.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:function(){return"[Oggi a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextDay:function(){return"[Domani a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextWeek:function(){return"dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastDay:function(){return"[Ieri a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastWeek:function(){return 0===this.day()?"[La scorsa] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT":"[Lo scorso] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},sameElse:"L"},relativeTime:{future:"tra %s",past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",w:"una settimana",ww:"%d settimane",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},39183:function(t,e,n){!function(t){"use strict";t.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"令和",narrow:"㋿",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"平成",narrow:"㍻",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"昭和",narrow:"㍼",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"大正",narrow:"㍽",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"明治",narrow:"㍾",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"西暦",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"紀元前",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(元|\d+)年/,eraYearOrdinalParse:function(t,e){return"元"===e[1]?1:parseInt(e[1]||t,10)},months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日(ddd) HH:mm"},meridiemParse:/午前|午後/i,isPM:function(t){return"午後"===t},meridiem:function(t,e,n){return t<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:function(t){return t.week()!==this.week()?"[来週]dddd LT":"dddd LT"},lastDay:"[昨日] LT",lastWeek:function(t){return this.week()!==t.week()?"[先週]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}日/,ordinal:function(t,e){switch(e){case"y":return 1===t?"元年":t+"年";case"d":case"D":case"DDD":return t+"日";default:return t}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",ss:"%d秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}(n(30381))},24286:function(t,e,n){!function(t){"use strict";t.defineLocale("jv",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),weekdays:"Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),weekdaysShort:"Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/enjing|siyang|sonten|ndalu/,meridiemHour:function(t,e){return 12===t&&(t=0),"enjing"===e?t:"siyang"===e?t>=11?t:t+12:"sonten"===e||"ndalu"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"enjing":t<15?"siyang":t<19?"sonten":"ndalu"},calendar:{sameDay:"[Dinten puniko pukul] LT",nextDay:"[Mbenjang pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kala wingi pukul] LT",lastWeek:"dddd [kepengker pukul] LT",sameElse:"L"},relativeTime:{future:"wonten ing %s",past:"%s ingkang kepengker",s:"sawetawis detik",ss:"%d detik",m:"setunggal menit",mm:"%d menit",h:"setunggal jam",hh:"%d jam",d:"sedinten",dd:"%d dinten",M:"sewulan",MM:"%d wulan",y:"setaun",yy:"%d taun"},week:{dow:1,doy:7}})}(n(30381))},12105:function(t,e,n){!function(t){"use strict";t.defineLocale("ka",{months:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:{standalone:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),format:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),isFormat:/(წინა|შემდეგ)/},weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(t){return t.replace(/(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,(function(t,e,n){return"ი"===n?e+"ში":e+n+"ში"}))},past:function(t){return/(წამი|წუთი|საათი|დღე|თვე)/.test(t)?t.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(t)?t.replace(/წელი$/,"წლის წინ"):t},s:"რამდენიმე წამი",ss:"%d წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},dayOfMonthOrdinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(t){return 0===t?t:1===t?t+"-ლი":t<20||t<=100&&t%20==0||t%100==0?"მე-"+t:t+"-ე"},week:{dow:1,doy:7}})}(n(30381))},47772:function(t,e,n){!function(t){"use strict";var e={0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"};t.defineLocale("kk",{months:"қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан".split("_"),monthsShort:"қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел".split("_"),weekdays:"жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі".split("_"),weekdaysShort:"жек_дүй_сей_сәр_бей_жұм_сен".split("_"),weekdaysMin:"жк_дй_сй_ср_бй_жм_сн".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгін сағат] LT",nextDay:"[Ертең сағат] LT",nextWeek:"dddd [сағат] LT",lastDay:"[Кеше сағат] LT",lastWeek:"[Өткен аптаның] dddd [сағат] LT",sameElse:"L"},relativeTime:{future:"%s ішінде",past:"%s бұрын",s:"бірнеше секунд",ss:"%d секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(t){return t+(e[t]||e[t%10]||e[t>=100?100:null])},week:{dow:1,doy:7}})}(n(30381))},18758:function(t,e,n){!function(t){"use strict";var e={1:"១",2:"២",3:"៣",4:"៤",5:"៥",6:"៦",7:"៧",8:"៨",9:"៩",0:"០"},n={"១":"1","២":"2","៣":"3","៤":"4","៥":"5","៦":"6","៧":"7","៨":"8","៩":"9","០":"0"};t.defineLocale("km",{months:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysMin:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ព្រឹក|ល្ងាច/,isPM:function(t){return"ល្ងាច"===t},meridiem:function(t,e,n){return t<12?"ព្រឹក":"ល្ងាច"},calendar:{sameDay:"[ថ្ងៃនេះ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",ss:"%d វិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},dayOfMonthOrdinalParse:/ទី\d{1,2}/,ordinal:"ទី%d",preparse:function(t){return t.replace(/[១២៣៤៥៦៧៨៩០]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},week:{dow:1,doy:4}})}(n(30381))},79282:function(t,e,n){!function(t){"use strict";var e={1:"೧",2:"೨",3:"೩",4:"೪",5:"೫",6:"೬",7:"೭",8:"೮",9:"೯",0:"೦"},n={"೧":"1","೨":"2","೩":"3","೪":"4","೫":"5","೬":"6","೭":"7","೮":"8","೯":"9","೦":"0"};t.defineLocale("kn",{months:"ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್".split("_"),monthsShort:"ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ".split("_"),monthsParseExact:!0,weekdays:"ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ".split("_"),weekdaysShort:"ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ".split("_"),weekdaysMin:"ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[ಇಂದು] LT",nextDay:"[ನಾಳೆ] LT",nextWeek:"dddd, LT",lastDay:"[ನಿನ್ನೆ] LT",lastWeek:"[ಕೊನೆಯ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ನಂತರ",past:"%s ಹಿಂದೆ",s:"ಕೆಲವು ಕ್ಷಣಗಳು",ss:"%d ಸೆಕೆಂಡುಗಳು",m:"ಒಂದು ನಿಮಿಷ",mm:"%d ನಿಮಿಷ",h:"ಒಂದು ಗಂಟೆ",hh:"%d ಗಂಟೆ",d:"ಒಂದು ದಿನ",dd:"%d ದಿನ",M:"ಒಂದು ತಿಂಗಳು",MM:"%d ತಿಂಗಳು",y:"ಒಂದು ವರ್ಷ",yy:"%d ವರ್ಷ"},preparse:function(t){return t.replace(/[೧೨೩೪೫೬೭೮೯೦]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,meridiemHour:function(t,e){return 12===t&&(t=0),"ರಾತ್ರಿ"===e?t<4?t:t+12:"ಬೆಳಿಗ್ಗೆ"===e?t:"ಮಧ್ಯಾಹ್ನ"===e?t>=10?t:t+12:"ಸಂಜೆ"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"ರಾತ್ರಿ":t<10?"ಬೆಳಿಗ್ಗೆ":t<17?"ಮಧ್ಯಾಹ್ನ":t<20?"ಸಂಜೆ":"ರಾತ್ರಿ"},dayOfMonthOrdinalParse:/\d{1,2}(ನೇ)/,ordinal:function(t){return t+"ನೇ"},week:{dow:0,doy:6}})}(n(30381))},33730:function(t,e,n){!function(t){"use strict";t.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h:mm",LLLL:"YYYY년 MMMM D일 dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY년 MMMM D일",lll:"YYYY년 MMMM D일 A h:mm",llll:"YYYY년 MMMM D일 dddd A h:mm"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"1분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},dayOfMonthOrdinalParse:/\d{1,2}(일|월|주)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"일";case"M":return t+"월";case"w":case"W":return t+"주";default:return t}},meridiemParse:/오전|오후/,isPM:function(t){return"오후"===t},meridiem:function(t,e,n){return t<12?"오전":"오후"}})}(n(30381))},90563:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["çend sanîye","çend sanîyeyan"],ss:[t+" sanîye",t+" sanîyeyan"],m:["deqîqeyek","deqîqeyekê"],mm:[t+" deqîqe",t+" deqîqeyan"],h:["saetek","saetekê"],hh:[t+" saet",t+" saetan"],d:["rojek","rojekê"],dd:[t+" roj",t+" rojan"],w:["hefteyek","hefteyekê"],ww:[t+" hefte",t+" hefteyan"],M:["mehek","mehekê"],MM:[t+" meh",t+" mehan"],y:["salek","salekê"],yy:[t+" sal",t+" salan"]};return e?i[n][0]:i[n][1]}t.defineLocale("ku-kmr",{months:"Rêbendan_Sibat_Adar_Nîsan_Gulan_Hezîran_Tîrmeh_Tebax_Îlon_Cotmeh_Mijdar_Berfanbar".split("_"),monthsShort:"Rêb_Sib_Ada_Nîs_Gul_Hez_Tîr_Teb_Îlo_Cot_Mij_Ber".split("_"),monthsParseExact:!0,weekdays:"Yekşem_Duşem_Sêşem_Çarşem_Pêncşem_În_Şemî".split("_"),weekdaysShort:"Yek_Du_Sê_Çar_Pên_În_Şem".split("_"),weekdaysMin:"Ye_Du_Sê_Ça_Pê_În_Şe".split("_"),meridiem:function(t,e,n){return t<12?n?"bn":"BN":n?"pn":"PN"},meridiemParse:/bn|BN|pn|PN/,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"Do MMMM[a] YYYY[an]",LLL:"Do MMMM[a] YYYY[an] HH:mm",LLLL:"dddd, Do MMMM[a] YYYY[an] HH:mm",ll:"Do MMM[.] YYYY[an]",lll:"Do MMM[.] YYYY[an] HH:mm",llll:"ddd[.], Do MMM[.] YYYY[an] HH:mm"},calendar:{sameDay:"[Îro di saet] LT [de]",nextDay:"[Sibê di saet] LT [de]",nextWeek:"dddd [di saet] LT [de]",lastDay:"[Duh di saet] LT [de]",lastWeek:"dddd[a borî di saet] LT [de]",sameElse:"L"},relativeTime:{future:"di %s de",past:"berî %s",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,w:e,ww:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}(?:yê|ê|\.)/,ordinal:function(t,e){var n=e.toLowerCase();return n.includes("w")||n.includes("m")?t+".":t+function(t){var e=(t=""+t).substring(t.length-1),n=t.length>1?t.substring(t.length-2):"";return 12==n||13==n||"2"!=e&&"3"!=e&&"50"!=n&&"70"!=e&&"80"!=e?"ê":"yê"}(t)},week:{dow:1,doy:4}})}(n(30381))},1408:function(t,e,n){!function(t){"use strict";var e={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},r=["کانونی دووەم","شوبات","ئازار","نیسان","ئایار","حوزەیران","تەمموز","ئاب","ئەیلوول","تشرینی یەكەم","تشرینی دووەم","كانونی یەکەم"];t.defineLocale("ku",{months:r,monthsShort:r,weekdays:"یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌".split("_"),weekdaysShort:"یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌".split("_"),weekdaysMin:"ی_د_س_چ_پ_ه_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ئێواره‌|به‌یانی/,isPM:function(t){return/ئێواره‌/.test(t)},meridiem:function(t,e,n){return t<12?"به‌یانی":"ئێواره‌"},calendar:{sameDay:"[ئه‌مرۆ كاتژمێر] LT",nextDay:"[به‌یانی كاتژمێر] LT",nextWeek:"dddd [كاتژمێر] LT",lastDay:"[دوێنێ كاتژمێر] LT",lastWeek:"dddd [كاتژمێر] LT",sameElse:"L"},relativeTime:{future:"له‌ %s",past:"%s",s:"چه‌ند چركه‌یه‌ك",ss:"چركه‌ %d",m:"یه‌ك خوله‌ك",mm:"%d خوله‌ك",h:"یه‌ك كاتژمێر",hh:"%d كاتژمێر",d:"یه‌ك ڕۆژ",dd:"%d ڕۆژ",M:"یه‌ك مانگ",MM:"%d مانگ",y:"یه‌ك ساڵ",yy:"%d ساڵ"},preparse:function(t){return t.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(t){return n[t]})).replace(/،/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n(30381))},33291:function(t,e,n){!function(t){"use strict";var e={0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"};t.defineLocale("ky",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),weekdays:"Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),weekdaysShort:"Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),weekdaysMin:"Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгүн саат] LT",nextDay:"[Эртең саат] LT",nextWeek:"dddd [саат] LT",lastDay:"[Кечээ саат] LT",lastWeek:"[Өткөн аптанын] dddd [күнү] [саат] LT",sameElse:"L"},relativeTime:{future:"%s ичинде",past:"%s мурун",s:"бирнече секунд",ss:"%d секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(t){return t+(e[t]||e[t%10]||e[t>=100?100:null])},week:{dow:1,doy:7}})}(n(30381))},36841:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return e?i[n][0]:i[n][1]}function n(t){if(t=parseInt(t,10),isNaN(t))return!1;if(t<0)return!0;if(t<10)return 4<=t&&t<=7;if(t<100){var e=t%10;return n(0===e?t/10:e)}if(t<1e4){for(;t>=10;)t/=10;return n(t)}return n(t/=1e3)}t.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:function(t){return n(t.substr(0,t.indexOf(" ")))?"a "+t:"an "+t},past:function(t){return n(t.substr(0,t.indexOf(" ")))?"viru "+t:"virun "+t},s:"e puer Sekonnen",ss:"%d Sekonnen",m:e,mm:"%d Minutten",h:e,hh:"%d Stonnen",d:e,dd:"%d Deeg",M:e,MM:"%d Méint",y:e,yy:"%d Joer"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},55466:function(t,e,n){!function(t){"use strict";t.defineLocale("lo",{months:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),monthsShort:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),weekdays:"ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysShort:"ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysMin:"ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"ວັນdddd D MMMM YYYY HH:mm"},meridiemParse:/ຕອນເຊົ້າ|ຕອນແລງ/,isPM:function(t){return"ຕອນແລງ"===t},meridiem:function(t,e,n){return t<12?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",ss:"%d ວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},dayOfMonthOrdinalParse:/(ທີ່)\d{1,2}/,ordinal:function(t){return"ທີ່"+t}})}(n(30381))},57010:function(t,e,n){!function(t){"use strict";var e={ss:"sekundė_sekundžių_sekundes",m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"};function n(t,e,n,r){return e?i(n)[0]:r?i(n)[1]:i(n)[2]}function r(t){return t%10==0||t>10&&t<20}function i(t){return e[t].split("_")}function o(t,e,o,s){var a=t+" ";return 1===t?a+n(0,e,o[0],s):e?a+(r(t)?i(o)[1]:i(o)[0]):s?a+i(o)[1]:a+(r(t)?i(o)[1]:i(o)[2])}t.defineLocale("lt",{months:{format:"sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),standalone:"sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis".split("_"),isFormat:/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/},monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:{format:"sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį".split("_"),standalone:"sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_"),isFormat:/dddd HH:mm/},weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], HH:mm [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], HH:mm [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:function(t,e,n,r){return e?"kelios sekundės":r?"kelių sekundžių":"kelias sekundes"},ss:o,m:n,mm:o,h:n,hh:o,d:n,dd:o,M:n,MM:o,y:n,yy:o},dayOfMonthOrdinalParse:/\d{1,2}-oji/,ordinal:function(t){return t+"-oji"},week:{dow:1,doy:4}})}(n(30381))},37595:function(t,e,n){!function(t){"use strict";var e={ss:"sekundes_sekundēm_sekunde_sekundes".split("_"),m:"minūtes_minūtēm_minūte_minūtes".split("_"),mm:"minūtes_minūtēm_minūte_minūtes".split("_"),h:"stundas_stundām_stunda_stundas".split("_"),hh:"stundas_stundām_stunda_stundas".split("_"),d:"dienas_dienām_diena_dienas".split("_"),dd:"dienas_dienām_diena_dienas".split("_"),M:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),MM:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")};function n(t,e,n){return n?e%10==1&&e%100!=11?t[2]:t[3]:e%10==1&&e%100!=11?t[0]:t[1]}function r(t,r,i){return t+" "+n(e[i],t,r)}function i(t,r,i){return n(e[i],t,r)}t.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"pēc %s",past:"pirms %s",s:function(t,e){return e?"dažas sekundes":"dažām sekundēm"},ss:r,m:i,mm:r,h:i,hh:r,d:i,dd:r,M:i,MM:r,y:i,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},39861:function(t,e,n){!function(t){"use strict";var e={words:{ss:["sekund","sekunda","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mjesec","mjeseca","mjeseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(t,e){return 1===t?e[0]:t>=2&&t<=4?e[1]:e[2]},translate:function(t,n,r){var i=e.words[r];return 1===r.length?n?i[0]:i[1]:t+" "+e.correctGrammaticalCase(t,i)}};t.defineLocale("me",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sjutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedjelje] [u] LT","[prošlog] [ponedjeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srijede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:"dan",dd:e.translate,M:"mjesec",MM:e.translate,y:"godinu",yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},35493:function(t,e,n){!function(t){"use strict";t.defineLocale("mi",{months:"Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea".split("_"),monthsShort:"Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki".split("_"),monthsRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,weekdays:"Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei".split("_"),weekdaysShort:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),weekdaysMin:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [i] HH:mm",LLLL:"dddd, D MMMM YYYY [i] HH:mm"},calendar:{sameDay:"[i teie mahana, i] LT",nextDay:"[apopo i] LT",nextWeek:"dddd [i] LT",lastDay:"[inanahi i] LT",lastWeek:"dddd [whakamutunga i] LT",sameElse:"L"},relativeTime:{future:"i roto i %s",past:"%s i mua",s:"te hēkona ruarua",ss:"%d hēkona",m:"he meneti",mm:"%d meneti",h:"te haora",hh:"%d haora",d:"he ra",dd:"%d ra",M:"he marama",MM:"%d marama",y:"he tau",yy:"%d tau"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},95966:function(t,e,n){!function(t){"use strict";t.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"[Во] dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"за %s",past:"пред %s",s:"неколку секунди",ss:"%d секунди",m:"една минута",mm:"%d минути",h:"еден час",hh:"%d часа",d:"еден ден",dd:"%d дена",M:"еден месец",MM:"%d месеци",y:"една година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(t){var e=t%10,n=t%100;return 0===t?t+"-ев":0===n?t+"-ен":n>10&&n<20?t+"-ти":1===e?t+"-ви":2===e?t+"-ри":7===e||8===e?t+"-ми":t+"-ти"},week:{dow:1,doy:7}})}(n(30381))},87341:function(t,e,n){!function(t){"use strict";t.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),monthsParseExact:!0,weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",LTS:"A h:mm:ss -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm -നു",LLLL:"dddd, D MMMM YYYY, A h:mm -നു"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",ss:"%d സെക്കൻഡ്",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(t,e){return 12===t&&(t=0),"രാത്രി"===e&&t>=4||"ഉച്ച കഴിഞ്ഞ്"===e||"വൈകുന്നേരം"===e?t+12:t},meridiem:function(t,e,n){return t<4?"രാത്രി":t<12?"രാവിലെ":t<17?"ഉച്ച കഴിഞ്ഞ്":t<20?"വൈകുന്നേരം":"രാത്രി"}})}(n(30381))},5115:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){switch(n){case"s":return e?"хэдхэн секунд":"хэдхэн секундын";case"ss":return t+(e?" секунд":" секундын");case"m":case"mm":return t+(e?" минут":" минутын");case"h":case"hh":return t+(e?" цаг":" цагийн");case"d":case"dd":return t+(e?" өдөр":" өдрийн");case"M":case"MM":return t+(e?" сар":" сарын");case"y":case"yy":return t+(e?" жил":" жилийн");default:return t}}t.defineLocale("mn",{months:"Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар".split("_"),monthsShort:"1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар".split("_"),monthsParseExact:!0,weekdays:"Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба".split("_"),weekdaysShort:"Ням_Дав_Мяг_Лха_Пүр_Баа_Бям".split("_"),weekdaysMin:"Ня_Да_Мя_Лх_Пү_Ба_Бя".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY оны MMMMын D",LLL:"YYYY оны MMMMын D HH:mm",LLLL:"dddd, YYYY оны MMMMын D HH:mm"},meridiemParse:/ҮӨ|ҮХ/i,isPM:function(t){return"ҮХ"===t},meridiem:function(t,e,n){return t<12?"ҮӨ":"ҮХ"},calendar:{sameDay:"[Өнөөдөр] LT",nextDay:"[Маргааш] LT",nextWeek:"[Ирэх] dddd LT",lastDay:"[Өчигдөр] LT",lastWeek:"[Өнгөрсөн] dddd LT",sameElse:"L"},relativeTime:{future:"%s дараа",past:"%s өмнө",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2} өдөр/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+" өдөр";default:return t}}})}(n(30381))},10370:function(t,e,n){!function(t){"use strict";var e={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};function r(t,e,n,r){var i="";if(e)switch(n){case"s":i="काही सेकंद";break;case"ss":i="%d सेकंद";break;case"m":i="एक मिनिट";break;case"mm":i="%d मिनिटे";break;case"h":i="एक तास";break;case"hh":i="%d तास";break;case"d":i="एक दिवस";break;case"dd":i="%d दिवस";break;case"M":i="एक महिना";break;case"MM":i="%d महिने";break;case"y":i="एक वर्ष";break;case"yy":i="%d वर्षे"}else switch(n){case"s":i="काही सेकंदां";break;case"ss":i="%d सेकंदां";break;case"m":i="एका मिनिटा";break;case"mm":i="%d मिनिटां";break;case"h":i="एका तासा";break;case"hh":i="%d तासां";break;case"d":i="एका दिवसा";break;case"dd":i="%d दिवसां";break;case"M":i="एका महिन्या";break;case"MM":i="%d महिन्यां";break;case"y":i="एका वर्षा";break;case"yy":i="%d वर्षां"}return i.replace(/%d/i,t)}t.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",LTS:"A h:mm:ss वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm वाजता",LLLL:"dddd, D MMMM YYYY, A h:mm वाजता"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%sमध्ये",past:"%sपूर्वी",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},preparse:function(t){return t.replace(/[१२३४५६७८९०]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/,meridiemHour:function(t,e){return 12===t&&(t=0),"पहाटे"===e||"सकाळी"===e?t:"दुपारी"===e||"सायंकाळी"===e||"रात्री"===e?t>=12?t:t+12:void 0},meridiem:function(t,e,n){return t>=0&&t<6?"पहाटे":t<12?"सकाळी":t<17?"दुपारी":t<20?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}})}(n(30381))},41237:function(t,e,n){!function(t){"use strict";t.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"tengahari"===e?t>=11?t:t+12:"petang"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"tengahari":t<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n(30381))},9847:function(t,e,n){!function(t){"use strict";t.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"tengahari"===e?t>=11?t:t+12:"petang"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"tengahari":t<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n(30381))},72126:function(t,e,n){!function(t){"use strict";t.defineLocale("mt",{months:"Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru".split("_"),monthsShort:"Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ".split("_"),weekdays:"Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt".split("_"),weekdaysShort:"Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib".split("_"),weekdaysMin:"Ħa_Tn_Tl_Er_Ħa_Ġi_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Illum fil-]LT",nextDay:"[Għada fil-]LT",nextWeek:"dddd [fil-]LT",lastDay:"[Il-bieraħ fil-]LT",lastWeek:"dddd [li għadda] [fil-]LT",sameElse:"L"},relativeTime:{future:"f’ %s",past:"%s ilu",s:"ftit sekondi",ss:"%d sekondi",m:"minuta",mm:"%d minuti",h:"siegħa",hh:"%d siegħat",d:"ġurnata",dd:"%d ġranet",M:"xahar",MM:"%d xhur",y:"sena",yy:"%d sni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},56165:function(t,e,n){!function(t){"use strict";var e={1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"},n={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"};t.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",ss:"%d စက္ကန့်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(t){return t.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},week:{dow:1,doy:4}})}(n(30381))},64924:function(t,e,n){!function(t){"use strict";t.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",ss:"%d sekunder",m:"ett minutt",mm:"%d minutter",h:"én time",hh:"%d timer",d:"én dag",dd:"%d dager",w:"én uke",ww:"%d uker",M:"én måned",MM:"%d måneder",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},16744:function(t,e,n){!function(t){"use strict";var e={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};t.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),monthsParseExact:!0,weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आ._सो._मं._बु._बि._शु._श.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"Aको h:mm बजे",LTS:"Aको h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, Aको h:mm बजे",LLLL:"dddd, D MMMM YYYY, Aको h:mm बजे"},preparse:function(t){return t.replace(/[१२३४५६७८९०]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(t,e){return 12===t&&(t=0),"राति"===e?t<4?t:t+12:"बिहान"===e?t:"दिउँसो"===e?t>=10?t:t+12:"साँझ"===e?t+12:void 0},meridiem:function(t,e,n){return t<3?"राति":t<12?"बिहान":t<16?"दिउँसो":t<20?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडि",s:"केही क्षण",ss:"%d सेकेण्ड",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:0,doy:6}})}(n(30381))},59814:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),r=[/^jan/i,/^feb/i,/^(maart|mrt\.?)$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],i=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;t.defineLocale("nl-be",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},93901:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),r=[/^jan/i,/^feb/i,/^(maart|mrt\.?)$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],i=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;t.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",w:"één week",ww:"%d weken",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},83877:function(t,e,n){!function(t){"use strict";t.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"su._må._ty._on._to._fr._lau.".split("_"),weekdaysMin:"su_må_ty_on_to_fr_la".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",ss:"%d sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",w:"ei veke",ww:"%d veker",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},92135:function(t,e,n){!function(t){"use strict";t.defineLocale("oc-lnc",{months:{standalone:"genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre".split("_"),format:"de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dm._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dm_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:"[uèi a] LT",nextDay:"[deman a] LT",nextWeek:"dddd [a] LT",lastDay:"[ièr a] LT",lastWeek:"dddd [passat a] LT",sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"unas segondas",ss:"%d segondas",m:"una minuta",mm:"%d minutas",h:"una ora",hh:"%d oras",d:"un jorn",dd:"%d jorns",M:"un mes",MM:"%d meses",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(t,e){var n=1===t?"r":2===t?"n":3===t?"r":4===t?"t":"è";return"w"!==e&&"W"!==e||(n="a"),t+n},week:{dow:1,doy:4}})}(n(30381))},15858:function(t,e,n){!function(t){"use strict";var e={1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"},n={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"};t.defineLocale("pa-in",{months:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),monthsShort:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),weekdays:"ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ".split("_"),weekdaysShort:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),weekdaysMin:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),longDateFormat:{LT:"A h:mm ਵਜੇ",LTS:"A h:mm:ss ਵਜੇ",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm ਵਜੇ",LLLL:"dddd, D MMMM YYYY, A h:mm ਵਜੇ"},calendar:{sameDay:"[ਅਜ] LT",nextDay:"[ਕਲ] LT",nextWeek:"[ਅਗਲਾ] dddd, LT",lastDay:"[ਕਲ] LT",lastWeek:"[ਪਿਛਲੇ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ਵਿੱਚ",past:"%s ਪਿਛਲੇ",s:"ਕੁਝ ਸਕਿੰਟ",ss:"%d ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(t){return t.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(t,e){return 12===t&&(t=0),"ਰਾਤ"===e?t<4?t:t+12:"ਸਵੇਰ"===e?t:"ਦੁਪਹਿਰ"===e?t>=10?t:t+12:"ਸ਼ਾਮ"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"ਰਾਤ":t<10?"ਸਵੇਰ":t<17?"ਦੁਪਹਿਰ":t<20?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}})}(n(30381))},64495:function(t,e,n){!function(t){"use strict";var e="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),n="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),r=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^paź/i,/^lis/i,/^gru/i];function i(t){return t%10<5&&t%10>1&&~~(t/10)%10!=1}function o(t,e,n){var r=t+" ";switch(n){case"ss":return r+(i(t)?"sekundy":"sekund");case"m":return e?"minuta":"minutę";case"mm":return r+(i(t)?"minuty":"minut");case"h":return e?"godzina":"godzinę";case"hh":return r+(i(t)?"godziny":"godzin");case"ww":return r+(i(t)?"tygodnie":"tygodni");case"MM":return r+(i(t)?"miesiące":"miesięcy");case"yy":return r+(i(t)?"lata":"lat")}}t.defineLocale("pl",{months:function(t,r){return t?/D MMMM/.test(r)?n[t.month()]:e[t.month()]:e},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_śr_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedzielę o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W środę o] LT";case 6:return"[W sobotę o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:o,m:o,mm:o,h:o,hh:o,d:"1 dzień",dd:"%d dni",w:"tydzień",ww:o,M:"miesiąc",MM:o,y:"rok",yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},57971:function(t,e,n){!function(t){"use strict";t.defineLocale("pt-br",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"do_2ª_3ª_4ª_5ª_6ª_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"poucos segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",invalidDate:"Data inválida"})}(n(30381))},89520:function(t,e,n){!function(t){"use strict";t.defineLocale("pt",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",w:"uma semana",ww:"%d semanas",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n(30381))},96459:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=" ";return(t%100>=20||t>=100&&t%100==0)&&(r=" de "),t+r+{ss:"secunde",mm:"minute",hh:"ore",dd:"zile",ww:"săptămâni",MM:"luni",yy:"ani"}[n]}t.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",ss:e,m:"un minut",mm:e,h:"o oră",hh:e,d:"o zi",dd:e,w:"o săptămână",ww:e,M:"o lună",MM:e,y:"un an",yy:e},week:{dow:1,doy:7}})}(n(30381))},21793:function(t,e,n){!function(t){"use strict";function e(t,e,n){return"m"===n?e?"минута":"минуту":t+" "+(r=+t,i={ss:e?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:e?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",ww:"неделя_недели_недель",MM:"месяц_месяца_месяцев",yy:"год_года_лет"}[n].split("_"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2]);var r,i}var n=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i];t.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:n,longMonthsParse:n,shortMonthsParse:n,monthsRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsShortRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsStrictRegex:/^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,monthsShortStrictRegex:/^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},calendar:{sameDay:"[Сегодня, в] LT",nextDay:"[Завтра, в] LT",lastDay:"[Вчера, в] LT",nextWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В следующее] dddd, [в] LT";case 1:case 2:case 4:return"[В следующий] dddd, [в] LT";case 3:case 5:case 6:return"[В следующую] dddd, [в] LT"}},lastWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd, [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd, [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd, [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",ss:e,m:e,mm:e,h:"час",hh:e,d:"день",dd:e,w:"неделя",ww:e,M:"месяц",MM:e,y:"год",yy:e},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(t){return/^(дня|вечера)$/.test(t)},meridiem:function(t,e,n){return t<4?"ночи":t<12?"утра":t<17?"дня":"вечера"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":return t+"-й";case"D":return t+"-го";case"w":case"W":return t+"-я";default:return t}},week:{dow:1,doy:4}})}(n(30381))},40950:function(t,e,n){!function(t){"use strict";var e=["جنوري","فيبروري","مارچ","اپريل","مئي","جون","جولاءِ","آگسٽ","سيپٽمبر","آڪٽوبر","نومبر","ڊسمبر"],n=["آچر","سومر","اڱارو","اربع","خميس","جمع","ڇنڇر"];t.defineLocale("sd",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(t){return"شام"===t},meridiem:function(t,e,n){return t<12?"صبح":"شام"},calendar:{sameDay:"[اڄ] LT",nextDay:"[سڀاڻي] LT",nextWeek:"dddd [اڳين هفتي تي] LT",lastDay:"[ڪالهه] LT",lastWeek:"[گزريل هفتي] dddd [تي] LT",sameElse:"L"},relativeTime:{future:"%s پوء",past:"%s اڳ",s:"چند سيڪنڊ",ss:"%d سيڪنڊ",m:"هڪ منٽ",mm:"%d منٽ",h:"هڪ ڪلاڪ",hh:"%d ڪلاڪ",d:"هڪ ڏينهن",dd:"%d ڏينهن",M:"هڪ مهينو",MM:"%d مهينا",y:"هڪ سال",yy:"%d سال"},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n(30381))},10490:function(t,e,n){!function(t){"use strict";t.defineLocale("se",{months:"ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu".split("_"),monthsShort:"ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov".split("_"),weekdays:"sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat".split("_"),weekdaysShort:"sotn_vuos_maŋ_gask_duor_bear_láv".split("_"),weekdaysMin:"s_v_m_g_d_b_L".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"MMMM D. [b.] YYYY",LLL:"MMMM D. [b.] YYYY [ti.] HH:mm",LLLL:"dddd, MMMM D. [b.] YYYY [ti.] HH:mm"},calendar:{sameDay:"[otne ti] LT",nextDay:"[ihttin ti] LT",nextWeek:"dddd [ti] LT",lastDay:"[ikte ti] LT",lastWeek:"[ovddit] dddd [ti] LT",sameElse:"L"},relativeTime:{future:"%s geažes",past:"maŋit %s",s:"moadde sekunddat",ss:"%d sekunddat",m:"okta minuhta",mm:"%d minuhtat",h:"okta diimmu",hh:"%d diimmut",d:"okta beaivi",dd:"%d beaivvit",M:"okta mánnu",MM:"%d mánut",y:"okta jahki",yy:"%d jagit"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},90124:function(t,e,n){!function(t){"use strict";t.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),weekdays:"ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),weekdaysShort:"ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන".split("_"),weekdaysMin:"ඉ_ස_අ_බ_බ්‍ර_සි_සෙ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"a h:mm",LTS:"a h:mm:ss",L:"YYYY/MM/DD",LL:"YYYY MMMM D",LLL:"YYYY MMMM D, a h:mm",LLLL:"YYYY MMMM D [වැනි] dddd, a h:mm:ss"},calendar:{sameDay:"[අද] LT[ට]",nextDay:"[හෙට] LT[ට]",nextWeek:"dddd LT[ට]",lastDay:"[ඊයේ] LT[ට]",lastWeek:"[පසුගිය] dddd LT[ට]",sameElse:"L"},relativeTime:{future:"%sකින්",past:"%sකට පෙර",s:"තත්පර කිහිපය",ss:"තත්පර %d",m:"මිනිත්තුව",mm:"මිනිත්තු %d",h:"පැය",hh:"පැය %d",d:"දිනය",dd:"දින %d",M:"මාසය",MM:"මාස %d",y:"වසර",yy:"වසර %d"},dayOfMonthOrdinalParse:/\d{1,2} වැනි/,ordinal:function(t){return t+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(t){return"ප.ව."===t||"පස් වරු"===t},meridiem:function(t,e,n){return t>11?n?"ප.ව.":"පස් වරු":n?"පෙ.ව.":"පෙර වරු"}})}(n(30381))},64249:function(t,e,n){!function(t){"use strict";var e="január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),n="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");function r(t){return t>1&&t<5}function i(t,e,n,i){var o=t+" ";switch(n){case"s":return e||i?"pár sekúnd":"pár sekundami";case"ss":return e||i?o+(r(t)?"sekundy":"sekúnd"):o+"sekundami";case"m":return e?"minúta":i?"minútu":"minútou";case"mm":return e||i?o+(r(t)?"minúty":"minút"):o+"minútami";case"h":return e?"hodina":i?"hodinu":"hodinou";case"hh":return e||i?o+(r(t)?"hodiny":"hodín"):o+"hodinami";case"d":return e||i?"deň":"dňom";case"dd":return e||i?o+(r(t)?"dni":"dní"):o+"dňami";case"M":return e||i?"mesiac":"mesiacom";case"MM":return e||i?o+(r(t)?"mesiace":"mesiacov"):o+"mesiacmi";case"y":return e||i?"rok":"rokom";case"yy":return e||i?o+(r(t)?"roky":"rokov"):o+"rokmi"}}t.defineLocale("sk",{months:e,monthsShort:n,weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:case 4:case 5:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:i,ss:i,m:i,mm:i,h:i,hh:i,d:i,dd:i,M:i,MM:i,y:i,yy:i},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},14985:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i=t+" ";switch(n){case"s":return e||r?"nekaj sekund":"nekaj sekundami";case"ss":return i+(1===t?e?"sekundo":"sekundi":2===t?e||r?"sekundi":"sekundah":t<5?e||r?"sekunde":"sekundah":"sekund");case"m":return e?"ena minuta":"eno minuto";case"mm":return i+(1===t?e?"minuta":"minuto":2===t?e||r?"minuti":"minutama":t<5?e||r?"minute":"minutami":e||r?"minut":"minutami");case"h":return e?"ena ura":"eno uro";case"hh":return i+(1===t?e?"ura":"uro":2===t?e||r?"uri":"urama":t<5?e||r?"ure":"urami":e||r?"ur":"urami");case"d":return e||r?"en dan":"enim dnem";case"dd":return i+(1===t?e||r?"dan":"dnem":2===t?e||r?"dni":"dnevoma":e||r?"dni":"dnevi");case"M":return e||r?"en mesec":"enim mesecem";case"MM":return i+(1===t?e||r?"mesec":"mesecem":2===t?e||r?"meseca":"mesecema":t<5?e||r?"mesece":"meseci":e||r?"mesecev":"meseci");case"y":return e||r?"eno leto":"enim letom";case"yy":return i+(1===t?e||r?"leto":"letom":2===t?e||r?"leti":"letoma":t<5?e||r?"leta":"leti":e||r?"let":"leti")}}t.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prejšnjo] [nedeljo] [ob] LT";case 3:return"[prejšnjo] [sredo] [ob] LT";case 6:return"[prejšnjo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"pred %s",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},51104:function(t,e,n){!function(t){"use strict";t.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),weekdaysParseExact:!0,meridiemParse:/PD|MD/,isPM:function(t){return"M"===t.charAt(0)},meridiem:function(t,e,n){return t<12?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",ss:"%d sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},79915:function(t,e,n){!function(t){"use strict";var e={words:{ss:["секунда","секунде","секунди"],m:["један минут","једног минута"],mm:["минут","минута","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],d:["један дан","једног дана"],dd:["дан","дана","дана"],M:["један месец","једног месеца"],MM:["месец","месеца","месеци"],y:["једну годину","једне године"],yy:["годину","године","година"]},correctGrammaticalCase:function(t,e){return t%10>=1&&t%10<=4&&(t%100<10||t%100>=20)?t%10==1?e[0]:e[1]:e[2]},translate:function(t,n,r,i){var o,s=e.words[r];return 1===r.length?"y"===r&&n?"једна година":i||n?s[0]:s[1]:(o=e.correctGrammaticalCase(t,s),"yy"===r&&n&&"годину"===o?t+" година":t+" "+o)}};t.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){return["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:e.translate,dd:e.translate,M:e.translate,MM:e.translate,y:e.translate,yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},49131:function(t,e,n){!function(t){"use strict";var e={words:{ss:["sekunda","sekunde","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],d:["jedan dan","jednog dana"],dd:["dan","dana","dana"],M:["jedan mesec","jednog meseca"],MM:["mesec","meseca","meseci"],y:["jednu godinu","jedne godine"],yy:["godinu","godine","godina"]},correctGrammaticalCase:function(t,e){return t%10>=1&&t%10<=4&&(t%100<10||t%100>=20)?t%10==1?e[0]:e[1]:e[2]},translate:function(t,n,r,i){var o,s=e.words[r];return 1===r.length?"y"===r&&n?"jedna godina":i||n?s[0]:s[1]:(o=e.correctGrammaticalCase(t,s),"yy"===r&&n&&"godinu"===o?t+" godina":t+" "+o)}};t.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:e.translate,dd:e.translate,M:e.translate,MM:e.translate,y:e.translate,yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},85893:function(t,e,n){!function(t){"use strict";t.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",ss:"%d mzuzwana",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(t,e,n){return t<11?"ekuseni":t<15?"emini":t<19?"entsambama":"ebusuku"},meridiemHour:function(t,e){return 12===t&&(t=0),"ekuseni"===e?t:"emini"===e?t>=11?t:t+12:"entsambama"===e||"ebusuku"===e?0===t?0:t+12:void 0},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}})}(n(30381))},98760:function(t,e,n){!function(t){"use strict";t.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",ss:"%d sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}(\:e|\:a)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?":e":1===e||2===e?":a":":e")},week:{dow:1,doy:4}})}(n(30381))},91172:function(t,e,n){!function(t){"use strict";t.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"hh:mm A",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",ss:"sekunde %d",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"siku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}})}(n(30381))},27333:function(t,e,n){!function(t){"use strict";var e={1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"},n={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"};t.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",ss:"%d விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},dayOfMonthOrdinalParse:/\d{1,2}வது/,ordinal:function(t){return t+"வது"},preparse:function(t){return t.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(t,e,n){return t<2?" யாமம்":t<6?" வைகறை":t<10?" காலை":t<14?" நண்பகல்":t<18?" எற்பாடு":t<22?" மாலை":" யாமம்"},meridiemHour:function(t,e){return 12===t&&(t=0),"யாமம்"===e?t<2?t:t+12:"வைகறை"===e||"காலை"===e||"நண்பகல்"===e&&t>=10?t:t+12},week:{dow:0,doy:6}})}(n(30381))},23110:function(t,e,n){!function(t){"use strict";t.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,weekdays:"ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),weekdaysShort:"ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),weekdaysMin:"ఆ_సో_మం_బు_గు_శు_శ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[నేడు] LT",nextDay:"[రేపు] LT",nextWeek:"dddd, LT",lastDay:"[నిన్న] LT",lastWeek:"[గత] dddd, LT",sameElse:"L"},relativeTime:{future:"%s లో",past:"%s క్రితం",s:"కొన్ని క్షణాలు",ss:"%d సెకన్లు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},dayOfMonthOrdinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(t,e){return 12===t&&(t=0),"రాత్రి"===e?t<4?t:t+12:"ఉదయం"===e?t:"మధ్యాహ్నం"===e?t>=10?t:t+12:"సాయంత్రం"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"రాత్రి":t<10?"ఉదయం":t<17?"మధ్యాహ్నం":t<20?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}})}(n(30381))},52095:function(t,e,n){!function(t){"use strict";t.defineLocale("tet",{months:"Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu".split("_"),weekdaysShort:"Dom_Seg_Ters_Kua_Kint_Sest_Sab".split("_"),weekdaysMin:"Do_Seg_Te_Ku_Ki_Ses_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Ohin iha] LT",nextDay:"[Aban iha] LT",nextWeek:"dddd [iha] LT",lastDay:"[Horiseik iha] LT",lastWeek:"dddd [semana kotuk] [iha] LT",sameElse:"L"},relativeTime:{future:"iha %s",past:"%s liuba",s:"segundu balun",ss:"segundu %d",m:"minutu ida",mm:"minutu %d",h:"oras ida",hh:"oras %d",d:"loron ida",dd:"loron %d",M:"fulan ida",MM:"fulan %d",y:"tinan ida",yy:"tinan %d"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},27321:function(t,e,n){!function(t){"use strict";var e={0:"-ум",1:"-ум",2:"-юм",3:"-юм",4:"-ум",5:"-ум",6:"-ум",7:"-ум",8:"-ум",9:"-ум",10:"-ум",12:"-ум",13:"-ум",20:"-ум",30:"-юм",40:"-ум",50:"-ум",60:"-ум",70:"-ум",80:"-ум",90:"-ум",100:"-ум"};t.defineLocale("tg",{months:{format:"январи_феврали_марти_апрели_майи_июни_июли_августи_сентябри_октябри_ноябри_декабри".split("_"),standalone:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_")},monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе".split("_"),weekdaysShort:"яшб_дшб_сшб_чшб_пшб_ҷум_шнб".split("_"),weekdaysMin:"яш_дш_сш_чш_пш_ҷм_шб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Имрӯз соати] LT",nextDay:"[Фардо соати] LT",lastDay:"[Дирӯз соати] LT",nextWeek:"dddd[и] [ҳафтаи оянда соати] LT",lastWeek:"dddd[и] [ҳафтаи гузашта соати] LT",sameElse:"L"},relativeTime:{future:"баъди %s",past:"%s пеш",s:"якчанд сония",m:"як дақиқа",mm:"%d дақиқа",h:"як соат",hh:"%d соат",d:"як рӯз",dd:"%d рӯз",M:"як моҳ",MM:"%d моҳ",y:"як сол",yy:"%d сол"},meridiemParse:/шаб|субҳ|рӯз|бегоҳ/,meridiemHour:function(t,e){return 12===t&&(t=0),"шаб"===e?t<4?t:t+12:"субҳ"===e?t:"рӯз"===e?t>=11?t:t+12:"бегоҳ"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"шаб":t<11?"субҳ":t<16?"рӯз":t<19?"бегоҳ":"шаб"},dayOfMonthOrdinalParse:/\d{1,2}-(ум|юм)/,ordinal:function(t){return t+(e[t]||e[t%10]||e[t>=100?100:null])},week:{dow:1,doy:7}})}(n(30381))},9041:function(t,e,n){!function(t){"use strict";t.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.".split("_"),monthsParseExact:!0,weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H:mm",LLLL:"วันddddที่ D MMMM YYYY เวลา H:mm"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(t){return"หลังเที่ยง"===t},meridiem:function(t,e,n){return t<12?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",ss:"%d วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",w:"1 สัปดาห์",ww:"%d สัปดาห์",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}})}(n(30381))},19005:function(t,e,n){!function(t){"use strict";var e={1:"'inji",5:"'inji",8:"'inji",70:"'inji",80:"'inji",2:"'nji",7:"'nji",20:"'nji",50:"'nji",3:"'ünji",4:"'ünji",100:"'ünji",6:"'njy",9:"'unjy",10:"'unjy",30:"'unjy",60:"'ynjy",90:"'ynjy"};t.defineLocale("tk",{months:"Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr".split("_"),monthsShort:"Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek".split("_"),weekdays:"Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe".split("_"),weekdaysShort:"Ýek_Duş_Siş_Çar_Pen_Ann_Şen".split("_"),weekdaysMin:"Ýk_Dş_Sş_Çr_Pn_An_Şn".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün sagat] LT",nextDay:"[ertir sagat] LT",nextWeek:"[indiki] dddd [sagat] LT",lastDay:"[düýn] LT",lastWeek:"[geçen] dddd [sagat] LT",sameElse:"L"},relativeTime:{future:"%s soň",past:"%s öň",s:"birnäçe sekunt",m:"bir minut",mm:"%d minut",h:"bir sagat",hh:"%d sagat",d:"bir gün",dd:"%d gün",M:"bir aý",MM:"%d aý",y:"bir ýyl",yy:"%d ýyl"},ordinal:function(t,n){switch(n){case"d":case"D":case"Do":case"DD":return t;default:if(0===t)return t+"'unjy";var r=t%10;return t+(e[r]||e[t%100-r]||e[t>=100?100:null])}},week:{dow:1,doy:7}})}(n(30381))},75768:function(t,e,n){!function(t){"use strict";t.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},89444:function(t,e,n){!function(t){"use strict";var e="pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_");function n(t,n,r,i){var o=function(t){var n=Math.floor(t%1e3/100),r=Math.floor(t%100/10),i=t%10,o="";return n>0&&(o+=e[n]+"vatlh"),r>0&&(o+=(""!==o?" ":"")+e[r]+"maH"),i>0&&(o+=(""!==o?" ":"")+e[i]),""===o?"pagh":o}(t);switch(r){case"ss":return o+" lup";case"mm":return o+" tup";case"hh":return o+" rep";case"dd":return o+" jaj";case"MM":return o+" jar";case"yy":return o+" DIS"}}t.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:function(t){var e=t;return-1!==t.indexOf("jaj")?e.slice(0,-3)+"leS":-1!==t.indexOf("jar")?e.slice(0,-3)+"waQ":-1!==t.indexOf("DIS")?e.slice(0,-3)+"nem":e+" pIq"},past:function(t){var e=t;return-1!==t.indexOf("jaj")?e.slice(0,-3)+"Hu’":-1!==t.indexOf("jar")?e.slice(0,-3)+"wen":-1!==t.indexOf("DIS")?e.slice(0,-3)+"ben":e+" ret"},s:"puS lup",ss:n,m:"wa’ tup",mm:n,h:"wa’ rep",hh:n,d:"wa’ jaj",dd:n,M:"wa’ jar",MM:n,y:"wa’ DIS",yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},72397:function(t,e,n){!function(t){"use strict";var e={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"};t.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pzt_Sal_Çar_Per_Cum_Cmt".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),meridiem:function(t,e,n){return t<12?n?"öö":"ÖÖ":n?"ös":"ÖS"},meridiemParse:/öö|ÖÖ|ös|ÖS/,isPM:function(t){return"ös"===t||"ÖS"===t},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[gelecek] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",ss:"%d saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",w:"bir hafta",ww:"%d hafta",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(t,n){switch(n){case"d":case"D":case"Do":case"DD":return t;default:if(0===t)return t+"'ıncı";var r=t%10;return t+(e[r]||e[t%100-r]||e[t>=100?100:null])}},week:{dow:1,doy:7}})}(n(30381))},28254:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["viensas secunds","'iensas secunds"],ss:[t+" secunds",t+" secunds"],m:["'n míut","'iens míut"],mm:[t+" míuts",t+" míuts"],h:["'n þora","'iensa þora"],hh:[t+" þoras",t+" þoras"],d:["'n ziua","'iensa ziua"],dd:[t+" ziuas",t+" ziuas"],M:["'n mes","'iens mes"],MM:[t+" mesen",t+" mesen"],y:["'n ar","'iens ar"],yy:[t+" ars",t+" ars"]};return r||e?i[n][0]:i[n][1]}t.defineLocale("tzl",{months:"Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),weekdaysShort:"Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),weekdaysMin:"Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(t){return"d'o"===t.toLowerCase()},meridiem:function(t,e,n){return t>11?n?"d'o":"D'O":n?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},30699:function(t,e,n){!function(t){"use strict";t.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",ss:"%d imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}(n(30381))},51106:function(t,e,n){!function(t){"use strict";t.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",ss:"%d ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}(n(30381))},9288:function(t,e,n){!function(t){"use strict";t.defineLocale("ug-cn",{months:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),monthsShort:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),weekdays:"يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە".split("_"),weekdaysShort:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),weekdaysMin:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY-يىلىM-ئاينىڭD-كۈنى",LLL:"YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm",LLLL:"dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm"},meridiemParse:/يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/,meridiemHour:function(t,e){return 12===t&&(t=0),"يېرىم كېچە"===e||"سەھەر"===e||"چۈشتىن بۇرۇن"===e?t:"چۈشتىن كېيىن"===e||"كەچ"===e?t+12:t>=11?t:t+12},meridiem:function(t,e,n){var r=100*t+e;return r<600?"يېرىم كېچە":r<900?"سەھەر":r<1130?"چۈشتىن بۇرۇن":r<1230?"چۈش":r<1800?"چۈشتىن كېيىن":"كەچ"},calendar:{sameDay:"[بۈگۈن سائەت] LT",nextDay:"[ئەتە سائەت] LT",nextWeek:"[كېلەركى] dddd [سائەت] LT",lastDay:"[تۆنۈگۈن] LT",lastWeek:"[ئالدىنقى] dddd [سائەت] LT",sameElse:"L"},relativeTime:{future:"%s كېيىن",past:"%s بۇرۇن",s:"نەچچە سېكونت",ss:"%d سېكونت",m:"بىر مىنۇت",mm:"%d مىنۇت",h:"بىر سائەت",hh:"%d سائەت",d:"بىر كۈن",dd:"%d كۈن",M:"بىر ئاي",MM:"%d ئاي",y:"بىر يىل",yy:"%d يىل"},dayOfMonthOrdinalParse:/\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"-كۈنى";case"w":case"W":return t+"-ھەپتە";default:return t}},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:1,doy:7}})}(n(30381))},67691:function(t,e,n){!function(t){"use strict";function e(t,e,n){return"m"===n?e?"хвилина":"хвилину":"h"===n?e?"година":"годину":t+" "+(r=+t,i={ss:e?"секунда_секунди_секунд":"секунду_секунди_секунд",mm:e?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:e?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"}[n].split("_"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2]);var r,i}function n(t){return function(){return t+"о"+(11===this.hours()?"б":"")+"] LT"}}t.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:function(t,e){var n={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")};return!0===t?n.nominative.slice(1,7).concat(n.nominative.slice(0,1)):t?n[/(\[[ВвУу]\]) ?dddd/.test(e)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(e)?"genitive":"nominative"][t.day()]:n.nominative},weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:n("[Сьогодні "),nextDay:n("[Завтра "),lastDay:n("[Вчора "),nextWeek:n("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return n("[Минулої] dddd [").call(this);case 1:case 2:case 4:return n("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",ss:e,m:e,mm:e,h:"годину",hh:e,d:"день",dd:e,M:"місяць",MM:e,y:"рік",yy:e},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(t){return/^(дня|вечора)$/.test(t)},meridiem:function(t,e,n){return t<4?"ночі":t<12?"ранку":t<17?"дня":"вечора"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":case"w":case"W":return t+"-й";case"D":return t+"-го";default:return t}},week:{dow:1,doy:7}})}(n(30381))},13795:function(t,e,n){!function(t){"use strict";var e=["جنوری","فروری","مارچ","اپریل","مئی","جون","جولائی","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],n=["اتوار","پیر","منگل","بدھ","جمعرات","جمعہ","ہفتہ"];t.defineLocale("ur",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(t){return"شام"===t},meridiem:function(t,e,n){return t<12?"صبح":"شام"},calendar:{sameDay:"[آج بوقت] LT",nextDay:"[کل بوقت] LT",nextWeek:"dddd [بوقت] LT",lastDay:"[گذشتہ روز بوقت] LT",lastWeek:"[گذشتہ] dddd [بوقت] LT",sameElse:"L"},relativeTime:{future:"%s بعد",past:"%s قبل",s:"چند سیکنڈ",ss:"%d سیکنڈ",m:"ایک منٹ",mm:"%d منٹ",h:"ایک گھنٹہ",hh:"%d گھنٹے",d:"ایک دن",dd:"%d دن",M:"ایک ماہ",MM:"%d ماہ",y:"ایک سال",yy:"%d سال"},preparse:function(t){return t.replace(/،/g,",")},postformat:function(t){return t.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n(30381))},60588:function(t,e,n){!function(t){"use strict";t.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}})}(n(30381))},6791:function(t,e,n){!function(t){"use strict";t.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",ss:"%d фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}})}(n(30381))},65666:function(t,e,n){!function(t){"use strict";t.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(t){return/^ch$/i.test(t)},meridiem:function(t,e,n){return t<12?n?"sa":"SA":n?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần trước lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",ss:"%d giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",w:"một tuần",ww:"%d tuần",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},14378:function(t,e,n){!function(t){"use strict";t.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",ss:"%d s~écóñ~ds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},75805:function(t,e,n){!function(t){"use strict";t.defineLocale("yo",{months:"Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),monthsShort:"Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),weekdays:"Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),weekdaysShort:"Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),weekdaysMin:"Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Ònì ni] LT",nextDay:"[Ọ̀la ni] LT",nextWeek:"dddd [Ọsẹ̀ tón'bọ] [ni] LT",lastDay:"[Àna ni] LT",lastWeek:"dddd [Ọsẹ̀ tólọ́] [ni] LT",sameElse:"L"},relativeTime:{future:"ní %s",past:"%s kọjá",s:"ìsẹjú aayá die",ss:"aayá %d",m:"ìsẹjú kan",mm:"ìsẹjú %d",h:"wákati kan",hh:"wákati %d",d:"ọjọ́ kan",dd:"ọjọ́ %d",M:"osù kan",MM:"osù %d",y:"ọdún kan",yy:"ọdún %d"},dayOfMonthOrdinalParse:/ọjọ́\s\d{1,2}/,ordinal:"ọjọ́ %d",week:{dow:1,doy:4}})}(n(30381))},83839:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(t,e){return 12===t&&(t=0),"凌晨"===e||"早上"===e||"上午"===e?t:"下午"===e||"晚上"===e?t+12:t>=11?t:t+12},meridiem:function(t,e,n){var r=100*t+e;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:function(t){return t.week()!==this.week()?"[下]dddLT":"[本]dddLT"},lastDay:"[昨天]LT",lastWeek:function(t){return this.week()!==t.week()?"[上]dddLT":"[本]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"日";case"M":return t+"月";case"w":case"W":return t+"周";default:return t}},relativeTime:{future:"%s后",past:"%s前",s:"几秒",ss:"%d 秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",w:"1 周",ww:"%d 周",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}})}(n(30381))},55726:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(t,e){return 12===t&&(t=0),"凌晨"===e||"早上"===e||"上午"===e?t:"中午"===e?t>=11?t:t+12:"下午"===e||"晚上"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"凌晨":r<900?"早上":r<1200?"上午":1200===r?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"日";case"M":return t+"月";case"w":case"W":return t+"週";default:return t}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(30381))},99807:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(t,e){return 12===t&&(t=0),"凌晨"===e||"早上"===e||"上午"===e?t:"中午"===e?t>=11?t:t+12:"下午"===e||"晚上"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"日";case"M":return t+"月";case"w":case"W":return t+"週";default:return t}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(30381))},74152:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(t,e){return 12===t&&(t=0),"凌晨"===e||"早上"===e||"上午"===e?t:"中午"===e?t>=11?t:t+12:"下午"===e||"晚上"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"日";case"M":return t+"月";case"w":case"W":return t+"週";default:return t}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(30381))},46700:(t,e,n)=>{var r={"./af":42786,"./af.js":42786,"./ar":30867,"./ar-dz":14130,"./ar-dz.js":14130,"./ar-kw":96135,"./ar-kw.js":96135,"./ar-ly":56440,"./ar-ly.js":56440,"./ar-ma":47702,"./ar-ma.js":47702,"./ar-ps":20315,"./ar-ps.js":20315,"./ar-sa":16040,"./ar-sa.js":16040,"./ar-tn":37100,"./ar-tn.js":37100,"./ar.js":30867,"./az":31083,"./az.js":31083,"./be":9808,"./be.js":9808,"./bg":68338,"./bg.js":68338,"./bm":67438,"./bm.js":67438,"./bn":8905,"./bn-bd":76225,"./bn-bd.js":76225,"./bn.js":8905,"./bo":11560,"./bo.js":11560,"./br":1278,"./br.js":1278,"./bs":80622,"./bs.js":80622,"./ca":2468,"./ca.js":2468,"./cs":5822,"./cs.js":5822,"./cv":50877,"./cv.js":50877,"./cy":47373,"./cy.js":47373,"./da":24780,"./da.js":24780,"./de":59740,"./de-at":60217,"./de-at.js":60217,"./de-ch":60894,"./de-ch.js":60894,"./de.js":59740,"./dv":5300,"./dv.js":5300,"./el":50837,"./el.js":50837,"./en-au":78348,"./en-au.js":78348,"./en-ca":77925,"./en-ca.js":77925,"./en-gb":22243,"./en-gb.js":22243,"./en-ie":46436,"./en-ie.js":46436,"./en-il":47207,"./en-il.js":47207,"./en-in":44175,"./en-in.js":44175,"./en-nz":76319,"./en-nz.js":76319,"./en-sg":31662,"./en-sg.js":31662,"./eo":92915,"./eo.js":92915,"./es":55655,"./es-do":55251,"./es-do.js":55251,"./es-mx":96112,"./es-mx.js":96112,"./es-us":71146,"./es-us.js":71146,"./es.js":55655,"./et":5603,"./et.js":5603,"./eu":77763,"./eu.js":77763,"./fa":76959,"./fa.js":76959,"./fi":11897,"./fi.js":11897,"./fil":42549,"./fil.js":42549,"./fo":94694,"./fo.js":94694,"./fr":94470,"./fr-ca":63049,"./fr-ca.js":63049,"./fr-ch":52330,"./fr-ch.js":52330,"./fr.js":94470,"./fy":5044,"./fy.js":5044,"./ga":29295,"./ga.js":29295,"./gd":2101,"./gd.js":2101,"./gl":38794,"./gl.js":38794,"./gom-deva":27884,"./gom-deva.js":27884,"./gom-latn":23168,"./gom-latn.js":23168,"./gu":95349,"./gu.js":95349,"./he":24206,"./he.js":24206,"./hi":30094,"./hi.js":30094,"./hr":30316,"./hr.js":30316,"./hu":22138,"./hu.js":22138,"./hy-am":11423,"./hy-am.js":11423,"./id":29218,"./id.js":29218,"./is":90135,"./is.js":90135,"./it":90626,"./it-ch":10150,"./it-ch.js":10150,"./it.js":90626,"./ja":39183,"./ja.js":39183,"./jv":24286,"./jv.js":24286,"./ka":12105,"./ka.js":12105,"./kk":47772,"./kk.js":47772,"./km":18758,"./km.js":18758,"./kn":79282,"./kn.js":79282,"./ko":33730,"./ko.js":33730,"./ku":1408,"./ku-kmr":90563,"./ku-kmr.js":90563,"./ku.js":1408,"./ky":33291,"./ky.js":33291,"./lb":36841,"./lb.js":36841,"./lo":55466,"./lo.js":55466,"./lt":57010,"./lt.js":57010,"./lv":37595,"./lv.js":37595,"./me":39861,"./me.js":39861,"./mi":35493,"./mi.js":35493,"./mk":95966,"./mk.js":95966,"./ml":87341,"./ml.js":87341,"./mn":5115,"./mn.js":5115,"./mr":10370,"./mr.js":10370,"./ms":9847,"./ms-my":41237,"./ms-my.js":41237,"./ms.js":9847,"./mt":72126,"./mt.js":72126,"./my":56165,"./my.js":56165,"./nb":64924,"./nb.js":64924,"./ne":16744,"./ne.js":16744,"./nl":93901,"./nl-be":59814,"./nl-be.js":59814,"./nl.js":93901,"./nn":83877,"./nn.js":83877,"./oc-lnc":92135,"./oc-lnc.js":92135,"./pa-in":15858,"./pa-in.js":15858,"./pl":64495,"./pl.js":64495,"./pt":89520,"./pt-br":57971,"./pt-br.js":57971,"./pt.js":89520,"./ro":96459,"./ro.js":96459,"./ru":21793,"./ru.js":21793,"./sd":40950,"./sd.js":40950,"./se":10490,"./se.js":10490,"./si":90124,"./si.js":90124,"./sk":64249,"./sk.js":64249,"./sl":14985,"./sl.js":14985,"./sq":51104,"./sq.js":51104,"./sr":49131,"./sr-cyrl":79915,"./sr-cyrl.js":79915,"./sr.js":49131,"./ss":85893,"./ss.js":85893,"./sv":98760,"./sv.js":98760,"./sw":91172,"./sw.js":91172,"./ta":27333,"./ta.js":27333,"./te":23110,"./te.js":23110,"./tet":52095,"./tet.js":52095,"./tg":27321,"./tg.js":27321,"./th":9041,"./th.js":9041,"./tk":19005,"./tk.js":19005,"./tl-ph":75768,"./tl-ph.js":75768,"./tlh":89444,"./tlh.js":89444,"./tr":72397,"./tr.js":72397,"./tzl":28254,"./tzl.js":28254,"./tzm":51106,"./tzm-latn":30699,"./tzm-latn.js":30699,"./tzm.js":51106,"./ug-cn":9288,"./ug-cn.js":9288,"./uk":67691,"./uk.js":67691,"./ur":13795,"./ur.js":13795,"./uz":6791,"./uz-latn":60588,"./uz-latn.js":60588,"./uz.js":6791,"./vi":65666,"./vi.js":65666,"./x-pseudo":14378,"./x-pseudo.js":14378,"./yo":75805,"./yo.js":75805,"./zh-cn":83839,"./zh-cn.js":83839,"./zh-hk":55726,"./zh-hk.js":55726,"./zh-mo":99807,"./zh-mo.js":99807,"./zh-tw":74152,"./zh-tw.js":74152};function i(t){var e=o(t);return n(e)}function o(t){if(!n.o(r,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r[t]}i.keys=function(){return Object.keys(r)},i.resolve=o,t.exports=i,i.id=46700},30381:function(t,e,n){(t=n.nmd(t)).exports=function(){"use strict";var e,r;function i(){return e.apply(null,arguments)}function o(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function s(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function u(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(a(t,e))return!1;return!0}function c(t){return void 0===t}function d(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function l(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function h(t,e){var n,r=[],i=t.length;for(n=0;n>>0;for(e=0;e0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var L=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,$=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,R={},O={};function D(t,e,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),t&&(O[t]=i),e&&(O[e[0]]=function(){return B(i.apply(this,arguments),e[1],e[2])}),n&&(O[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function C(t,e){return t.isValid()?(e=N(e,t.localeData()),R[e]=R[e]||function(t){var e,n,r,i=t.match(L);for(e=0,n=i.length;e=0&&$.test(t);)t=t.replace($,r),$.lastIndex=0,n-=1;return t}var z={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function U(t){return"string"==typeof t?z[t]||z[t.toLowerCase()]:void 0}function j(t){var e,n,r={};for(n in t)a(t,n)&&(e=U(n))&&(r[e]=t[n]);return r}var Y={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};var F,W=/\d/,H=/\d\d/,K=/\d{3}/,q=/\d{4}/,V=/[+-]?\d{6}/,G=/\d\d?/,Z=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,J=/\d{1,3}/,Q=/\d{1,4}/,tt=/[+-]?\d{1,6}/,et=/\d+/,nt=/[+-]?\d+/,rt=/Z|[+-]\d\d:?\d\d/gi,it=/Z|[+-]\d\d(?::?\d\d)?/gi,ot=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,st=/^[1-9]\d?/,at=/^([1-9]\d|\d)/;function ut(t,e,n){F[t]=E(e)?e:function(t,r){return t&&n?n:e}}function ct(t,e){return a(F,t)?F[t](e._strict,e._locale):new RegExp(dt(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(t,e,n,r,i){return e||n||r||i}))))}function dt(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function lt(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function ht(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=lt(e)),n}F={};var ft={};function pt(t,e){var n,r,i=e;for("string"==typeof t&&(t=[t]),d(e)&&(i=function(t,n){n[e]=ht(t)}),r=t.length,n=0;n68?1900:2e3)};var Et,Tt=Pt("FullYear",!0);function Pt(t,e){return function(n){return null!=n?(Lt(this,t,n),i.updateOffset(this,e),this):Bt(this,t)}}function Bt(t,e){if(!t.isValid())return NaN;var n=t._d,r=t._isUTC;switch(e){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Lt(t,e,n){var r,i,o,s,a;if(t.isValid()&&!isNaN(n)){switch(r=t._d,i=t._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(i?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(i?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(i?r.setUTCHours(n):r.setHours(n));case"Date":return void(i?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}o=n,s=t.month(),a=29!==(a=t.date())||1!==s||yt(o)?a:28,i?r.setUTCFullYear(o,s,a):r.setFullYear(o,s,a)}}function $t(t,e){if(isNaN(t)||isNaN(e))return NaN;var n,r=(e%(n=12)+n)%n;return t+=(e-r)/12,1===r?yt(t)?29:28:31-r%7%2}Et=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e=0?(a=new Date(t+400,e,n,r,i,o,s),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,n,r,i,o,s),a}function Wt(t){var e,n;return t<100&&t>=0?((n=Array.prototype.slice.call(arguments))[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function Ht(t,e,n){var r=7+e-n;return-(7+Wt(t,0,r).getUTCDay()-e)%7+r-1}function Kt(t,e,n,r,i){var o,s,a=1+7*(e-1)+(7+n-r)%7+Ht(t,r,i);return a<=0?s=xt(o=t-1)+a:a>xt(t)?(o=t+1,s=a-xt(t)):(o=t,s=a),{year:o,dayOfYear:s}}function qt(t,e,n){var r,i,o=Ht(t.year(),e,n),s=Math.floor((t.dayOfYear()-o-1)/7)+1;return s<1?r=s+Vt(i=t.year()-1,e,n):s>Vt(t.year(),e,n)?(r=s-Vt(t.year(),e,n),i=t.year()+1):(i=t.year(),r=s),{week:r,year:i}}function Vt(t,e,n){var r=Ht(t,e,n),i=Ht(t+1,e,n);return(xt(t)-r+i)/7}D("w",["ww",2],"wo","week"),D("W",["WW",2],"Wo","isoWeek"),ut("w",G,st),ut("ww",G,H),ut("W",G,st),ut("WW",G,H),mt(["w","ww","W","WW"],(function(t,e,n,r){e[r.substr(0,1)]=ht(t)}));function Gt(t,e){return t.slice(e,7).concat(t.slice(0,e))}D("d",0,"do","day"),D("dd",0,0,(function(t){return this.localeData().weekdaysMin(this,t)})),D("ddd",0,0,(function(t){return this.localeData().weekdaysShort(this,t)})),D("dddd",0,0,(function(t){return this.localeData().weekdays(this,t)})),D("e",0,0,"weekday"),D("E",0,0,"isoWeekday"),ut("d",G),ut("e",G),ut("E",G),ut("dd",(function(t,e){return e.weekdaysMinRegex(t)})),ut("ddd",(function(t,e){return e.weekdaysShortRegex(t)})),ut("dddd",(function(t,e){return e.weekdaysRegex(t)})),mt(["dd","ddd","dddd"],(function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);null!=i?e.d=i:m(n).invalidWeekday=t})),mt(["d","e","E"],(function(t,e,n,r){e[r]=ht(t)}));var Zt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Xt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Jt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Qt=ot,te=ot,ee=ot;function ne(t,e,n){var r,i,o,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)o=p([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===e?-1!==(i=Et.call(this._weekdaysParse,s))?i:null:"ddd"===e?-1!==(i=Et.call(this._shortWeekdaysParse,s))?i:null:-1!==(i=Et.call(this._minWeekdaysParse,s))?i:null:"dddd"===e?-1!==(i=Et.call(this._weekdaysParse,s))||-1!==(i=Et.call(this._shortWeekdaysParse,s))||-1!==(i=Et.call(this._minWeekdaysParse,s))?i:null:"ddd"===e?-1!==(i=Et.call(this._shortWeekdaysParse,s))||-1!==(i=Et.call(this._weekdaysParse,s))||-1!==(i=Et.call(this._minWeekdaysParse,s))?i:null:-1!==(i=Et.call(this._minWeekdaysParse,s))||-1!==(i=Et.call(this._weekdaysParse,s))||-1!==(i=Et.call(this._shortWeekdaysParse,s))?i:null}function re(){function t(t,e){return e.length-t.length}var e,n,r,i,o,s=[],a=[],u=[],c=[];for(e=0;e<7;e++)n=p([2e3,1]).day(e),r=dt(this.weekdaysMin(n,"")),i=dt(this.weekdaysShort(n,"")),o=dt(this.weekdays(n,"")),s.push(r),a.push(i),u.push(o),c.push(r),c.push(i),c.push(o);s.sort(t),a.sort(t),u.sort(t),c.sort(t),this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function ie(){return this.hours()%12||12}function oe(t,e){D(t,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)}))}function se(t,e){return e._meridiemParse}D("H",["HH",2],0,"hour"),D("h",["hh",2],0,ie),D("k",["kk",2],0,(function(){return this.hours()||24})),D("hmm",0,0,(function(){return""+ie.apply(this)+B(this.minutes(),2)})),D("hmmss",0,0,(function(){return""+ie.apply(this)+B(this.minutes(),2)+B(this.seconds(),2)})),D("Hmm",0,0,(function(){return""+this.hours()+B(this.minutes(),2)})),D("Hmmss",0,0,(function(){return""+this.hours()+B(this.minutes(),2)+B(this.seconds(),2)})),oe("a",!0),oe("A",!1),ut("a",se),ut("A",se),ut("H",G,at),ut("h",G,st),ut("k",G,st),ut("HH",G,H),ut("hh",G,H),ut("kk",G,H),ut("hmm",Z),ut("hmmss",X),ut("Hmm",Z),ut("Hmmss",X),pt(["H","HH"],vt),pt(["k","kk"],(function(t,e,n){var r=ht(t);e[vt]=24===r?0:r})),pt(["a","A"],(function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t})),pt(["h","hh"],(function(t,e,n){e[vt]=ht(t),m(n).bigHour=!0})),pt("hmm",(function(t,e,n){var r=t.length-2;e[vt]=ht(t.substr(0,r)),e[kt]=ht(t.substr(r)),m(n).bigHour=!0})),pt("hmmss",(function(t,e,n){var r=t.length-4,i=t.length-2;e[vt]=ht(t.substr(0,r)),e[kt]=ht(t.substr(r,2)),e[Mt]=ht(t.substr(i)),m(n).bigHour=!0})),pt("Hmm",(function(t,e,n){var r=t.length-2;e[vt]=ht(t.substr(0,r)),e[kt]=ht(t.substr(r))})),pt("Hmmss",(function(t,e,n){var r=t.length-4,i=t.length-2;e[vt]=ht(t.substr(0,r)),e[kt]=ht(t.substr(r,2)),e[Mt]=ht(t.substr(i))}));var ae=Pt("Hours",!0);var ue,ce={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Rt,monthsShort:Ot,week:{dow:0,doy:6},weekdays:Zt,weekdaysMin:Jt,weekdaysShort:Xt,meridiemParse:/[ap]\.?m?\.?/i},de={},le={};function he(t,e){var n,r=Math.min(t.length,e.length);for(n=0;n0;){if(r=pe(i.slice(0,e).join("-")))return r;if(n&&n.length>=e&&he(i,n)>=e-1)break;e--}o++}return ue}(t)}function be(t){var e,n=t._a;return n&&-2===m(t).overflow&&(e=n[wt]<0||n[wt]>11?wt:n[_t]<1||n[_t]>$t(n[bt],n[wt])?_t:n[vt]<0||n[vt]>24||24===n[vt]&&(0!==n[kt]||0!==n[Mt]||0!==n[At])?vt:n[kt]<0||n[kt]>59?kt:n[Mt]<0||n[Mt]>59?Mt:n[At]<0||n[At]>999?At:-1,m(t)._overflowDayOfYear&&(e_t)&&(e=_t),m(t)._overflowWeeks&&-1===e&&(e=St),m(t)._overflowWeekday&&-1===e&&(e=It),m(t).overflow=e),t}var we=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_e=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ve=/Z|[+-]\d\d(?::?\d\d)?/,ke=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Me=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ae=/^\/?Date\((-?\d+)/i,Se=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Ie={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function xe(t){var e,n,r,i,o,s,a=t._i,u=we.exec(a)||_e.exec(a),c=ke.length,d=Me.length;if(u){for(m(t).iso=!0,e=0,n=c;e7)&&(u=!0)):(o=t._locale._week.dow,s=t._locale._week.doy,c=qt(Oe(),o,s),n=Pe(e.gg,t._a[bt],c.year),r=Pe(e.w,c.week),null!=e.d?((i=e.d)<0||i>6)&&(u=!0):null!=e.e?(i=e.e+o,(e.e<0||e.e>6)&&(u=!0)):i=o),r<1||r>Vt(n,o,s)?m(t)._overflowWeeks=!0:null!=u?m(t)._overflowWeekday=!0:(a=Kt(n,r,i,o,s),t._a[bt]=a.year,t._dayOfYear=a.dayOfYear)}(t),null!=t._dayOfYear&&(s=Pe(t._a[bt],r[bt]),(t._dayOfYear>xt(s)||0===t._dayOfYear)&&(m(t)._overflowDayOfYear=!0),n=Wt(s,0,t._dayOfYear),t._a[wt]=n.getUTCMonth(),t._a[_t]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=a[e]=r[e];for(;e<7;e++)t._a[e]=a[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[vt]&&0===t._a[kt]&&0===t._a[Mt]&&0===t._a[At]&&(t._nextDay=!0,t._a[vt]=0),t._d=(t._useUTC?Wt:Ft).apply(null,a),o=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[vt]=24),t._w&&void 0!==t._w.d&&t._w.d!==o&&(m(t).weekdayMismatch=!0)}}function Le(t){if(t._f!==i.ISO_8601)if(t._f!==i.RFC_2822){t._a=[],m(t).empty=!0;var e,n,r,o,s,a,u,c=""+t._i,d=c.length,l=0;for(u=(r=N(t._f,t._locale).match(L)||[]).length,e=0;e0&&m(t).unusedInput.push(s),c=c.slice(c.indexOf(n)+n.length),l+=n.length),O[o]?(n?m(t).empty=!1:m(t).unusedTokens.push(o),gt(o,n,t)):t._strict&&!n&&m(t).unusedTokens.push(o);m(t).charsLeftOver=d-l,c.length>0&&m(t).unusedInput.push(c),t._a[vt]<=12&&!0===m(t).bigHour&&t._a[vt]>0&&(m(t).bigHour=void 0),m(t).parsedDateParts=t._a.slice(0),m(t).meridiem=t._meridiem,t._a[vt]=function(t,e,n){var r;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?((r=t.isPM(n))&&e<12&&(e+=12),r||12!==e||(e=0),e):e}(t._locale,t._a[vt],t._meridiem),null!==(a=m(t).era)&&(t._a[bt]=t._locale.erasConvertYear(a,t._a[bt])),Be(t),be(t)}else Te(t);else xe(t)}function $e(t){var e=t._i,n=t._f;return t._locale=t._locale||ye(t._l),null===e||void 0===n&&""===e?y({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),k(e)?new v(be(e)):(l(e)?t._d=e:o(n)?function(t){var e,n,r,i,o,s,a=!1,u=t._f.length;if(0===u)return m(t).invalidFormat=!0,void(t._d=new Date(NaN));for(i=0;ithis?this:t:y()}));function Ne(t,e){var n,r;if(1===e.length&&o(e[0])&&(e=e[0]),!e.length)return Oe();for(n=e[0],r=1;r=0?new Date(t+400,e,n)-pn:new Date(t,e,n).valueOf()}function yn(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-pn:Date.UTC(t,e,n)}function bn(t,e){return e.erasAbbrRegex(t)}function wn(){var t,e,n,r,i,o=[],s=[],a=[],u=[],c=this.eras();for(t=0,e=c.length;t(o=Vt(t,r,i))&&(e=o),kn.call(this,t,e,n,r,i))}function kn(t,e,n,r,i){var o=Kt(t,e,n,r,i),s=Wt(o.year,0,o.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}D("N",0,0,"eraAbbr"),D("NN",0,0,"eraAbbr"),D("NNN",0,0,"eraAbbr"),D("NNNN",0,0,"eraName"),D("NNNNN",0,0,"eraNarrow"),D("y",["y",1],"yo","eraYear"),D("y",["yy",2],0,"eraYear"),D("y",["yyy",3],0,"eraYear"),D("y",["yyyy",4],0,"eraYear"),ut("N",bn),ut("NN",bn),ut("NNN",bn),ut("NNNN",(function(t,e){return e.erasNameRegex(t)})),ut("NNNNN",(function(t,e){return e.erasNarrowRegex(t)})),pt(["N","NN","NNN","NNNN","NNNNN"],(function(t,e,n,r){var i=n._locale.erasParse(t,r,n._strict);i?m(n).era=i:m(n).invalidEra=t})),ut("y",et),ut("yy",et),ut("yyy",et),ut("yyyy",et),ut("yo",(function(t,e){return e._eraYearOrdinalRegex||et})),pt(["y","yy","yyy","yyyy"],bt),pt(["yo"],(function(t,e,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[bt]=n._locale.eraYearOrdinalParse(t,i):e[bt]=parseInt(t,10)})),D(0,["gg",2],0,(function(){return this.weekYear()%100})),D(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),_n("gggg","weekYear"),_n("ggggg","weekYear"),_n("GGGG","isoWeekYear"),_n("GGGGG","isoWeekYear"),ut("G",nt),ut("g",nt),ut("GG",G,H),ut("gg",G,H),ut("GGGG",Q,q),ut("gggg",Q,q),ut("GGGGG",tt,V),ut("ggggg",tt,V),mt(["gggg","ggggg","GGGG","GGGGG"],(function(t,e,n,r){e[r.substr(0,2)]=ht(t)})),mt(["gg","GG"],(function(t,e,n,r){e[r]=i.parseTwoDigitYear(t)})),D("Q",0,"Qo","quarter"),ut("Q",W),pt("Q",(function(t,e){e[wt]=3*(ht(t)-1)})),D("D",["DD",2],"Do","date"),ut("D",G,st),ut("DD",G,H),ut("Do",(function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient})),pt(["D","DD"],_t),pt("Do",(function(t,e){e[_t]=ht(t.match(G)[0])}));var Mn=Pt("Date",!0);D("DDD",["DDDD",3],"DDDo","dayOfYear"),ut("DDD",J),ut("DDDD",K),pt(["DDD","DDDD"],(function(t,e,n){n._dayOfYear=ht(t)})),D("m",["mm",2],0,"minute"),ut("m",G,at),ut("mm",G,H),pt(["m","mm"],kt);var An=Pt("Minutes",!1);D("s",["ss",2],0,"second"),ut("s",G,at),ut("ss",G,H),pt(["s","ss"],Mt);var Sn,In,xn=Pt("Seconds",!1);for(D("S",0,0,(function(){return~~(this.millisecond()/100)})),D(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),D(0,["SSS",3],0,"millisecond"),D(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),D(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),D(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),D(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),D(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),D(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),ut("S",J,W),ut("SS",J,H),ut("SSS",J,K),Sn="SSSS";Sn.length<=9;Sn+="S")ut(Sn,et);function En(t,e){e[At]=ht(1e3*("0."+t))}for(Sn="S";Sn.length<=9;Sn+="S")pt(Sn,En);In=Pt("Milliseconds",!1),D("z",0,0,"zoneAbbr"),D("zz",0,0,"zoneName");var Tn=v.prototype;function Pn(t){return t}Tn.add=nn,Tn.calendar=function(t,e){1===arguments.length&&(arguments[0]?sn(arguments[0])?(t=arguments[0],e=void 0):function(t){var e,n=s(t)&&!u(t),r=!1,i=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(e=0;en.valueOf():n.valueOf()9999?C(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):E(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",C(n,"Z")):C(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},Tn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t,e,n,r="moment",i="";return this.isLocal()||(r=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),t="["+r+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY","-MM-DD[T]HH:mm:ss.SSS",n=i+'[")]',this.format(t+e+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(Tn[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Tn.toJSON=function(){return this.isValid()?this.toISOString():null},Tn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Tn.unix=function(){return Math.floor(this.valueOf()/1e3)},Tn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Tn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Tn.eraName=function(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;tthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Tn.isLocal=function(){return!!this.isValid()&&!this._isUTC},Tn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Tn.isUtc=Ve,Tn.isUTC=Ve,Tn.zoneAbbr=function(){return this._isUTC?"UTC":""},Tn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Tn.dates=A("dates accessor is deprecated. Use date instead.",Mn),Tn.months=A("months accessor is deprecated. Use month instead",jt),Tn.years=A("years accessor is deprecated. Use year instead",Tt),Tn.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()})),Tn.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!c(this._isDSTShifted))return this._isDSTShifted;var t,e={};return _(e,this),(e=$e(e))._a?(t=e._isUTC?p(e._a):Oe(e._a),this._isDSTShifted=this.isValid()&&function(t,e,n){var r,i=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),s=0;for(r=0;r0):this._isDSTShifted=!1,this._isDSTShifted}));var Bn=P.prototype;function Ln(t,e,n,r){var i=ye(),o=p().set(r,e);return i[n](o,t)}function $n(t,e,n){if(d(t)&&(e=t,t=void 0),t=t||"",null!=e)return Ln(t,e,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=Ln(t,r,n,"month");return i}function Rn(t,e,n,r){"boolean"==typeof t?(d(e)&&(n=e,e=void 0),e=e||""):(n=e=t,t=!1,d(e)&&(n=e,e=void 0),e=e||"");var i,o=ye(),s=t?o._week.dow:0,a=[];if(null!=n)return Ln(e,(n+s)%7,r,"day");for(i=0;i<7;i++)a[i]=Ln(e,(i+s)%7,r,"day");return a}Bn.calendar=function(t,e,n){var r=this._calendar[t]||this._calendar.sameElse;return E(r)?r.call(e,n):r},Bn.longDateFormat=function(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(L).map((function(t){return"MMMM"===t||"MM"===t||"DD"===t||"dddd"===t?t.slice(1):t})).join(""),this._longDateFormat[t])},Bn.invalidDate=function(){return this._invalidDate},Bn.ordinal=function(t){return this._ordinal.replace("%d",t)},Bn.preparse=Pn,Bn.postformat=Pn,Bn.relativeTime=function(t,e,n,r){var i=this._relativeTime[n];return E(i)?i(t,e,n,r):i.replace(/%d/i,t)},Bn.pastFuture=function(t,e){var n=this._relativeTime[t>0?"future":"past"];return E(n)?n(e):n.replace(/%s/i,e)},Bn.set=function(t){var e,n;for(n in t)a(t,n)&&(E(e=t[n])?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},Bn.eras=function(t,e){var n,r,o,s=this._eras||ye("en")._eras;for(n=0,r=s.length;n=0)return u[r]},Bn.erasConvertYear=function(t,e){var n=t.since<=t.until?1:-1;return void 0===e?i(t.since).year():i(t.since).year()+(e-t.offset)*n},Bn.erasAbbrRegex=function(t){return a(this,"_erasAbbrRegex")||wn.call(this),t?this._erasAbbrRegex:this._erasRegex},Bn.erasNameRegex=function(t){return a(this,"_erasNameRegex")||wn.call(this),t?this._erasNameRegex:this._erasRegex},Bn.erasNarrowRegex=function(t){return a(this,"_erasNarrowRegex")||wn.call(this),t?this._erasNarrowRegex:this._erasRegex},Bn.months=function(t,e){return t?o(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||Dt).test(e)?"format":"standalone"][t.month()]:o(this._months)?this._months:this._months.standalone},Bn.monthsShort=function(t,e){return t?o(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[Dt.test(e)?"format":"standalone"][t.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},Bn.monthsParse=function(t,e,n){var r,i,o;if(this._monthsParseExact)return zt.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=p([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[r].test(t))return r;if(n&&"MMM"===e&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}},Bn.monthsRegex=function(t){return this._monthsParseExact?(a(this,"_monthsRegex")||Yt.call(this),t?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=Nt),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)},Bn.monthsShortRegex=function(t){return this._monthsParseExact?(a(this,"_monthsRegex")||Yt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=Ct),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)},Bn.week=function(t){return qt(t,this._week.dow,this._week.doy).week},Bn.firstDayOfYear=function(){return this._week.doy},Bn.firstDayOfWeek=function(){return this._week.dow},Bn.weekdays=function(t,e){var n=o(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?Gt(n,this._week.dow):t?n[t.day()]:n},Bn.weekdaysMin=function(t){return!0===t?Gt(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin},Bn.weekdaysShort=function(t){return!0===t?Gt(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort},Bn.weekdaysParse=function(t,e,n){var r,i,o;if(this._weekdaysParseExact)return ne.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=p([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[r].test(t))return r;if(n&&"ddd"===e&&this._shortWeekdaysParse[r].test(t))return r;if(n&&"dd"===e&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}},Bn.weekdaysRegex=function(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||re.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Qt),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)},Bn.weekdaysShortRegex=function(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||re.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=te),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Bn.weekdaysMinRegex=function(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||re.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ee),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Bn.isPM=function(t){return"p"===(t+"").toLowerCase().charAt(0)},Bn.meridiem=function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},me("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===ht(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),i.lang=A("moment.lang is deprecated. Use moment.locale instead.",me),i.langData=A("moment.langData is deprecated. Use moment.localeData instead.",ye);var On=Math.abs;function Dn(t,e,n,r){var i=Xe(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function Cn(t){return t<0?Math.floor(t):Math.ceil(t)}function Nn(t){return 4800*t/146097}function zn(t){return 146097*t/4800}function Un(t){return function(){return this.as(t)}}var jn=Un("ms"),Yn=Un("s"),Fn=Un("m"),Wn=Un("h"),Hn=Un("d"),Kn=Un("w"),qn=Un("M"),Vn=Un("Q"),Gn=Un("y"),Zn=jn;function Xn(t){return function(){return this.isValid()?this._data[t]:NaN}}var Jn=Xn("milliseconds"),Qn=Xn("seconds"),tr=Xn("minutes"),er=Xn("hours"),nr=Xn("days"),rr=Xn("months"),ir=Xn("years");var or=Math.round,sr={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ar(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}var ur=Math.abs;function cr(t){return(t>0)-(t<0)||+t}function dr(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,r,i,o,s,a,u=ur(this._milliseconds)/1e3,c=ur(this._days),d=ur(this._months),l=this.asSeconds();return l?(t=lt(u/60),e=lt(t/60),u%=60,t%=60,n=lt(d/12),d%=12,r=u?u.toFixed(3).replace(/\.?0+$/,""):"",i=l<0?"-":"",o=cr(this._months)!==cr(l)?"-":"",s=cr(this._days)!==cr(l)?"-":"",a=cr(this._milliseconds)!==cr(l)?"-":"",i+"P"+(n?o+n+"Y":"")+(d?o+d+"M":"")+(c?s+c+"D":"")+(e||t||u?"T":"")+(e?a+e+"H":"")+(t?a+t+"M":"")+(u?a+r+"S":"")):"P0D"}var lr=Ue.prototype;return lr.isValid=function(){return this._isValid},lr.abs=function(){var t=this._data;return this._milliseconds=On(this._milliseconds),this._days=On(this._days),this._months=On(this._months),t.milliseconds=On(t.milliseconds),t.seconds=On(t.seconds),t.minutes=On(t.minutes),t.hours=On(t.hours),t.months=On(t.months),t.years=On(t.years),this},lr.add=function(t,e){return Dn(this,t,e,1)},lr.subtract=function(t,e){return Dn(this,t,e,-1)},lr.as=function(t){if(!this.isValid())return NaN;var e,n,r=this._milliseconds;if("month"===(t=U(t))||"quarter"===t||"year"===t)switch(e=this._days+r/864e5,n=this._months+Nn(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(zn(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return 24*e+r/36e5;case"minute":return 1440*e+r/6e4;case"second":return 86400*e+r/1e3;case"millisecond":return Math.floor(864e5*e)+r;default:throw new Error("Unknown unit "+t)}},lr.asMilliseconds=jn,lr.asSeconds=Yn,lr.asMinutes=Fn,lr.asHours=Wn,lr.asDays=Hn,lr.asWeeks=Kn,lr.asMonths=qn,lr.asQuarters=Vn,lr.asYears=Gn,lr.valueOf=Zn,lr._bubble=function(){var t,e,n,r,i,o=this._milliseconds,s=this._days,a=this._months,u=this._data;return o>=0&&s>=0&&a>=0||o<=0&&s<=0&&a<=0||(o+=864e5*Cn(zn(a)+s),s=0,a=0),u.milliseconds=o%1e3,t=lt(o/1e3),u.seconds=t%60,e=lt(t/60),u.minutes=e%60,n=lt(e/60),u.hours=n%24,s+=lt(n/24),a+=i=lt(Nn(s)),s-=Cn(zn(i)),r=lt(a/12),a%=12,u.days=s,u.months=a,u.years=r,this},lr.clone=function(){return Xe(this)},lr.get=function(t){return t=U(t),this.isValid()?this[t+"s"]():NaN},lr.milliseconds=Jn,lr.seconds=Qn,lr.minutes=tr,lr.hours=er,lr.days=nr,lr.weeks=function(){return lt(this.days()/7)},lr.months=rr,lr.years=ir,lr.humanize=function(t,e){if(!this.isValid())return this.localeData().invalidDate();var n,r,i=!1,o=sr;return"object"==typeof t&&(e=t,t=!1),"boolean"==typeof t&&(i=t),"object"==typeof e&&(o=Object.assign({},sr,e),null!=e.s&&null==e.ss&&(o.ss=e.s-1)),r=function(t,e,n,r){var i=Xe(t).abs(),o=or(i.as("s")),s=or(i.as("m")),a=or(i.as("h")),u=or(i.as("d")),c=or(i.as("M")),d=or(i.as("w")),l=or(i.as("y")),h=o<=n.ss&&["s",o]||o0,h[4]=r,ar.apply(null,h)}(this,!i,o,n=this.localeData()),i&&(r=n.pastFuture(+this,r)),n.postformat(r)},lr.toISOString=dr,lr.toString=dr,lr.toJSON=dr,lr.locale=un,lr.localeData=dn,lr.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",dr),lr.lang=cn,D("X",0,0,"unix"),D("x",0,0,"valueOf"),ut("x",nt),ut("X",/[+-]?\d+(\.\d{1,3})?/),pt("X",(function(t,e,n){n._d=new Date(1e3*parseFloat(t))})),pt("x",(function(t,e,n){n._d=new Date(ht(t))})),i.version="2.30.1",e=Oe,i.fn=Tn,i.min=function(){return Ne("isBefore",[].slice.call(arguments,0))},i.max=function(){return Ne("isAfter",[].slice.call(arguments,0))},i.now=function(){return Date.now?Date.now():+new Date},i.utc=p,i.unix=function(t){return Oe(1e3*t)},i.months=function(t,e){return $n(t,e,"months")},i.isDate=l,i.locale=me,i.invalid=y,i.duration=Xe,i.isMoment=k,i.weekdays=function(t,e,n){return Rn(t,e,n,"weekdays")},i.parseZone=function(){return Oe.apply(null,arguments).parseZone()},i.localeData=ye,i.isDuration=je,i.monthsShort=function(t,e){return $n(t,e,"monthsShort")},i.weekdaysMin=function(t,e,n){return Rn(t,e,n,"weekdaysMin")},i.defineLocale=ge,i.updateLocale=function(t,e){if(null!=e){var n,r,i=ce;null!=de[t]&&null!=de[t].parentLocale?de[t].set(T(de[t]._config,e)):(null!=(r=pe(t))&&(i=r._config),e=T(i,e),null==r&&(e.abbr=t),(n=new P(e)).parentLocale=de[t],de[t]=n),me(t)}else null!=de[t]&&(null!=de[t].parentLocale?(de[t]=de[t].parentLocale,t===me()&&me(t)):null!=de[t]&&delete de[t]);return de[t]},i.locales=function(){return S(de)},i.weekdaysShort=function(t,e,n){return Rn(t,e,n,"weekdaysShort")},i.normalizeUnits=U,i.relativeTimeRounding=function(t){return void 0===t?or:"function"==typeof t&&(or=t,!0)},i.relativeTimeThreshold=function(t,e){return void 0!==sr[t]&&(void 0===e?sr[t]:(sr[t]=e,"s"===t&&(sr.ss=e-1),!0))},i.calendarFormat=function(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},i.prototype=Tn,i.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},i}()},83300:(t,e,n)=>{"use strict";var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("unable to locate global object")}();t.exports=e=r.fetch,r.fetch&&(e.default=r.fetch.bind(r)),e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response},42693:(t,e,n)=>{"use strict";const r=n(99353),i=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class o extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,({message:t}=t)):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const s=(t,e)=>new Promise(((n,s)=>{e={onFailedAttempt:()=>{},retries:10,...e};const a=r.operation(e);a.attempt((async r=>{try{n(await t(r))}catch(t){if(!(t instanceof Error))return void s(new TypeError(`Non-error was thrown: "${t}". You should only throw errors.`));if(t instanceof o)a.stop(),s(t.originalError);else if(t instanceof TypeError&&(u=t.message,!i.includes(u)))a.stop(),s(t);else{((t,e,n)=>{const r=n.retries-(e-1);t.attemptNumber=e,t.retriesLeft=r})(t,r,e);try{await e.onFailedAttempt(t)}catch(t){return void s(t)}a.retry(t)||s(a.mainError())}}var u}))}));t.exports=s,t.exports.default=s,t.exports.AbortError=o},58147:t=>{"use strict";class e extends Error{constructor(t){super(t),this.name="TimeoutError"}}const n=(t,n,r,i)=>{let o;const s=new Promise(((s,a)=>{if("number"!=typeof n||n<0)throw new TypeError("Expected `milliseconds` to be a positive number");n!==1/0?(i={customTimers:{setTimeout,clearTimeout},...i},o=i.customTimers.setTimeout.call(void 0,(()=>{if("function"==typeof r){try{s(r())}catch(t){a(t)}return}const i=r instanceof Error?r:new e("string"==typeof r?r:`Promise timed out after ${n} milliseconds`);"function"==typeof t.cancel&&t.cancel(),a(i)}),n),(async()=>{try{s(await t)}catch(t){a(t)}finally{i.customTimers.clearTimeout.call(void 0,o)}})()):s(t)}));return s.clear=()=>{clearTimeout(o),o=void 0},s};t.exports=n,t.exports.default=n,t.exports.TimeoutError=e},52818:(t,e,n)=>{"use strict";var r=n(39809);e.certificate=n(41934);var i=r.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())}));e.RSAPrivateKey=i;var o=r.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));e.RSAPublicKey=o;var s=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}));e.PublicKey=s;var a=r.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())})),u=r.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(a),this.key("subjectPrivateKey").octstr())}));e.PrivateKey=u;var c=r.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())}));e.EncryptedPrivateKey=c;var d=r.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())}));e.DSAPrivateKey=d,e.DSAparam=r.define("DSAparam",(function(){this.int()}));var l=r.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())}));e.ECPrivateKey=l;var h=r.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));e.signature=r.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},41934:(t,e,n)=>{"use strict";var r=n(39809),i=r.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=r.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),s=r.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),a=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())})),u=r.define("RelativeDistinguishedName",(function(){this.setof(o)})),c=r.define("RDNSequence",(function(){this.seqof(u)})),d=r.define("Name",(function(){this.choice({rdnSequence:this.use(c)})})),l=r.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))})),h=r.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),f=r.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(s),this.key("issuer").use(d),this.key("validity").use(l),this.key("subject").use(d),this.key("subjectPublicKeyInfo").use(a),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(h).optional())})),p=r.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(f),this.key("signatureAlgorithm").use(s),this.key("signatureValue").bitstr())}));t.exports=p},77631:(t,e,n)=>{var r=/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,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,s=n(13048),a=n(44696),u=n(89509).Buffer;t.exports=function(t,e){var n,c=t.toString(),d=c.match(r);if(d){var l="aes"+d[1],h=u.from(d[2],"hex"),f=u.from(d[3].replace(/[\r\n]/g,""),"base64"),p=s(e,h.slice(0,8),parseInt(d[1],10)).key,m=[],g=a.createDecipheriv(l,p,h);m.push(g.update(f)),m.push(g.final()),n=u.concat(m)}else{var y=c.match(o);n=u.from(y[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(i)[1],data:n}}},70980:(t,e,n)=>{var r=n(52818),i=n(22562),o=n(77631),s=n(44696),a=n(25632),u=n(89509).Buffer;function c(t){var e;"object"!=typeof t||u.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=u.from(t));var n,c,d=o(t,e),l=d.tag,h=d.data;switch(l){case"CERTIFICATE":c=r.certificate.decode(h,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=r.PublicKey.decode(h,"der")),n=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=r.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+n)}case"ENCRYPTED PRIVATE KEY":h=function(t,e){var n=t.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[t.algorithm.decrypt.cipher.algo.join(".")],c=t.algorithm.decrypt.cipher.iv,d=t.subjectPrivateKey,l=parseInt(o.split("-")[1],10)/8,h=a.pbkdf2Sync(e,n,r,l,"sha1"),f=s.createDecipheriv(o,h,c),p=[];return p.push(f.update(d)),p.push(f.final()),u.concat(p)}(h=r.EncryptedPrivateKey.decode(h,"der"),e);case"PRIVATE KEY":switch(n=(c=r.PrivateKey.decode(h,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:r.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=r.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+n)}case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(h,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(h,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(h,"der")};case"EC PRIVATE KEY":return{curve:(h=r.ECPrivateKey.decode(h,"der")).parameters.value,privateKey:h.privateKey};default:throw new Error("unknown key type "+l)}}t.exports=c,c.signature=r.signature},25632:(t,e,n)=>{e.pbkdf2=n(88638),e.pbkdf2Sync=n(91257)},88638:(t,e,n)=>{var r,i,o=n(89509).Buffer,s=n(77357),a=n(12368),u=n(91257),c=n(57777),d=n.g.crypto&&n.g.crypto.subtle,l={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"},h=[];function f(){return i||(i=n.g.process&&n.g.process.nextTick?n.g.process.nextTick:n.g.queueMicrotask?n.g.queueMicrotask:n.g.setImmediate?n.g.setImmediate:n.g.setTimeout)}function p(t,e,n,r,i){return d.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return d.deriveBits({name:"PBKDF2",salt:e,iterations:n,hash:{name:i}},t,r<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,e,i,m,g,y){"function"==typeof g&&(y=g,g=void 0);var b=l[(g=g||"sha1").toLowerCase()];if(b&&"function"==typeof n.g.Promise){if(s(i,m),t=c(t,a,"Password"),e=c(e,a,"Salt"),"function"!=typeof y)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){f()((function(){e(null,t)}))}),(function(t){f()((function(){e(t)}))}))}(function(t){if(n.g.process&&!n.g.process.browser)return Promise.resolve(!1);if(!d||!d.importKey||!d.deriveBits)return Promise.resolve(!1);if(void 0!==h[t])return h[t];var e=p(r=r||o.alloc(8),r,10,128,t).then((function(){return!0})).catch((function(){return!1}));return h[t]=e,e}(b).then((function(n){return n?p(t,e,i,m,b):u(t,e,i,m,g)})),y)}else f()((function(){var n;try{n=u(t,e,i,m,g)}catch(t){return y(t)}y(null,n)}))}},12368:(t,e,n)=>{var r,i=n(34155);r=n.g.process&&n.g.process.browser?"utf-8":n.g.process&&n.g.process.version?parseInt(i.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",t.exports=r},77357:t=>{var e=Math.pow(2,30)-1;t.exports=function(t,n){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof n)throw new TypeError("Key length not a number");if(n<0||n>e||n!=n)throw new TypeError("Bad key length")}},91257:(t,e,n)=>{var r=n(78028),i=n(79785),o=n(89072),s=n(89509).Buffer,a=n(77357),u=n(12368),c=n(57777),d=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function h(t,e,n){var a=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new i).update(t).digest()}:"md5"===t?r:function(e){return o(t).update(e).digest()}}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=a(e):e.length{var r=n(89509).Buffer;t.exports=function(t,e,n){if(r.isBuffer(t))return t;if("string"==typeof t)return r.from(t,e);if(ArrayBuffer.isView(t))return r.from(t.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")}},34155:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,u=[],c=!1,d=-1;function l(){c&&a&&(c=!1,a.length?u=a.concat(u):d=-1,u.length&&h())}function h(){if(!c){var t=s(l);c=!0;for(var e=u.length;e;){for(a=u,u=[];++d1)for(var n=1;n{e.publicEncrypt=n(16559),e.privateDecrypt=n(26138),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}},99199:(t,e,n)=>{var r=n(23482),i=n(89509).Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var n,s=i.alloc(0),a=0;s.length=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=u(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,d=n;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?d[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:d[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),d=this.clone();if(u){for(a=0;!d.isZero();a++)s=d.andln(255),d.iushrn(8),c[a]=s;for(;a=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],M=8191&k,A=k>>>13,S=0|s[5],I=8191&S,x=S>>>13,E=0|s[6],T=8191&E,P=E>>>13,B=0|s[7],L=8191&B,$=B>>>13,R=0|s[8],O=8191&R,D=R>>>13,C=0|s[9],N=8191&C,z=C>>>13,U=0|a[0],j=8191&U,Y=U>>>13,F=0|a[1],W=8191&F,H=F>>>13,K=0|a[2],q=8191&K,V=K>>>13,G=0|a[3],Z=8191&G,X=G>>>13,J=0|a[4],Q=8191&J,tt=J>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,dt=0|a[8],lt=8191&dt,ht=dt>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(l,j))|0)+((8191&(i=(i=Math.imul(l,Y))+Math.imul(h,j)|0))<<13)|0;c=((o=Math.imul(h,Y))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,j),i=(i=Math.imul(p,Y))+Math.imul(m,j)|0,o=Math.imul(m,Y);var yt=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,j),i=(i=Math.imul(y,Y))+Math.imul(b,j)|0,o=Math.imul(b,Y),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(_,j),i=(i=Math.imul(_,Y))+Math.imul(v,j)|0,o=Math.imul(v,Y),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var wt=(c+(r=r+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(M,j),i=(i=Math.imul(M,Y))+Math.imul(A,j)|0,o=Math.imul(A,Y),r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var _t=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,j),i=(i=Math.imul(I,Y))+Math.imul(x,j)|0,o=Math.imul(x,Y),r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var vt=(c+(r=r+Math.imul(l,nt)|0)|0)+((8191&(i=(i=i+Math.imul(l,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(T,j),i=(i=Math.imul(T,Y))+Math.imul(P,j)|0,o=Math.imul(P,Y),r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,st)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,j),i=(i=Math.imul(L,Y))+Math.imul($,j)|0,o=Math.imul($,Y),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Mt=(c+(r=r+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,j),i=(i=Math.imul(O,Y))+Math.imul(D,j)|0,o=Math.imul(D,Y),r=r+Math.imul(L,W)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul($,W)|0,o=o+Math.imul($,H)|0,r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(r=r+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(N,j),i=(i=Math.imul(N,Y))+Math.imul(z,j)|0,o=Math.imul(z,Y),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(L,q)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul($,q)|0,o=o+Math.imul($,V)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var St=(c+(r=r+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,W),i=(i=Math.imul(N,H))+Math.imul(z,W)|0,o=Math.imul(z,H),r=r+Math.imul(O,q)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul($,Z)|0,o=o+Math.imul($,X)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ht)|0;var It=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(N,q),i=(i=Math.imul(N,V))+Math.imul(z,q)|0,o=Math.imul(z,V),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var xt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(N,Z),i=(i=Math.imul(N,X))+Math.imul(z,Z)|0,o=Math.imul(z,X),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul($,nt)|0,o=o+Math.imul($,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Et=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,tt))+Math.imul(z,Q)|0,o=Math.imul(z,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ht)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(N,nt),i=(i=Math.imul(N,rt))+Math.imul(z,nt)|0,o=Math.imul(z,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,st)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ct)|0,r=r+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,ht)|0;var Pt=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(N,ot),i=(i=Math.imul(N,st))+Math.imul(z,ot)|0,o=Math.imul(z,st),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul($,lt)|0,o=o+Math.imul($,ht)|0;var Bt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(N,ut),i=(i=Math.imul(N,ct))+Math.imul(z,ut)|0,o=Math.imul(z,ct),r=r+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Lt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul($,pt)|0))<<13)|0;c=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(N,lt),i=(i=Math.imul(N,ht))+Math.imul(z,lt)|0,o=Math.imul(z,ht);var $t=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863;var Rt=(c+(r=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(z,pt)|0))<<13)|0;return c=((o=Math.imul(z,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=kt,u[7]=Mt,u[8]=At,u[9]=St,u[10]=It,u[11]=xt,u[12]=Et,u[13]=Tt,u[14]=Pt,u[15]=Bt,u[16]=Lt,u[17]=$t,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),o.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,e):r<63?f(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e),n},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var h=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(i,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var d=n.clone(),l=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(d),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(u)):(n.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(n.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return y[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,i),h=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var c=e.words[r],d=u-1;d>=0;d--){var l=c>>d&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,M),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=n.nmd(t),this)},26138:(t,e,n)=>{var r=n(70980),i=n(99199),o=n(57859),s=n(92144),a=n(23663),u=n(23482),c=n(84818),d=n(89509).Buffer;t.exports=function(t,e,n){var l;l=t.padding?t.padding:n?1:4;var h,f=r(t),p=f.modulus.byteLength();if(e.length>p||new s(e).cmp(f.modulus)>=0)throw new Error("decryption error");h=n?c(new s(e),f):a(e,f);var m=d.alloc(p-h.length);if(h=d.concat([m,h],p),4===l)return function(t,e){var n=t.modulus.byteLength(),r=u("sha1").update(d.alloc(0)).digest(),s=r.length;if(0!==e[0])throw new Error("decryption error");var a=e.slice(1,s+1),c=e.slice(s+1),l=o(a,i(c,s)),h=o(c,i(l,n-s-1));if(function(t,e){t=d.from(t),e=d.from(e);var n=0,r=t.length;t.length!==e.length&&(n++,r=Math.min(t.length,e.length));for(var i=-1;++i=e.length){o++;break}var s=e.slice(2,i-1);if(("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return e.slice(i)}(0,h,n);if(3===l)return h;throw new Error("unknown padding")}},16559:(t,e,n)=>{var r=n(70980),i=n(61798),o=n(23482),s=n(99199),a=n(57859),u=n(92144),c=n(84818),d=n(23663),l=n(89509).Buffer;t.exports=function(t,e,n){var h;h=t.padding?t.padding:n?1:4;var f,p=r(t);if(4===h)f=function(t,e){var n=t.modulus.byteLength(),r=e.length,c=o("sha1").update(l.alloc(0)).digest(),d=c.length,h=2*d;if(r>n-h-2)throw new Error("message too long");var f=l.alloc(n-r-h-2),p=n-d-1,m=i(d),g=a(l.concat([c,f,l.alloc(1,1),e],p),s(m,p)),y=a(m,s(g,d));return new u(l.concat([l.alloc(1),y,g],n))}(p,e);else if(1===h)f=function(t,e,n){var r,o=e.length,s=t.modulus.byteLength();if(o>s-11)throw new Error("message too long");return r=n?l.alloc(s-o-3,255):function(t){for(var e,n=l.allocUnsafe(t),r=0,o=i(2*t),s=0;r=0)throw new Error("data too long for modulus")}return n?d(f,p):c(f,p)}},84818:(t,e,n)=>{var r=n(92144),i=n(89509).Buffer;t.exports=function(t,e){return i.from(t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed().toArray())}},57859:t=>{t.exports=function(t,e){for(var n=t.length,r=-1;++r{"use strict";var r=n(34155),i=65536,o=n(89509).Buffer,s=n.g.crypto||n.g.msCrypto;s&&s.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var n=o.allocUnsafe(t);if(t>0)if(t>i)for(var a=0;a{"use strict";var r=n(34155);function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=n(89509),s=n(61798),a=o.Buffer,u=o.kMaxLength,c=n.g.crypto||n.g.msCrypto,d=Math.pow(2,32)-1;function l(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>d||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function h(t,e,n){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>d||t<0)throw new TypeError("size must be a uint32");if(t+e>n||t>u)throw new RangeError("buffer too small")}function f(t,e,n,i){if(r.browser){var o=t.buffer,a=new Uint8Array(o,e,n);return c.getRandomValues(a),i?void r.nextTick((function(){i(null,t)})):t}if(!i)return s(n).copy(t,e),t;s(n,(function(n,r){if(n)return i(n);r.copy(t,e),i(null,t)}))}c&&c.getRandomValues||!r.browser?(e.randomFill=function(t,e,r,i){if(!(a.isBuffer(t)||t instanceof n.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)i=e,e=0,r=t.length;else if("function"==typeof r)i=r,r=t.length-e;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return l(e,t.length),h(r,e,t.length),f(t,e,r,i)},e.randomFillSync=function(t,e,r){if(void 0===e&&(e=0),!(a.isBuffer(t)||t instanceof n.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return l(e,t.length),void 0===r&&(r=t.length-e),h(r,e,t.length),f(t,e,r)}):(e.randomFill=i,e.randomFillSync=i)},99353:(t,e,n)=>{t.exports=n(71846)},71846:(t,e,n)=>{var r=n(41960);e.operation=function(t){var n=e.timeouts(t);return new r(n,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],i=0;i{function e(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){n._operationTimeoutCb()}),n._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},e.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},e.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,n=0,r=0;r=n&&(e=i,n=s)}return e}},79785:(t,e,n)=>{"use strict";var r=n(48764).Buffer,i=n(35717),o=n(3349),s=new Array(16),a=[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],u=[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],c=[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],d=[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],l=[0,1518500249,1859775393,2400959708,2840853838],h=[1352829926,1548603684,1836072691,2053994217,0];function f(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function m(t,e,n,r,i,o,s,a){return p(t+(e^n^r)+o+s|0,a)+i|0}function g(t,e,n,r,i,o,s,a){return p(t+(e&n|~e&r)+o+s|0,a)+i|0}function y(t,e,n,r,i,o,s,a){return p(t+((e|~n)^r)+o+s|0,a)+i|0}function b(t,e,n,r,i,o,s,a){return p(t+(e&r|n&~r)+o+s|0,a)+i|0}function w(t,e,n,r,i,o,s,a){return p(t+(e^(n|~r))+o+s|0,a)+i|0}i(f,o),f.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,f=0|this._e,_=0|this._a,v=0|this._b,k=0|this._c,M=0|this._d,A=0|this._e,S=0;S<80;S+=1){var I,x;S<16?(I=m(n,r,i,o,f,t[a[S]],l[0],c[S]),x=w(_,v,k,M,A,t[u[S]],h[0],d[S])):S<32?(I=g(n,r,i,o,f,t[a[S]],l[1],c[S]),x=b(_,v,k,M,A,t[u[S]],h[1],d[S])):S<48?(I=y(n,r,i,o,f,t[a[S]],l[2],c[S]),x=y(_,v,k,M,A,t[u[S]],h[2],d[S])):S<64?(I=b(n,r,i,o,f,t[a[S]],l[3],c[S]),x=g(_,v,k,M,A,t[u[S]],h[3],d[S])):(I=w(n,r,i,o,f,t[a[S]],l[4],c[S]),x=m(_,v,k,M,A,t[u[S]],h[4],d[S])),n=f,f=o,o=p(i,10),i=r,r=I,_=A,A=M,M=p(k,10),k=v,v=x}var E=this._b+i+M|0;this._b=this._c+o+A|0,this._c=this._d+f+_|0,this._d=this._e+n+v|0,this._e=this._a+r+k|0,this._a=E},f.prototype._digest=function(){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 t=r.alloc?r.alloc(20):new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=f},66855:(t,e,n)=>{"use strict";var r=n(48764).Buffer;const i=n(26729),o=n(70395);class s extends i.EventEmitter{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(t,e="ws://localhost:8080",{autoconnect:n=!0,reconnect:r=!0,reconnect_interval:i=1e3,max_reconnects:s=5,...a}={},u,c){super(),this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=e,this.autoconnect=n,this.ready=!1,this.reconnect=r,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=s,this.rest_options=a,this.current_reconnects=0,this.generate_request_id=u||(()=>++this.rpc_id),this.dataPack=c||new o.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,e,n,r){return r||"object"!=typeof n||(r=n,n=null),new Promise(((i,o)=>{if(!this.ready)return o(new Error("socket not ready"));const s=this.generate_request_id(t,e),a={jsonrpc:"2.0",method:t,params:e||void 0,id:s};this.socket.send(this.dataPack.encode(a),r,(t=>{if(t)return o(t);this.queue[s]={promise:[i,o]},n&&(this.queue[s].timeout=setTimeout((()=>{delete this.queue[s],o(new Error("reply timeout"))}),n))}))}))}async login(t){const e=await this.call("rpc.login",t);if(!e)throw new Error("authentication failed");return e}async listMethods(){return await this.call("__listMethods")}notify(t,e){return new Promise(((n,r)=>{if(!this.ready)return r(new Error("socket not ready"));const i={jsonrpc:"2.0",method:t,params:e};this.socket.send(this.dataPack.encode(i),(t=>{if(t)return r(t);n()}))}))}async subscribe(t){"string"==typeof t&&(t=[t]);const e=await this.call("rpc.on",t);if("string"==typeof t&&"ok"!==e[t])throw new Error("Failed subscribing to an event '"+t+"' with: "+e[t]);return e}async unsubscribe(t){"string"==typeof t&&(t=[t]);const e=await this.call("rpc.off",t);if("string"==typeof t&&"ok"!==e[t])throw new Error("Failed unsubscribing from an event with: "+e);return e}close(t,e){this.socket.close(t||1e3,e)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}_connect(t,e){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0})),this.socket.addEventListener("message",(({data:t})=>{t instanceof ArrayBuffer&&(t=r.from(t).toString());try{t=this.dataPack.decode(t)}catch(t){return}if(t.notification&&this.listeners(t.notification).length){if(!Object.keys(t.params).length)return this.emit(t.notification);const e=[t.notification];if(t.params.constructor===Object)e.push(t.params);else for(let n=0;n{this.emit.apply(this,e)}))}if(!this.queue[t.id])return t.method?Promise.resolve().then((()=>{this.emit(t.method,t?.params)})):void 0;"error"in t=="result"in t&&this.queue[t.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[t.id].timeout&&clearTimeout(this.queue[t.id].timeout),t.error?this.queue[t.id].promise[1](t.error):this.queue[t.id].promise[0](t.result),delete this.queue[t.id]})),this.socket.addEventListener("error",(t=>this.emit("error",t))),this.socket.addEventListener("close",(({code:n,reason:r})=>{this.ready&&setTimeout((()=>this.emit("close",n,r)),0),this.ready=!1,this.socket=void 0,1e3!==n&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)&&(this.reconnect_timer_id=setTimeout((()=>this._connect(t,e)),this.reconnect_interval)))}))}}e.Z=s},89062:(t,e,n)=>{"use strict";const r=n(26729);class i extends r.EventEmitter{socket;constructor(t,e,n){super(),this.socket=new window.WebSocket(t,n),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=t=>this.emit("message",t.data),this.socket.onerror=t=>this.emit("error",t),this.socket.onclose=t=>{this.emit("close",t.code,t.reason)}}send(t,e,n){const r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}close(t,e){this.socket.close(t,e)}addEventListener(t,e,n){this.socket.addEventListener(t,e,n)}}e.Z=function(t,e){return new i(t,e)}},70395:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createError=e.DefaultDataPack=void 0;const n=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]);e.DefaultDataPack=class{encode(t){return JSON.stringify(t)}decode(t){return JSON.parse(t)}},e.createError=function(t,e){const r={code:t,message:n.get(t)||"Internal Server Error"};return e&&(r.data=e),r}},89509:(t,e,n)=>{var r=n(48764),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},2399:(t,e,n)=>{"use strict";var r,i=n(34155),o=n(48764),s=o.Buffer,a={};for(r in o)o.hasOwnProperty(r)&&"SlowBuffer"!==r&&"Buffer"!==r&&(a[r]=o[r]);var u=a.Buffer={};for(r in s)s.hasOwnProperty(r)&&"allocUnsafe"!==r&&"allocUnsafeSlow"!==r&&(u[r]=s[r]);if(a.Buffer.prototype=s.prototype,u.from&&u.from!==Uint8Array.from||(u.from=function(t,e,n){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return s(t,e,n)}),u.alloc||(u.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=s(t);return e&&0!==e.length?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r}),!a.kStringMaxLength)try{a.kStringMaxLength=i.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a},24189:(t,e,n)=>{var r=n(89509).Buffer;function i(t,e){this._block=r.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=r.from(t,e));for(var n=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},89072:(t,e,n)=>{var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=n(74448),r.sha1=n(18336),r.sha224=n(48432),r.sha256=n(67499),r.sha384=n(51686),r.sha512=n(87816)},74448:(t,e,n)=>{var r=n(35717),i=n(24189),o=n(89509).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t){return t<<30|t>>>2}function d(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,l=0;l<16;++l)n[l]=t.readInt32BE(4*l);for(;l<80;++l)n[l]=n[l-3]^n[l-8]^n[l-14]^n[l-16];for(var h=0;h<80;++h){var f=~~(h/20),p=0|((e=r)<<5|e>>>27)+d(f,i,o,a)+u+n[h]+s[f];u=a,a=o,o=c(i),i=r,r=p}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},18336:(t,e,n)=>{var r=n(35717),i=n(24189),o=n(89509).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function d(t){return t<<30|t>>>2}function l(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,h=0;h<16;++h)n[h]=t.readInt32BE(4*h);for(;h<80;++h)n[h]=(e=n[h-3]^n[h-8]^n[h-14]^n[h-16])<<1|e>>>31;for(var f=0;f<80;++f){var p=~~(f/20),m=c(r)+l(p,i,o,a)+u+n[f]+s[p]|0;u=a,a=o,o=d(i),i=r,r=m}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},48432:(t,e,n)=>{var r=n(35717),i=n(67499),o=n(24189),s=n(89509).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}r(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},67499:(t,e,n)=>{var r=n(35717),i=n(24189),o=n(89509).Buffer,s=[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],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t,e,n){return n^t&(e^n)}function d(t,e,n){return t&e|n&(t|e)}function l(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function h(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function f(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}r(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)n[y]=t.readInt32BE(4*y);for(;y<64;++y)n[y]=0|(((e=n[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+n[y-7]+f(n[y-15])+n[y-16];for(var b=0;b<64;++b){var w=g+h(u)+c(u,p,m)+s[b]+n[b]|0,_=l(r)+d(r,i,o)|0;g=m,m=p,p=u,u=a+w|0,a=o,o=i,i=r,r=w+_|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},51686:(t,e,n)=>{var r=n(35717),i=n(87816),o=n(24189),s=n(89509).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}r(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},87816:(t,e,n)=>{var r=n(35717),i=n(24189),o=n(89509).Buffer,s=[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],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function c(t,e,n){return n^t&(e^n)}function d(t,e,n){return t&e|n&(t|e)}function l(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function h(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0>>0?1:0}r(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,w=0|this._hh,_=0|this._al,v=0|this._bl,k=0|this._cl,M=0|this._dl,A=0|this._el,S=0|this._fl,I=0|this._gl,x=0|this._hl,E=0;E<32;E+=2)e[E]=t.readInt32BE(4*E),e[E+1]=t.readInt32BE(4*E+4);for(;E<160;E+=2){var T=e[E-30],P=e[E-30+1],B=f(T,P),L=p(P,T),$=m(T=e[E-4],P=e[E-4+1]),R=g(P,T),O=e[E-14],D=e[E-14+1],C=e[E-32],N=e[E-32+1],z=L+D|0,U=B+O+y(z,L)|0;U=(U=U+$+y(z=z+R|0,R)|0)+C+y(z=z+N|0,N)|0,e[E]=U,e[E+1]=z}for(var j=0;j<160;j+=2){U=e[j],z=e[j+1];var Y=d(n,r,i),F=d(_,v,k),W=l(n,_),H=l(_,n),K=h(a,A),q=h(A,a),V=s[j],G=s[j+1],Z=c(a,u,b),X=c(A,S,I),J=x+q|0,Q=w+K+y(J,x)|0;Q=(Q=(Q=Q+Z+y(J=J+X|0,X)|0)+V+y(J=J+G|0,G)|0)+U+y(J=J+z|0,z)|0;var tt=H+F|0,et=W+Y+y(tt,H)|0;w=b,x=I,b=u,I=S,u=a,S=A,a=o+Q+y(A=M+J|0,M)|0,o=i,M=k,i=r,k=v,r=n,v=_,n=Q+et+y(_=J+tt|0,J)|0}this._al=this._al+_|0,this._bl=this._bl+v|0,this._cl=this._cl+k|0,this._dl=this._dl+M|0,this._el=this._el+A|0,this._fl=this._fl+S|0,this._gl=this._gl+I|0,this._hl=this._hl+x|0,this._ah=this._ah+n+y(this._al,_)|0,this._bh=this._bh+r+y(this._bl,v)|0,this._ch=this._ch+i+y(this._cl,k)|0,this._dh=this._dh+o+y(this._dl,M)|0,this._eh=this._eh+a+y(this._el,A)|0,this._fh=this._fh+u+y(this._fl,S)|0,this._gh=this._gh+b+y(this._gl,I)|0,this._hh=this._hh+w+y(this._hl,x)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},42830:(t,e,n)=>{t.exports=i;var r=n(17187).EventEmitter;function i(){r.call(this)}n(35717)(i,r),i.Readable=n(56577),i.Writable=n(20323),i.Duplex=n(68656),i.Transform=n(94473),i.PassThrough=n(2366),i.finished=n(81086),i.pipeline=n(56472),i.Stream=i,i.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",a),n.on("close",u));var s=!1;function a(){s||(s=!0,t.end())}function u(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(d(),0===r.listenerCount(this,"error"))throw t}function d(){n.removeListener("data",i),t.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",u),n.removeListener("error",c),t.removeListener("error",c),n.removeListener("end",d),n.removeListener("close",d),t.removeListener("close",d)}return n.on("error",c),t.on("error",c),n.on("end",d),n.on("close",d),t.on("close",d),t.emit("pipe",n),t}},58106:t=>{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,4)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-9,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var c=("number"!=typeof u&&(u=0),u+1>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(r(e,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},68656:(t,e,n)=>{"use strict";var r=n(34155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=d;var o=n(56577),s=n(20323);n(35717)(d,o);for(var a=i(s.prototype),u=0;u{"use strict";t.exports=i;var r=n(94473);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(35717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},56577:(t,e,n)=>{"use strict";var r,i=n(34155);t.exports=S,S.ReadableState=A,n(17187).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=n(83194),u=n(48764).Buffer,c=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=n(40964);o=d&&d.debuglog?d.debuglog("stream"):function(){};var l,h,f,p=n(39686),m=n(71029),g=n(13383).getHighWaterMark,y=n(58106).q,b=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(35717)(S,a);var k=m.errorOrDestroy,M=["error","close","destroy","pause","resume"];function A(t,e,i){r=r||n(68656),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(54729).s),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function S(t){if(r=r||n(68656),!(this instanceof S))return new S(t);var e=this instanceof r;this._readableState=new A(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function I(t,e,n,r,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(i||(s=function(t,e){var n,r;return r=e,u.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],e)),n}(a,e)),s)k(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r)a.endEmitted?k(t,new v):x(t,a,e,!0);else if(a.ended)k(t,new w);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):L(t,a)):x(t,a,e,!1)}else r||(a.reading=!1,L(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function P(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(B,t))}function B(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function L(t,e){e.readingMore||(e.readingMore=!0,i.nextTick($,t,e))}function $(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function z(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function j(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?z(this):P(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&z(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&z(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(t){k(this,new _("_read()"))},S.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?m:u;function u(){o("onend"),t.end()}r.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",f),t.removeListener("finish",p),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",e),n.removeListener("end",u),n.removeListener("end",m),n.removeListener("data",l),d=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(n);t.on("drain",c);var d=!1;function l(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==j(r.pipes,t))&&!d&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function h(e){o("onerror",e),m(),t.removeListener("error",h),0===s(t,"error")&&k(t,e)}function f(){t.removeListener("finish",p),m()}function p(){o("onfinish"),t.removeListener("close",f),m()}function m(){o("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",h),t.once("close",f),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?P(this):r.reading||i.nextTick(O,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(R,this),n},S.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(R,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(D,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s{"use strict";t.exports=d;var r=n(58106).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(68656);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var r,i=n(34155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=S,S.WritableState=A;var s,a={deprecate:n(94927)},u=n(83194),c=n(48764).Buffer,d=(void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=n(71029),h=n(13383).getHighWaterMark,f=n(58106).q,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,w=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,v=f.ERR_UNKNOWN_ENCODING,k=l.errorOrDestroy;function M(){}function A(t,e,s){r=r||n(68656),t=t||{},"boolean"!=typeof s&&(s=e instanceof r),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(B,t,e),t._writableState.errorEmitted=!0,k(t,r)):(o(r),t._writableState.errorEmitted=!0,k(t,r),B(t,e))}(t,n,r,e,o);else{var s=T(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(t,n),r?i.nextTick(x,t,n,s,o):x(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function S(t){var e=this instanceof(r=r||n(68656));if(!e&&!s.call(S,this))return new S(t);this._writableState=new A(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function I(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function x(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),B(t,e)}function E(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,I(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,d=n.encoding,l=n.callback;if(I(t,e,!1,e.objectMode?1:c.length,c,d,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(n){e.pendingcb--,n&&k(t,n),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var n=T(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(35717)(S,u),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===S&&t&&t._writableState instanceof A}})):s=function(t){return t instanceof this},S.prototype.pipe=function(){k(this,new y)},S.prototype.write=function(t,e,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=t,c.isBuffer(r)||r instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=M),o.ending?function(t,e){var n=new _;k(t,n),i.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o;return null===n?o=new w:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(k(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,n){n(new m("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,B(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(t,e){e(t)}},20828:(t,e,n)=>{"use strict";var r,i=n(34155);function o(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=n(81086),a=Symbol("lastResolve"),u=Symbol("lastReject"),c=Symbol("error"),d=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(t,e){return{value:t,done:e}}function m(t){var e=t[a];if(null!==e){var n=t[f].read();null!==n&&(t[l]=null,t[a]=null,t[u]=null,e(p(n,!1)))}}function g(t){i.nextTick(m,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(r={get stream(){return this[f]},next:function(){var t=this,e=this[c];if(null!==e)return Promise.reject(e);if(this[d])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[c]?n(t[c]):e(p(void 0,!0))}))}));var n,r=this[l];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[d]?n(p(void 0,!0)):e[h](n,r)}),r)}}(r,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),y);t.exports=function(t){var e,n=Object.create(b,(o(e={},f,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,c,{value:null,writable:!0}),o(e,d,{value:t._readableState.endEmitted,writable:!0}),o(e,h,{value:function(t,e){var r=n[f].read();r?(n[l]=null,n[a]=null,n[u]=null,t(p(r,!1))):(n[a]=t,n[u]=e)},writable:!0}),e));return n[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[u];return null!==e&&(n[l]=null,n[a]=null,n[u]=null,e(t)),void(n[c]=t)}var r=n[a];null!==r&&(n[l]=null,n[a]=null,n[u]=null,r(p(void 0,!0))),n[d]=!0})),t.on("readable",g.bind(null,n)),n}},39686:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return u.alloc(0);for(var e,n,r,i=u.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,u.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=u.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:d,value:function(t,e){return c(this,i(i({},e),{},{depth:0,customInspect:!1}))}}])&&s(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},71029:(t,e,n)=>{"use strict";var r=n(34155);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(s,this,t)):r.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},81086:(t,e,n)=>{"use strict";var r=n(58106).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},56472:(t,e,n)=>{"use strict";var r,i=n(58106).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t){t()}function c(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),i=0;i0,(function(t){d||(d=t),t&&h.forEach(u),o||(h.forEach(u),l(d))}))}));return e.reduce(c)}},13383:(t,e,n)=>{"use strict";var r=n(58106).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},83194:(t,e,n)=>{t.exports=n(17187).EventEmitter},54729:(t,e,n)=>{"use strict";var r=n(89509).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=d,this.end=l,e=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function d(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},6941:(t,e,n)=>{var r=n(48764).Buffer,i=r.isEncoding||function(t){switch(t&&t.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}},o=e.s=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!i(t))throw new Error("Unknown encoding: "+t)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=u;break;default:return void(this.write=s)}this.charBuffer=new r(6),this.charReceived=0,this.charLength=0};function s(t){return t.toString(this.encoding)}function a(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function u(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}o.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r,i=t.length;if(this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),i=(e+=t.toString(this.encoding,0,i)).length-1,(r=e.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,i)}return e},o.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},o.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},26018:t=>{"use strict";t.exports=function(t,e){if(!t)throw new Error("Invariant failed")}},94927:(t,e,n)=>{function r(t){try{if(!n.g.localStorage)return!1}catch(t){return!1}var e=n.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}},74608:(t,e,n)=>{"use strict";var r;n.d(e,{v4:()=>d});var i=new Uint8Array(16);function o(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var a=[],u=0;u<256;++u)a.push((u+256).toString(16).substr(1));const c=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(a[t[e+0]]+a[t[e+1]]+a[t[e+2]]+a[t[e+3]]+"-"+a[t[e+4]]+a[t[e+5]]+"-"+a[t[e+6]]+a[t[e+7]]+"-"+a[t[e+8]]+a[t[e+9]]+"-"+a[t[e+10]]+a[t[e+11]]+a[t[e+12]]+a[t[e+13]]+a[t[e+14]]+a[t[e+15]]).toLowerCase();if(!function(t){return"string"==typeof t&&s.test(t)}(n))throw TypeError("Stringified UUID is invalid");return n},d=function(t,e,n){var r=(t=t||{}).random||(t.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return c(r)}},80950:()=>{},46601:()=>{},89214:()=>{},96419:()=>{},56353:()=>{},8623:()=>{},7748:()=>{},85568:()=>{},69386:()=>{},31616:()=>{},56619:()=>{},77108:()=>{},69862:()=>{},40964:()=>{},66115:t=>{t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports},17156:t=>{function e(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function a(t){e(s,i,o,a,u,"next",t)}function u(t){e(s,i,o,a,u,"throw",t)}a(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},56690:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},89728:(t,e,n)=>{var r=n(64062);function i(t,e){for(var n=0;n{function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},61655:(t,e,n)=>{var r=n(6015);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&r(t,e)},t.exports.__esModule=!0,t.exports.default=t.exports},64836:t=>{t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},94993:(t,e,n)=>{var r=n(18698).default,i=n(66115);t.exports=function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return i(t)},t.exports.__esModule=!0,t.exports.default=t.exports},17061:(t,e,n)=>{var r=n(18698).default;function i(){"use strict";t.exports=i=function(){return n},t.exports.__esModule=!0,t.exports.default=t.exports;var e,n={},o=Object.prototype,s=o.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",d=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function h(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(e){h=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof _?e:_,o=Object.create(i.prototype),s=new $(r||[]);return a(o,"_invoke",{value:T(t,n,s)}),o}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=f;var m="suspendedStart",g="suspendedYield",y="executing",b="completed",w={};function _(){}function v(){}function k(){}var M={};h(M,c,(function(){return this}));var A=Object.getPrototypeOf,S=A&&A(A(R([])));S&&S!==o&&s.call(S,c)&&(M=S);var I=k.prototype=_.prototype=Object.create(M);function x(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,a,u){var c=p(t[i],t,o);if("throw"!==c.type){var d=c.arg,l=d.value;return l&&"object"==r(l)&&s.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){d.value=t,a(d)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(o,o):o()}})}function T(t,n,r){var i=m;return function(o,s){if(i===y)throw new Error("Generator is already running");if(i===b){if("throw"===o)throw s;return{value:e,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=P(a,r);if(u){if(u===w)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===m)throw i=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=y;var c=p(t,n,r);if("normal"===c.type){if(i=r.done?b:g,c.arg===w)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=b,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),w;var o=p(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,w;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,w):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,w)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function $(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function R(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(u&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),w}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),w}},n}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},6015:t=>{function e(n,r){return t.exports=e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n,r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},95036:(t,e,n)=>{var r=n(18698).default;t.exports=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},64062:(t,e,n)=>{var r=n(18698).default,i=n(95036);t.exports=function(t){var e=i(t,"string");return"symbol"==r(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},18698:t=>{function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},64687:(t,e,n)=>{var r=n(17061)();t.exports=r;try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},26578:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encodeDecode=void 0,e.encodeDecode=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)})},80802:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.u256be=e.u256=e.u192be=e.u192=e.u128be=e.u128=e.u64be=e.u64=e.bigIntBE=e.bigInt=void 0;const i=n(39386),o=n(40475),s=n(26578);e.bigInt=t=>e=>{const n=(0,i.blob)(t,e),{encode:a,decode:u}=(0,s.encodeDecode)(n),c=n;return c.decode=(t,e)=>{const n=u(t,e);return(0,o.toBigIntLE)(r.from(n))},c.encode=(e,n,r)=>{const i=(0,o.toBufferLE)(e,t);return a(i,n,r)},c},e.bigIntBE=t=>e=>{const n=(0,i.blob)(t,e),{encode:a,decode:u}=(0,s.encodeDecode)(n),c=n;return c.decode=(t,e)=>{const n=u(t,e);return(0,o.toBigIntBE)(r.from(n))},c.encode=(e,n,r)=>{const i=(0,o.toBufferBE)(e,t);return a(i,n,r)},c},e.u64=(0,e.bigInt)(8),e.u64be=(0,e.bigIntBE)(8),e.u128=(0,e.bigInt)(16),e.u128be=(0,e.bigIntBE)(16),e.u192=(0,e.bigInt)(24),e.u192be=(0,e.bigIntBE)(24),e.u256=(0,e.bigInt)(32),e.u256be=(0,e.bigIntBE)(32)},54195:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.decimal=e.WAD=void 0;const i=r(n(44431)),o=n(26578),s=n(80802);e.WAD=new i.default("1e+18"),e.decimal=t=>{const n=(0,s.u128)(t),{encode:r,decode:a}=(0,o.encodeDecode)(n),u=n;return u.decode=(t,n)=>{const r=a(t,n).toString();return new i.default(r).div(e.WAD)},u.encode=(t,n,i)=>{const o=BigInt(t.times(e.WAD).integerValue().toString());return r(o,n,i)},u}},27278:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(26578),e),i(n(80802),e),i(n(54195),e),i(n(48670),e),i(n(62885),e)},48670:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bool=void 0;const r=n(39386),i=n(26578);e.bool=t=>{const e=(0,r.u8)(t),{encode:n,decode:o}=(0,i.encodeDecode)(e),s=e;return s.decode=(t,e)=>!!o(t,e),s.encode=(t,e,r)=>{const i=Number(t);return n(i,e,r)},s}},62885:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.publicKey=void 0;const r=n(39386),i=n(68716),o=n(26578);e.publicKey=t=>{const e=(0,r.blob)(32,t),{encode:n,decode:s}=(0,o.encodeDecode)(e),a=e;return a.decode=(t,e)=>{const n=s(t,e);return new i.PublicKey(n)},a.encode=(t,e,r)=>{const i=t.toBuffer();return n(i,e,r)},a}},21433:(t,e)=>{"use strict";function n(t,e,n,r=0){const i=n.length-r;if(i{if(t.length>=e)return t;const n=new Uint8Array(e).fill(0);return n.set(t),n},i=(t,e)=>r(t.length<=e?t:t.slice(0,e),e);function o(t,e){return"fixedSize"in e?e.fixedSize:e.getSizeFromValue(t)}function s(t){return Object.freeze({...t,encode:e=>{const n=new Uint8Array(o(e,t));return t.write(e,n,0),n}})}function a(t){return Object.freeze({...t,decode:(e,n=0)=>t.read(e,n)[0]})}function u(t){return Object.freeze({...t,decode:(e,n=0)=>t.read(e,n)[0],encode:e=>{const n=new Uint8Array(o(e,t));return t.write(e,n,0),n}})}function c(t){return"fixedSize"in t&&"number"==typeof t.fixedSize}function d(t,e){if(!c(t))throw new Error(e??"Expected a fixed-size codec, got a variable-size one.")}function l(t){return!c(t)}function h(t,e){if(c(t)!==c(e))throw new Error("Encoder and decoder must either both be fixed-size or variable-size.");if(c(t)&&c(e)&&t.fixedSize!==e.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${t.fixedSize}] and [${e.fixedSize}].`);if(!c(t)&&!c(e)&&t.maxSize!==e.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${t.maxSize}] and [${e.maxSize}].`);return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}}function f(t,e){return s({fixedSize:e,write:(n,r,i)=>{const o=t.encode(n),s=o.length>e?o.slice(0,e):o;return r.set(s,i),i+e}})}function p(t,e){return a({fixedSize:e,read:(r,o)=>{n("fixCodec",e,r,o),(o>0||r.length>e)&&(r=r.slice(o,o+e)),c(t)&&(r=i(r,t.fixedSize));const[s]=t.read(r,0);return[s,o+e]}})}function m(t,e){return s({...l(t)?{...t,getSizeFromValue:n=>t.getSizeFromValue(e(n))}:t,write:(n,r,i)=>t.write(e(n),r,i)})}function g(t,e){return a({...t,read:(n,r)=>{const[i,o]=t.read(n,r);return[e(i,n,r),o]}})}function y(t){return d(t,"Cannot reverse a codec of variable size."),s({...t,write:(e,n,r)=>{const i=t.write(e,n,r),o=n.slice(r,r+t.fixedSize).reverse();return n.set(o,r),i}})}function b(t){return d(t,"Cannot reverse a codec of variable size."),a({...t,read:(e,n)=>{const r=n+t.fixedSize;if(0===n&&e.length===r)return t.read(e.reverse(),n);const i=e.slice();return i.set(e.slice(n,r).reverse(),n),t.read(i,n)}})}e.assertByteArrayHasEnoughBytesForCodec=n,e.assertByteArrayIsNotEmptyForCodec=function(t,e,n=0){if(e.length-n<=0)throw new Error(`Codec [${t}] cannot decode empty byte arrays.`)},e.assertIsFixedSize=d,e.assertIsVariableSize=function(t,e){if(!l(t))throw new Error(e??"Expected a variable-size codec, got a fixed-size one.")},e.combineCodec=h,e.createCodec=u,e.createDecoder=a,e.createEncoder=s,e.fixBytes=i,e.fixCodec=function(t,e){return h(f(t,e),p(t,e))},e.fixDecoder=p,e.fixEncoder=f,e.getEncodedSize=o,e.isFixedSize=c,e.isVariableSize=l,e.mapCodec=function(t,e,n){return u({...m(t,e),read:n?g(t,n).read:t.read})},e.mapDecoder=g,e.mapEncoder=m,e.mergeBytes=t=>{const e=t.filter((t=>t.length));if(0===e.length)return t.length?t[0]:new Uint8Array;if(1===e.length)return e[0];const n=e.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(n);let i=0;return e.forEach((t=>{r.set(t,i),i+=t.length})),r},e.padBytes=r,e.reverseCodec=function(t){return h(y(t),b(t))},e.reverseDecoder=b,e.reverseEncoder=y},53149:(t,e,n)=>{"use strict";var r=n(21433),i=n(2638);function o(t,e,n){if(e!==n)throw new Error(`Expected [${t}] to have ${e} items, got ${n}.`)}function s(t){return t.reduce(((t,e)=>null===t||null===e?null:t+e),0)}function a(t){return r.isFixedSize(t)?t.fixedSize:null}function u(t){return r.isFixedSize(t)?t.fixedSize:t.maxSize??null}function c(t,e={}){const n=e.size??i.getU32Encoder();"remainder"===n&&r.assertIsFixedSize(t,'Codecs of "remainder" size must have fixed-size items.');const s=l(n,a(t)),c=l(n,u(t))??void 0;return r.createEncoder({...null!==s?{fixedSize:s}:{getSizeFromValue:e=>("object"==typeof n?r.getEncodedSize(e.length,n):0)+[...e].reduce(((e,n)=>e+r.getEncodedSize(n,t)),0),maxSize:c},write:(e,r,i)=>("number"==typeof n&&o("array",n,e.length),"object"==typeof n&&(i=n.write(e.length,r,i)),e.forEach((e=>{i=t.write(e,r,i)})),i)})}function d(t,e={}){const n=e.size??i.getU32Decoder();"remainder"===n&&r.assertIsFixedSize(t,'Codecs of "remainder" size must have fixed-size items.');const o=a(t),s=l(n,o),c=l(n,u(t))??void 0;return r.createDecoder({...null!==s?{fixedSize:s}:{maxSize:c},read:(e,r)=>{const i=[];if("object"==typeof n&&0===e.slice(r).length)return[i,r];const[s,a]=function(t,e,n,r){if("number"==typeof t)return[t,r];if("object"==typeof t)return t.read(n,r);if("remainder"===t){if(null===e)throw new Error('Codecs of "remainder" size must have fixed-size items.');const t=Math.max(0,n.length-r);if(t%e!=0)throw new Error(`The remainder of the byte array (${t} bytes) cannot be split into chunks of ${e} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${t} modulo ${e} should be equal to zero.`);return[t/e,r]}throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(t)}`)}(n,o,e,r);r=a;for(let n=0;n{for(let e=0;e<8;e+=1)n?(o.push(Boolean(1&t)),t>>=1):(o.push(Boolean(128&t)),t<<=1)})),[o,i+t]}})}function p(t={}){const e=t.size??i.getU8Encoder();return r.assertIsFixedSize(e,"Codec [bool] requires a fixed size."),r.mapEncoder(e,(t=>t?1:0))}function m(t={}){const e=t.size??i.getU8Decoder();return r.assertIsFixedSize(e,"Codec [bool] requires a fixed size."),r.mapDecoder(e,(t=>1===Number(t)))}function g(t={}){const e=t.size??"variable",n=r.createEncoder({getSizeFromValue:t=>t.length,write:(t,e,n)=>(e.set(t,n),n+t.length)});return"variable"===e?n:"number"==typeof e?r.fixEncoder(n,e):r.createEncoder({getSizeFromValue:t=>r.getEncodedSize(t.length,e)+t.length,write:(t,r,i)=>(i=e.write(t.length,r,i),n.write(t,r,i))})}function y(t={}){const e=t.size??"variable",n=r.createDecoder({read:(t,e)=>{const n=t.slice(e);return[n,e+n.length]}});return"variable"===e?n:"number"==typeof e?r.fixDecoder(n,e):r.createDecoder({read:(t,i)=>{r.assertByteArrayIsNotEmptyForCodec("bytes",t,i);const[o,s]=e.read(t,i),a=Number(o);i=s;const u=t.slice(i,i+a);r.assertByteArrayHasEnoughBytesForCodec("bytes",a,u);const[c,d]=n.read(u,0);return[c,i+=d]}})}function b(t,e={}){const n=e.size??i.getU8Encoder(),o=_(t,n);return r.createEncoder({...null!==o?{fixedSize:o}:{getSizeFromValue:e=>{const i=k(t,e),o=t[i][1];return r.getEncodedSize(i,n)+r.getEncodedSize(e,o)},maxSize:v(t,n)},write:(e,r,i)=>{const o=k(t,e);return i=n.write(o,r,i),t[o][1].write(e,r,i)}})}function w(t,e={}){const n=e.size??i.getU8Decoder(),o=_(t,n);return r.createDecoder({...null!==o?{fixedSize:o}:{maxSize:v(t,n)},read:(e,i)=>{r.assertByteArrayIsNotEmptyForCodec("dataEnum",e,i);const[o,s]=n.read(e,i);i=s;const a=t[Number(o)]??null;if(!a)throw new Error(`Enum discriminator out of range. Expected a number between 0 and ${t.length-1}, got ${o}.`);const[u,c]=a[1].read(e,i);return i=c,[{__kind:a[0],...u??{}},i]}})}function _(t,e){if(0===t.length)return r.isFixedSize(e)?e.fixedSize:null;if(!r.isFixedSize(t[0][1]))return null;const n=t[0][1].fixedSize;return t.every((t=>r.isFixedSize(t[1])&&t[1].fixedSize===n))&&r.isFixedSize(e)?e.fixedSize+n:null}function v(t,e){const n=t.map((([,t])=>u(t))).reduce(((t,e)=>null===t||null===e?null:Math.max(t,e)),0);return s([u(e),n])??void 0}function k(t,e){const n=t.findIndex((([t])=>e.__kind===t));if(n<0)throw new Error(`Invalid data enum variant. Expected one of [${t.map((([t])=>t)).join(", ")}], got "${e.__kind}".`);return n}function M(t){const e=s(t.map(a)),n=s(t.map(u))??void 0;return r.createEncoder({...null===e?{getSizeFromValue:e=>t.map(((t,n)=>r.getEncodedSize(e[n],t))).reduce(((t,e)=>t+e),0),maxSize:n}:{fixedSize:e},write:(e,n,r)=>(o("tuple",t.length,e.length),t.forEach(((t,i)=>{r=t.write(e[i],n,r)})),r)})}function A(t){const e=s(t.map(a)),n=s(t.map(u))??void 0;return r.createDecoder({...null===e?{maxSize:n}:{fixedSize:e},read:(e,n)=>{const r=[];return t.forEach((t=>{const[i,o]=t.read(e,n);r.push(i),n=o})),[r,n]}})}function S(t,e,n={}){return r.mapEncoder(c(M([t,e]),n),(t=>[...t.entries()]))}function I(t,e,n={}){return r.mapDecoder(d(A([t,e]),n),(t=>new Map(t)))}function x(t,e={}){const n=e.prefix??i.getU8Encoder(),o=e.fixed??!1,a=r.isFixedSize(t)&&r.isFixedSize(n)&&0===t.fixedSize;if(o||a){r.assertIsFixedSize(t,"Fixed nullables can only be used with fixed-size codecs."),r.assertIsFixedSize(n,"Fixed nullables can only be used with fixed-size prefix.");const e=n.fixedSize+t.fixedSize;return r.createEncoder({fixedSize:e,write:(r,i,o)=>{const s=n.write(Number(null!==r),i,o);return null!==r&&t.write(r,i,s),o+e}})}return r.createEncoder({getSizeFromValue:e=>r.getEncodedSize(Number(null!==e),n)+(null!==e?r.getEncodedSize(e,t):0),maxSize:s([n,t].map(u))??void 0,write:(e,r,i)=>(i=n.write(Number(null!==e),r,i),null!==e&&(i=t.write(e,r,i)),i)})}function E(t,e={}){const n=e.prefix??i.getU8Decoder(),o=e.fixed??!1;let a=null;const c=r.isFixedSize(t)&&r.isFixedSize(n)&&0===t.fixedSize;return(o||c)&&(r.assertIsFixedSize(t,"Fixed nullables can only be used with fixed-size codecs."),r.assertIsFixedSize(n,"Fixed nullables can only be used with fixed-size prefix."),a=n.fixedSize+t.fixedSize),r.createDecoder({...null===a?{maxSize:s([n,t].map(u))??void 0}:{fixedSize:a},read:(e,r)=>{if(e.length-r<=0)return[null,r];const[i,o]=n.read(e,r);if(0===i)return[null,null!==a?r+a:o];const[s,u]=t.read(e,o);return[s,null!==a?r+a:u]}})}function T(t,e={}){const n=e.size??i.getU8Encoder(),{minRange:o,maxRange:s,stringValues:a,enumKeys:u,enumValues:c}=B(t);return r.mapEncoder(n,(t=>{const e="number"==typeof t&&(ts),n="string"==typeof t&&!a.includes(t);if(e||n)throw new Error(`Invalid scalar enum variant. Expected one of [${a.join(", ")}] or a number between ${o} and ${s}, got "${t}".`);if("number"==typeof t)return t;const r=c.indexOf(t);return r>=0?r:u.indexOf(t)}))}function P(t,e={}){const n=e.size??i.getU8Decoder(),{minRange:o,maxRange:s,isNumericEnum:a,enumValues:u}=B(t);return r.mapDecoder(n,(t=>{const e=Number(t);if(es)throw new Error(`Enum discriminator out of range. Expected a number between ${o} and ${s}, got ${e}.`);return a?e:u[e]}))}function B(t){const e=Object.keys(t),n=Object.values(t),r=n.some((t=>"number"==typeof t));return{enumKeys:e,enumValues:n,isNumericEnum:r,maxRange:r?n.length/2-1:n.length-1,minRange:0,stringValues:r?[...e]:[...new Set([...e,...n])]}}function L(t,e={}){return r.mapEncoder(c(t,e),(t=>[...t]))}function $(t,e={}){return r.mapDecoder(d(t,e),(t=>new Set(t)))}function R(t){const e=t.map((([,t])=>t)),n=s(e.map(a)),i=s(e.map(u))??void 0;return r.createEncoder({...null===n?{getSizeFromValue:e=>t.map((([t,n])=>r.getEncodedSize(e[t],n))).reduce(((t,e)=>t+e),0),maxSize:i}:{fixedSize:n},write:(e,n,r)=>(t.forEach((([t,i])=>{r=i.write(e[t],n,r)})),r)})}function O(t){const e=t.map((([,t])=>t)),n=s(e.map(a)),i=s(e.map(u))??void 0;return r.createDecoder({...null===n?{maxSize:i}:{fixedSize:n},read:(e,n)=>{const r={};return t.forEach((([t,i])=>{const[o,s]=i.read(e,n);n=s,r[t]=o})),[r,n]}})}function D(){return r.createEncoder({fixedSize:0,write:(t,e,n)=>n})}function C(){return r.createDecoder({fixedSize:0,read:(t,e)=>[void 0,e]})}e.assertValidNumberOfItemsForCodec=o,e.getArrayCodec=function(t,e={}){return r.combineCodec(c(t,e),d(t,e))},e.getArrayDecoder=d,e.getArrayEncoder=c,e.getBitArrayCodec=function(t,e={}){return r.combineCodec(h(t,e),f(t,e))},e.getBitArrayDecoder=f,e.getBitArrayEncoder=h,e.getBooleanCodec=function(t={}){return r.combineCodec(p(t),m(t))},e.getBooleanDecoder=m,e.getBooleanEncoder=p,e.getBytesCodec=function(t={}){return r.combineCodec(g(t),y(t))},e.getBytesDecoder=y,e.getBytesEncoder=g,e.getDataEnumCodec=function(t,e={}){return r.combineCodec(b(t,e),w(t,e))},e.getDataEnumDecoder=w,e.getDataEnumEncoder=b,e.getMapCodec=function(t,e,n={}){return r.combineCodec(S(t,e,n),I(t,e,n))},e.getMapDecoder=I,e.getMapEncoder=S,e.getNullableCodec=function(t,e={}){const n=e;return r.combineCodec(x(t,n),E(t,n))},e.getNullableDecoder=E,e.getNullableEncoder=x,e.getScalarEnumCodec=function(t,e={}){return r.combineCodec(T(t,e),P(t,e))},e.getScalarEnumDecoder=P,e.getScalarEnumEncoder=T,e.getSetCodec=function(t,e={}){return r.combineCodec(L(t,e),$(t,e))},e.getSetDecoder=$,e.getSetEncoder=L,e.getStructCodec=function(t){return r.combineCodec(R(t),O(t))},e.getStructDecoder=O,e.getStructEncoder=R,e.getTupleCodec=function(t){return r.combineCodec(M(t),A(t))},e.getTupleDecoder=A,e.getTupleEncoder=M,e.getUnitCodec=function(){return r.combineCodec(D(),C())},e.getUnitDecoder=C,e.getUnitEncoder=D},2638:(t,e,n)=>{"use strict";var r=n(21433);function i(t,e,n,r){if(rn)throw new Error(`Codec [${t}] expected number to be in the range [${e}, ${n}], got ${r}.`)}var o=(t=>(t[t.LITTLE=0]="LITTLE",t[t.BIG=1]="BIG",t))(o||{});function s(t){return 1!==t?.endian}function a(t){return r.createEncoder({fixedSize:t.size,write(e,n,r){t.range&&i(t.name,t.range[0],t.range[1],e);const o=new ArrayBuffer(t.size);return t.set(new DataView(o),e,s(t.config)),n.set(new Uint8Array(o),r),r+t.size}})}function u(t){return r.createDecoder({fixedSize:t.size,read(e,n=0){r.assertByteArrayIsNotEmptyForCodec(t.name,e,n),r.assertByteArrayHasEnoughBytesForCodec(t.name,t.size,e,n);const i=new DataView(function(t,e,n){const r=t.byteOffset+(e??0),i=n??t.byteLength;return t.buffer.slice(r,r+i)}(e,n,t.size));return[t.get(i,s(t.config)),n+t.size]}})}var c=(t={})=>a({config:t,name:"f32",set:(t,e,n)=>t.setFloat32(0,e,n),size:4}),d=(t={})=>u({config:t,get:(t,e)=>t.getFloat32(0,e),name:"f32",size:4}),l=(t={})=>a({config:t,name:"f64",set:(t,e,n)=>t.setFloat64(0,e,n),size:8}),h=(t={})=>u({config:t,get:(t,e)=>t.getFloat64(0,e),name:"f64",size:8}),f=(t={})=>a({config:t,name:"i128",range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(t,e,n)=>{const r=n?8:0,i=n?0:8;t.setBigInt64(r,BigInt(e)>>64n,n),t.setBigUint64(i,0xffffffffffffffffn&BigInt(e),n)},size:16}),p=(t={})=>u({config:t,get:(t,e)=>{const n=e?8:0,r=e?0:8;return(t.getBigInt64(n,e)<<64n)+t.getBigUint64(r,e)},name:"i128",size:16}),m=(t={})=>a({config:t,name:"i16",range:[-Number("0x7fff")-1,Number("0x7fff")],set:(t,e,n)=>t.setInt16(0,e,n),size:2}),g=(t={})=>u({config:t,get:(t,e)=>t.getInt16(0,e),name:"i16",size:2}),y=(t={})=>a({config:t,name:"i32",range:[-Number("0x7fffffff")-1,Number("0x7fffffff")],set:(t,e,n)=>t.setInt32(0,e,n),size:4}),b=(t={})=>u({config:t,get:(t,e)=>t.getInt32(0,e),name:"i32",size:4}),w=(t={})=>a({config:t,name:"i64",range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(t,e,n)=>t.setBigInt64(0,BigInt(e),n),size:8}),_=(t={})=>u({config:t,get:(t,e)=>t.getBigInt64(0,e),name:"i64",size:8}),v=()=>a({name:"i8",range:[-Number("0x7f")-1,Number("0x7f")],set:(t,e)=>t.setInt8(0,e),size:1}),k=()=>u({get:t=>t.getInt8(0),name:"i8",size:1}),M=()=>r.createEncoder({getSizeFromValue:t=>t<=127?1:t<=16383?2:3,maxSize:3,write:(t,e,n)=>{i("shortU16",0,65535,t);const r=[0];for(let e=0;;e+=1){const n=t>>7*e;if(0===n)break;const i=127&n;r[e]=i,e>0&&(r[e-1]|=128)}return e.set(r,n),n+r.length}}),A=()=>r.createDecoder({maxSize:3,read:(t,e)=>{let n=0,r=0;for(;++r;){const i=r-1,o=t[e+i];if(n|=(127&o)<<7*i,0==(128&o))break}return[n,e+r]}}),S=(t={})=>a({config:t,name:"u128",range:[0,BigInt("0xffffffffffffffffffffffffffffffff")],set:(t,e,n)=>{const r=n?8:0,i=n?0:8;t.setBigUint64(r,BigInt(e)>>64n,n),t.setBigUint64(i,0xffffffffffffffffn&BigInt(e),n)},size:16}),I=(t={})=>u({config:t,get:(t,e)=>{const n=e?8:0,r=e?0:8;return(t.getBigUint64(n,e)<<64n)+t.getBigUint64(r,e)},name:"u128",size:16}),x=(t={})=>a({config:t,name:"u16",range:[0,Number("0xffff")],set:(t,e,n)=>t.setUint16(0,e,n),size:2}),E=(t={})=>u({config:t,get:(t,e)=>t.getUint16(0,e),name:"u16",size:2}),T=(t={})=>a({config:t,name:"u32",range:[0,Number("0xffffffff")],set:(t,e,n)=>t.setUint32(0,e,n),size:4}),P=(t={})=>u({config:t,get:(t,e)=>t.getUint32(0,e),name:"u32",size:4}),B=(t={})=>a({config:t,name:"u64",range:[0,BigInt("0xffffffffffffffff")],set:(t,e,n)=>t.setBigUint64(0,BigInt(e),n),size:8}),L=(t={})=>u({config:t,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}),$=()=>a({name:"u8",range:[0,Number("0xff")],set:(t,e)=>t.setUint8(0,e),size:1}),R=()=>u({get:t=>t.getUint8(0),name:"u8",size:1});e.Endian=o,e.assertNumberIsBetweenForCodec=i,e.getF32Codec=(t={})=>r.combineCodec(c(t),d(t)),e.getF32Decoder=d,e.getF32Encoder=c,e.getF64Codec=(t={})=>r.combineCodec(l(t),h(t)),e.getF64Decoder=h,e.getF64Encoder=l,e.getI128Codec=(t={})=>r.combineCodec(f(t),p(t)),e.getI128Decoder=p,e.getI128Encoder=f,e.getI16Codec=(t={})=>r.combineCodec(m(t),g(t)),e.getI16Decoder=g,e.getI16Encoder=m,e.getI32Codec=(t={})=>r.combineCodec(y(t),b(t)),e.getI32Decoder=b,e.getI32Encoder=y,e.getI64Codec=(t={})=>r.combineCodec(w(t),_(t)),e.getI64Decoder=_,e.getI64Encoder=w,e.getI8Codec=()=>r.combineCodec(v(),k()),e.getI8Decoder=k,e.getI8Encoder=v,e.getShortU16Codec=()=>r.combineCodec(M(),A()),e.getShortU16Decoder=A,e.getShortU16Encoder=M,e.getU128Codec=(t={})=>r.combineCodec(S(t),I(t)),e.getU128Decoder=I,e.getU128Encoder=S,e.getU16Codec=(t={})=>r.combineCodec(x(t),E(t)),e.getU16Decoder=E,e.getU16Encoder=x,e.getU32Codec=(t={})=>r.combineCodec(T(t),P(t)),e.getU32Decoder=P,e.getU32Encoder=T,e.getU64Codec=(t={})=>r.combineCodec(B(t),L(t)),e.getU64Decoder=L,e.getU64Encoder=B,e.getU8Codec=()=>r.combineCodec($(),R()),e.getU8Decoder=R,e.getU8Encoder=$},72738:(t,e,n)=>{"use strict";var r=n(21433),i=n(2638);function o(t,e,n=e){if(!e.match(new RegExp(`^[${t}]*$`)))throw new Error(`Expected a string of base ${t.length}, got [${n}].`)}var s=t=>r.createEncoder({getSizeFromValue:e=>{const[n,r]=c(e,t[0]);if(""===r)return e.length;const i=d(r,t);return n.length+Math.ceil(i.toString(16).length/2)},write(e,n,r){if(o(t,e),""===e)return r;const[i,s]=c(e,t[0]);if(""===s)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let a=d(s,t);const u=[];for(;a>0n;)u.unshift(Number(a%256n)),a/=256n;const l=[...Array(i.length).fill(0),...u];return n.set(l,r),r+l.length}}),a=t=>r.createDecoder({read(e,n){const r=0===n?e:e.slice(n);if(0===r.length)return["",0];let i=r.findIndex((t=>0!==t));i=-1===i?r.length:i;const o=t[0].repeat(i);if(i===r.length)return[o,e.length];const s=function(t,e){const n=BigInt(e.length),r=[];for(;t>0n;)r.unshift(e[Number(t%n)]),t/=n;return r.join("")}(r.slice(i).reduce(((t,e)=>256n*t+BigInt(e)),0n),t);return[o+s,e.length]}}),u=t=>r.combineCodec(s(t),a(t));function c(t,e){const n=[...t].findIndex((t=>t!==e));return-1===n?[t,""]:[t.slice(0,n),t.slice(n)]}function d(t,e){const n=BigInt(e.length);return[...t].reduce(((t,r)=>t*n+BigInt(e.indexOf(r))),0n)}var l="0123456789",h=()=>r.createEncoder({getSizeFromValue:t=>Math.ceil(t.length/2),write(t,e,n){const r=t.toLowerCase();o("0123456789abcdef",r,t);const i=r.match(/.{1,2}/g),s=i?i.map((t=>parseInt(t,16))):[];return e.set(s,n),s.length+n}}),f=()=>r.createDecoder({read:(t,e)=>[t.slice(e).reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),""),t.length]}),p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",m=(t,e)=>r.createEncoder({getSizeFromValue:t=>Math.floor(t.length*e/8),write(n,r,i){if(o(t,n),""===n)return i;const s=y([...n].map((e=>t.indexOf(e))),e,8,!1);return r.set(s,i),s.length+i}}),g=(t,e)=>r.createDecoder({read(n,r=0){const i=0===r?n:n.slice(r);return 0===i.length?["",n.length]:[y([...i],8,e,!0).map((e=>t[e])).join(""),n.length]}});function y(t,e,n,r){const i=[];let o=0,s=0;const a=(1<=n;)s-=n,i.push(o>>s&a);return r&&s>0&&i.push(o<r.createEncoder({getSizeFromValue:t=>{try{return atob(t).length}catch(e){throw new Error(`Expected a string of base 64, got [${t}].`)}},write(t,e,n){try{const r=atob(t).split("").map((t=>t.charCodeAt(0)));return e.set(r,n),r.length+n}catch(e){throw new Error(`Expected a string of base 64, got [${t}].`)}}}),w=()=>r.createDecoder({read(t,e=0){const n=t.slice(e);return[btoa(String.fromCharCode(...n)),t.length]}}),_=t=>t.replace(/\u0000/g,""),v=globalThis.TextDecoder,k=globalThis.TextEncoder,M=()=>{let t;return r.createEncoder({getSizeFromValue:e=>(t||=new k).encode(e).length,write:(e,n,r)=>{const i=(t||=new k).encode(e);return n.set(i,r),r+i.length}})},A=()=>{let t;return r.createDecoder({read(e,n){const r=(t||=new v).decode(e.slice(n));return[_(r),e.length]}})};function S(t={}){const e=t.size??i.getU32Encoder(),n=t.encoding??M();return"variable"===e?n:"number"==typeof e?r.fixEncoder(n,e):r.createEncoder({getSizeFromValue:t=>{const i=r.getEncodedSize(t,n);return r.getEncodedSize(i,e)+i},write:(t,i,o)=>{const s=r.getEncodedSize(t,n);return o=e.write(s,i,o),n.write(t,i,o)}})}function I(t={}){const e=t.size??i.getU32Decoder(),n=t.encoding??A();return"variable"===e?n:"number"==typeof e?r.fixDecoder(n,e):r.createDecoder({read:(t,i=0)=>{r.assertByteArrayIsNotEmptyForCodec("string",t,i);const[o,s]=e.read(t,i),a=Number(o);i=s;const u=t.slice(i,i+a);r.assertByteArrayHasEnoughBytesForCodec("string",a,u);const[c,d]=n.read(u,0);return[c,i+=d]}})}e.assertValidBaseString=o,e.getBase10Codec=()=>u(l),e.getBase10Decoder=()=>a(l),e.getBase10Encoder=()=>s(l),e.getBase16Codec=()=>r.combineCodec(h(),f()),e.getBase16Decoder=f,e.getBase16Encoder=h,e.getBase58Codec=()=>u(p),e.getBase58Decoder=()=>a(p),e.getBase58Encoder=()=>s(p),e.getBase64Codec=()=>r.combineCodec(b(),w()),e.getBase64Decoder=w,e.getBase64Encoder=b,e.getBaseXCodec=u,e.getBaseXDecoder=a,e.getBaseXEncoder=s,e.getBaseXResliceCodec=(t,e)=>r.combineCodec(m(t,e),g(t,e)),e.getBaseXResliceDecoder=g,e.getBaseXResliceEncoder=m,e.getStringCodec=function(t={}){return r.combineCodec(S(t),I(t))},e.getStringDecoder=I,e.getStringEncoder=S,e.getUtf8Codec=()=>r.combineCodec(M(),A()),e.getUtf8Decoder=A,e.getUtf8Encoder=M,e.padNullCharacters=(t,e)=>t.padEnd(e,"\0"),e.removeNullCharacters=_},62997:(t,e,n)=>{"use strict";var r=n(21433),i=n(2638),o=t=>({__option:"Some",value:t}),s=()=>({__option:"None"}),a=t=>!!(t&&"object"==typeof t&&"__option"in t&&("Some"===t.__option&&"value"in t||"None"===t.__option)),u=t=>"Some"===t.__option,c=t=>null!==t?o(t):{__option:"None"};function d(t,e={}){const n=e.prefix??i.getU8Encoder(),o=e.fixed??!1,s=r.isFixedSize(t)&&r.isFixedSize(n)&&0===t.fixedSize;if(o||s){r.assertIsFixedSize(t,"Fixed options can only be used with fixed-size codecs."),r.assertIsFixedSize(n,"Fixed options can only be used with fixed-size prefix.");const e=n.fixedSize+t.fixedSize;return r.createEncoder({fixedSize:e,write:(r,i,o)=>{const s=a(r)?r:c(r),d=n.write(Number(u(s)),i,o);return u(s)&&t.write(s.value,i,d),o+e}})}return r.createEncoder({getSizeFromValue:e=>{const i=a(e)?e:c(e);return r.getEncodedSize(Number(u(i)),n)+(u(i)?r.getEncodedSize(i.value,t):0)},maxSize:h([n,t].map(f))??void 0,write:(e,r,i)=>{const o=a(e)?e:c(e);return i=n.write(Number(u(o)),r,i),u(o)&&(i=t.write(o.value,r,i)),i}})}function l(t,e={}){const n=e.prefix??i.getU8Decoder(),s=e.fixed??!1;let a=null;const u=r.isFixedSize(t)&&r.isFixedSize(n)&&0===t.fixedSize;return(s||u)&&(r.assertIsFixedSize(t,"Fixed options can only be used with fixed-size codecs."),r.assertIsFixedSize(n,"Fixed options can only be used with fixed-size prefix."),a=n.fixedSize+t.fixedSize),r.createDecoder({...null===a?{maxSize:h([n,t].map(f))??void 0}:{fixedSize:a},read:(e,r)=>{if(e.length-r<=0)return[{__option:"None"},r];const[i,s]=n.read(e,r);if(0===i)return[{__option:"None"},null!==a?r+a:s];const[u,c]=t.read(e,s);return[o(u),null!==a?r+a:c]}})}function h(t){return t.reduce(((t,e)=>null===t||null===e?null:t+e),0)}function f(t){return r.isFixedSize(t)?t.fixedSize:t.maxSize??null}e.getOptionCodec=function(t,e={}){return r.combineCodec(d(t,e),l(t,e))},e.getOptionDecoder=l,e.getOptionEncoder=d,e.isNone=t=>"None"===t.__option,e.isOption=a,e.isSome=u,e.none=s,e.some=o,e.unwrapOption=function(t,e){return u(t)?t.value:e?e():null},e.unwrapOptionRecursively=function t(e,n){if(!e||ArrayBuffer.isView(e))return e;const r=e=>n?t(e,n):t(e);return a(e)?u(e)?r(e.value):n?n():null:Array.isArray(e)?e.map(r):"object"==typeof e?Object.fromEntries(Object.entries(e).map((([t,e])=>[t,r(e)]))):e},e.wrapNullable=c},90126:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyNotFoundError=e.ImmutableMetadataError=e.IncorrectUpdateAuthorityError=e.IncorrectMintAuthorityError=e.MintHasNoMintAuthorityError=e.IncorrectAccountError=e.TokenMetadataError=void 0;class n extends Error{constructor(t){super(t)}}e.TokenMetadataError=n,e.IncorrectAccountError=class extends n{constructor(){super(...arguments),this.name="IncorrectAccountError"}},e.MintHasNoMintAuthorityError=class extends n{constructor(){super(...arguments),this.name="MintHasNoMintAuthorityError"}},e.IncorrectMintAuthorityError=class extends n{constructor(){super(...arguments),this.name="IncorrectMintAuthorityError"}},e.IncorrectUpdateAuthorityError=class extends n{constructor(){super(...arguments),this.name="IncorrectUpdateAuthorityError"}},e.ImmutableMetadataError=class extends n{constructor(){super(...arguments),this.name="ImmutableMetadataError"}},e.KeyNotFoundError=class extends n{constructor(){super(...arguments),this.name="KeyNotFoundError"}}},14546:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getFieldConfig=e.getFieldCodec=e.Field=void 0;const r=n(53149),i=n(72738);var o;!function(t){t[t.Name=0]="Name",t[t.Symbol=1]="Symbol",t[t.Uri=2]="Uri"}(o||(e.Field=o={})),e.getFieldCodec=()=>[["Name",(0,r.getUnitCodec)()],["Symbol",(0,r.getUnitCodec)()],["Uri",(0,r.getUnitCodec)()],["Key",(0,r.getStructCodec)([["value",(0,r.getTupleCodec)([(0,i.getStringCodec)()])]])]],e.getFieldConfig=function(t){return t===o.Name||"Name"===t||"name"===t?{__kind:"Name"}:t===o.Symbol||"Symbol"===t||"symbol"===t?{__kind:"Symbol"}:t===o.Uri||"Uri"===t||"uri"===t?{__kind:"Uri"}:{__kind:"Key",value:[t]}}},99564:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(90126),e),i(n(14546),e),i(n(40656),e),i(n(15285),e)},40656:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createEmitInstruction=e.createUpdateAuthorityInstruction=e.createRemoveKeyInstruction=e.createUpdateFieldInstruction=e.createInitializeInstruction=void 0;const i=n(53149),o=n(2638),s=n(72738),a=n(62997),u=n(1431),c=n(18245),d=n(14546);function l(t,e,n){const o=(0,i.getStructEncoder)(t).encode(n);return r.concat([e,o])}e.createInitializeInstruction=function(t){const{programId:e,metadata:n,updateAuthority:r,mint:i,mintAuthority:o,name:a,symbol:d,uri:h}=t;return new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!0,pubkey:n},{isSigner:!1,isWritable:!1,pubkey:r},{isSigner:!1,isWritable:!1,pubkey:i},{isSigner:!0,isWritable:!1,pubkey:o}],data:l([["name",(0,s.getStringEncoder)()],["symbol",(0,s.getStringEncoder)()],["uri",(0,s.getStringEncoder)()]],(0,u.splDiscriminate)("spl_token_metadata_interface:initialize_account"),{name:a,symbol:d,uri:h})})},e.createUpdateFieldInstruction=function(t){const{programId:e,metadata:n,updateAuthority:r,field:o,value:a}=t;return new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!0,pubkey:n},{isSigner:!0,isWritable:!1,pubkey:r}],data:l([["field",(0,i.getDataEnumCodec)((0,d.getFieldCodec)())],["value",(0,s.getStringEncoder)()]],(0,u.splDiscriminate)("spl_token_metadata_interface:updating_field"),{field:(0,d.getFieldConfig)(o),value:a})})},e.createRemoveKeyInstruction=function(t){const{programId:e,metadata:n,updateAuthority:r,key:o,idempotent:a}=t;return new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!0,pubkey:n},{isSigner:!0,isWritable:!1,pubkey:r}],data:l([["idempotent",(0,i.getBooleanEncoder)()],["key",(0,s.getStringEncoder)()]],(0,u.splDiscriminate)("spl_token_metadata_interface:remove_key_ix"),{idempotent:a,key:o})})},e.createUpdateAuthorityInstruction=function(t){const{programId:e,metadata:n,oldAuthority:o,newAuthority:s}=t,a=r.alloc(32);return s?a.set(s.toBuffer()):a.fill(0),new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!0,pubkey:n},{isSigner:!0,isWritable:!1,pubkey:o}],data:l([["newAuthority",(0,i.getBytesEncoder)({size:32})]],(0,u.splDiscriminate)("spl_token_metadata_interface:update_the_authority"),{newAuthority:a})})},e.createEmitInstruction=function(t){const{programId:e,metadata:n,start:r,end:i}=t;return new c.TransactionInstruction({programId:e,keys:[{isSigner:!1,isWritable:!1,pubkey:n}],data:l([["start",(0,a.getOptionEncoder)((0,o.getU64Encoder)())],["end",(0,a.getOptionEncoder)((0,o.getU64Encoder)())]],(0,u.splDiscriminate)("spl_token_metadata_interface:emitter"),{start:null!=r?r:null,end:null!=i?i:null})})}},15285:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.unpack=e.pack=e.TOKEN_METADATA_DISCRIMINATOR=void 0;const i=n(18245),o=n(53149),s=n(72738);e.TOKEN_METADATA_DISCRIMINATOR=r.from([112,132,90,90,11,88,157,87]);const a=(0,o.getStructCodec)([["updateAuthority",(0,o.getBytesCodec)({size:32})],["mint",(0,o.getBytesCodec)({size:32})],["name",(0,s.getStringCodec)()],["symbol",(0,s.getStringCodec)()],["uri",(0,s.getStringCodec)()],["additionalMetadata",(0,o.getArrayCodec)((0,o.getTupleCodec)([(0,s.getStringCodec)(),(0,s.getStringCodec)()]))]]);e.pack=t=>{var e;const n=null!==(e=t.updateAuthority)&&void 0!==e?e:i.PublicKey.default;return a.encode(Object.assign(Object.assign({},t),{updateAuthority:n.toBuffer(),mint:t.mint.toBuffer()}))},e.unpack=function(t){const e=a.decode(t);return function(t){for(let e=0;e{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getSigners=void 0;const r=n(18245);e.getSigners=function(t,e){return t instanceof r.PublicKey?[t,e]:[t.publicKey,[t]]}},57503:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.mintTo=void 0;const i=n(18245),o=n(44530),s=n(74761),a=n(51421);e.mintTo=function(t,e,n,u,c,d,l=[],h,f=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(c,l),p=(new i.Transaction).add((0,s.createMintToInstruction)(n,u,r,d,l,f));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...o],h)}))}},31507:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.mintToChecked=void 0;const i=n(18245),o=n(44530),s=n(70698),a=n(51421);e.mintToChecked=function(t,e,n,u,c,d,l,h=[],f,p=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(c,h),m=(new i.Transaction).add((0,s.createMintToCheckedInstruction)(n,u,r,d,l,h,p));return yield(0,i.sendAndConfirmTransaction)(t,m,[e,...o],f)}))}},85601:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.recoverNested=void 0;const i=n(18245),o=n(44530),s=n(31183),a=n(66446);e.recoverNested=function(t,e,n,u,c,d,l=o.TOKEN_PROGRAM_ID,h=o.ASSOCIATED_TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(0,a.getAssociatedTokenAddressSync)(u,n.publicKey,!1,l,h),o=(0,a.getAssociatedTokenAddressSync)(c,n.publicKey,!1,l,h),f=(0,a.getAssociatedTokenAddressSync)(c,r,!0,l,h),p=(new i.Transaction).add((0,s.createRecoverNestedInstruction)(f,c,o,r,u,n.publicKey,l,h));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,n],d)}))}},13460:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.revoke=void 0;const i=n(18245),o=n(44530),s=n(62216),a=n(51421);e.revoke=function(t,e,n,u,c=[],d,l=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(u,c),h=(new i.Transaction).add((0,s.createRevokeInstruction)(n,r,c,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...o],d)}))}},46111:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.setAuthority=void 0;const i=n(18245),o=n(44530),s=n(95816),a=n(51421);e.setAuthority=function(t,e,n,u,c,d,l=[],h,f=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(u,l),p=(new i.Transaction).add((0,s.createSetAuthorityInstruction)(n,r,c,d,l,f));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...o],h)}))}},87245:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.syncNative=void 0;const i=n(18245),o=n(44530),s=n(75836);e.syncNative=function(t,e,n,a,u=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(new i.Transaction).add((0,s.createSyncNativeInstruction)(n,u));return yield(0,i.sendAndConfirmTransaction)(t,r,[e],a)}))}},70765:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.thawAccount=void 0;const i=n(18245),o=n(44530),s=n(19040),a=n(51421);e.thawAccount=function(t,e,n,u,c,d=[],l,h=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(c,d),f=(new i.Transaction).add((0,s.createThawAccountInstruction)(n,u,r,d,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...o],l)}))}},99843:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.transfer=void 0;const i=n(18245),o=n(44530),s=n(72874),a=n(51421);e.transfer=function(t,e,n,u,c,d,l=[],h,f=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(c,l),p=(new i.Transaction).add((0,s.createTransferInstruction)(n,u,r,d,l,f));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...o],h)}))}},44868:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.transferChecked=void 0;const i=n(18245),o=n(44530),s=n(35593),a=n(51421);e.transferChecked=function(t,e,n,u,c,d,l,h,f=[],p,m=o.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,o]=(0,a.getSigners)(d,f),g=(new i.Transaction).add((0,s.createTransferCheckedInstruction)(n,u,c,r,l,h,f,m));return yield(0,i.sendAndConfirmTransaction)(t,g,[e,...o],p)}))}},93701:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.uiAmountToAmount=void 0;const o=n(27278),s=n(18245),a=n(44530),u=n(21470);e.uiAmountToAmount=function(t,e,n,c,d=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=(new s.Transaction).add((0,u.createUiAmountToAmountInstruction)(n,c,d)),{returnData:a,err:l}=(yield t.simulateTransaction(i,[e],!1)).value;if(a){const t=r.from(a.data[0],a.data[1]);return(0,o.u64)().decode(t)}return l}))}},44530:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.programSupportsExtensions=e.NATIVE_MINT_2022=e.NATIVE_MINT=e.ASSOCIATED_TOKEN_PROGRAM_ID=e.TOKEN_2022_PROGRAM_ID=e.TOKEN_PROGRAM_ID=void 0;const r=n(18245);e.TOKEN_PROGRAM_ID=new r.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),e.TOKEN_2022_PROGRAM_ID=new r.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),e.ASSOCIATED_TOKEN_PROGRAM_ID=new r.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),e.NATIVE_MINT=new r.PublicKey("So11111111111111111111111111111111111111112"),e.NATIVE_MINT_2022=new r.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP"),e.programSupportsExtensions=function(t){return t!==e.TOKEN_PROGRAM_ID}},60913:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenTransferHookAccountDataNotFound=e.TokenTransferHookInvalidSeed=e.TokenTransferHookAccountNotFound=e.TokenUnsupportedInstructionError=e.TokenInvalidInstructionTypeError=e.TokenInvalidInstructionDataError=e.TokenInvalidInstructionKeysError=e.TokenInvalidInstructionProgramError=e.TokenOwnerOffCurveError=e.TokenInvalidOwnerError=e.TokenInvalidMintError=e.TokenInvalidAccountSizeError=e.TokenInvalidAccountOwnerError=e.TokenInvalidAccountDataError=e.TokenInvalidAccountError=e.TokenAccountNotFoundError=e.TokenError=void 0;class n extends Error{constructor(t){super(t)}}e.TokenError=n,e.TokenAccountNotFoundError=class extends n{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}},e.TokenInvalidAccountError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}},e.TokenInvalidAccountDataError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidAccountDataError"}},e.TokenInvalidAccountOwnerError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}},e.TokenInvalidAccountSizeError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}},e.TokenInvalidMintError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidMintError"}},e.TokenInvalidOwnerError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidOwnerError"}},e.TokenOwnerOffCurveError=class extends n{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}},e.TokenInvalidInstructionProgramError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidInstructionProgramError"}},e.TokenInvalidInstructionKeysError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidInstructionKeysError"}},e.TokenInvalidInstructionDataError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidInstructionDataError"}},e.TokenInvalidInstructionTypeError=class extends n{constructor(){super(...arguments),this.name="TokenInvalidInstructionTypeError"}},e.TokenUnsupportedInstructionError=class extends n{constructor(){super(...arguments),this.name="TokenUnsupportedInstructionError"}},e.TokenTransferHookAccountNotFound=class extends n{constructor(){super(...arguments),this.name="TokenTransferHookAccountNotFound"}},e.TokenTransferHookInvalidSeed=class extends n{constructor(){super(...arguments),this.name="TokenTransferHookInvalidSeed"}},e.TokenTransferHookAccountDataNotFound=class extends n{constructor(){super(...arguments),this.name="TokenTransferHookAccountDataNotFound"}}},21026:(t,e)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.ACCOUNT_TYPE_SIZE=e.AccountType=void 0,function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(n||(e.AccountType=n={})),e.ACCOUNT_TYPE_SIZE=1},966:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.disableCpiGuard=e.enableCpiGuard=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(21095);e.enableCpiGuard=function(t,e,n,u,c=[],d,l=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(u,c),h=(new i.Transaction).add((0,a.createEnableCpiGuardInstruction)(n,r,s,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...s],d)}))},e.disableCpiGuard=function(t,e,n,u,c=[],d,l=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(u,c),h=(new i.Transaction).add((0,a.createDisableCpiGuardInstruction)(n,r,s,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...s],d)}))}},2941:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(966),e),i(n(21095),e),i(n(66738),e)},21095:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createDisableCpiGuardInstruction=e.createEnableCpiGuardInstruction=e.cpiGuardInstructionData=e.CpiGuardInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);var d;function l(t,n,i,d,l){if(!(0,s.programSupportsExtensions)(l))throw new a.TokenUnsupportedInstructionError;const h=(0,u.addSigners)([{pubkey:n,isSigner:!1,isWritable:!0}],i,d),f=r.alloc(e.cpiGuardInstructionData.span);return e.cpiGuardInstructionData.encode({instruction:c.TokenInstruction.CpiGuardExtension,cpiGuardInstruction:t},f),new o.TransactionInstruction({keys:h,programId:l,data:f})}!function(t){t[t.Enable=0]="Enable",t[t.Disable=1]="Disable"}(d||(e.CpiGuardInstruction=d={})),e.cpiGuardInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("cpiGuardInstruction")]),e.createEnableCpiGuardInstruction=function(t,e,n=[],r=s.TOKEN_2022_PROGRAM_ID){return l(d.Enable,t,e,n,r)},e.createDisableCpiGuardInstruction=function(t,e,n=[],r=s.TOKEN_2022_PROGRAM_ID){return l(d.Disable,t,e,n,r)}},66738:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCpiGuard=e.CPI_GUARD_SIZE=e.CpiGuardLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.CpiGuardLayout=(0,r.struct)([(0,i.bool)("lockCpi")]),e.CPI_GUARD_SIZE=e.CpiGuardLayout.span,e.getCpiGuard=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.CpiGuard,t.tlvData);return null!==n?e.CpiGuardLayout.decode(n):null}},87793:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.updateDefaultAccountState=e.initializeDefaultAccountState=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(68298);e.initializeDefaultAccountState=function(t,e,n,o,u,c=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(new i.Transaction).add((0,a.createInitializeDefaultAccountStateInstruction)(n,o,c));return yield(0,i.sendAndConfirmTransaction)(t,r,[e],u)}))},e.updateDefaultAccountState=function(t,e,n,u,c,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(c,d),f=(new i.Transaction).add((0,a.createUpdateDefaultAccountStateInstruction)(n,u,r,s,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...s],l)}))}},34347:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(87793),e),i(n(68298),e),i(n(20403),e)},68298:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createUpdateDefaultAccountStateInstruction=e.createInitializeDefaultAccountStateInstruction=e.defaultAccountStateInstructionData=e.DefaultAccountStateInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);var d;!function(t){t[t.Initialize=0]="Initialize",t[t.Update=1]="Update"}(d||(e.DefaultAccountStateInstruction=d={})),e.defaultAccountStateInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("defaultAccountStateInstruction"),(0,i.u8)("accountState")]),e.createInitializeDefaultAccountStateInstruction=function(t,n,i=s.TOKEN_2022_PROGRAM_ID){if(!(0,s.programSupportsExtensions)(i))throw new a.TokenUnsupportedInstructionError;const u=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.defaultAccountStateInstructionData.span);return e.defaultAccountStateInstructionData.encode({instruction:c.TokenInstruction.DefaultAccountStateExtension,defaultAccountStateInstruction:d.Initialize,accountState:n},l),new o.TransactionInstruction({keys:u,programId:i,data:l})},e.createUpdateDefaultAccountStateInstruction=function(t,n,i,l=[],h=s.TOKEN_2022_PROGRAM_ID){if(!(0,s.programSupportsExtensions)(h))throw new a.TokenUnsupportedInstructionError;const f=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],i,l),p=r.alloc(e.defaultAccountStateInstructionData.span);return e.defaultAccountStateInstructionData.encode({instruction:c.TokenInstruction.DefaultAccountStateExtension,defaultAccountStateInstruction:d.Update,accountState:n},p),new o.TransactionInstruction({keys:f,programId:h,data:p})}},20403:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultAccountState=e.DEFAULT_ACCOUNT_STATE_SIZE=e.DefaultAccountStateLayout=void 0;const r=n(39386),i=n(90758);e.DefaultAccountStateLayout=(0,r.struct)([(0,r.u8)("state")]),e.DEFAULT_ACCOUNT_STATE_SIZE=e.DefaultAccountStateLayout.span,e.getDefaultAccountState=function(t){const n=(0,i.getExtensionData)(i.ExtensionType.DefaultAccountState,t.tlvData);return null!==n?e.DefaultAccountStateLayout.decode(n):null}},90758:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNewAccountLenForExtensionLen=e.getAccountLenForMint=e.getExtensionTypes=e.getExtensionData=e.getAccountLen=e.getMintLen=e.getAccountTypeOfMintType=e.isAccountExtension=e.isMintExtension=e.getTypeLen=e.LENGTH_SIZE=e.TYPE_SIZE=e.ExtensionType=void 0;const r=n(48820),i=n(66446),o=n(22114),s=n(21026),a=n(2941),u=n(34347),c=n(44416),d=n(4567),l=n(64304),h=n(83239),f=n(59795),p=n(36882),m=n(86874),g=n(28795),y=n(95310),b=n(44530);var w;function _(t){return t+e.TYPE_SIZE+e.LENGTH_SIZE}function v(t){switch(t){case w.Uninitialized:return 0;case w.TransferFeeConfig:return g.TRANSFER_FEE_CONFIG_SIZE;case w.TransferFeeAmount:return g.TRANSFER_FEE_AMOUNT_SIZE;case w.MintCloseAuthority:return f.MINT_CLOSE_AUTHORITY_SIZE;case w.ConfidentialTransferMint:return 97;case w.ConfidentialTransferAccount:return 286;case w.CpiGuard:return a.CPI_GUARD_SIZE;case w.DefaultAccountState:return u.DEFAULT_ACCOUNT_STATE_SIZE;case w.ImmutableOwner:return c.IMMUTABLE_OWNER_SIZE;case w.MemoTransfer:return l.MEMO_TRANSFER_SIZE;case w.MetadataPointer:return h.METADATA_POINTER_SIZE;case w.NonTransferable:return p.NON_TRANSFERABLE_SIZE;case w.InterestBearingConfig:return d.INTEREST_BEARING_MINT_CONFIG_STATE_SIZE;case w.PermanentDelegate:return m.PERMANENT_DELEGATE_SIZE;case w.NonTransferableAccount:return p.NON_TRANSFERABLE_ACCOUNT_SIZE;case w.TransferHook:return y.TRANSFER_HOOK_SIZE;case w.TransferHookAccount:return y.TRANSFER_HOOK_ACCOUNT_SIZE;case w.TokenMetadata:throw Error(`Cannot get type length for variable extension type: ${t}`);default:throw Error(`Unknown extension type: ${t}`)}}function k(t){switch(t){case w.TransferFeeConfig:return w.TransferFeeAmount;case w.ConfidentialTransferMint:return w.ConfidentialTransferAccount;case w.NonTransferable:return w.NonTransferableAccount;case w.TransferHook:return w.TransferHookAccount;case w.TransferFeeAmount:case w.ConfidentialTransferAccount:case w.CpiGuard:case w.DefaultAccountState:case w.ImmutableOwner:case w.MemoTransfer:case w.MintCloseAuthority:case w.MetadataPointer:case w.TokenMetadata:case w.Uninitialized:case w.InterestBearingConfig:case w.PermanentDelegate:case w.NonTransferableAccount:case w.TransferHookAccount:return w.Uninitialized}}function M(t,n){if(0===t.length)return n;{const n=r.ACCOUNT_SIZE+s.ACCOUNT_TYPE_SIZE+t.filter(((e,n)=>n===t.indexOf(e))).map((t=>_(v(t)))).reduce(((t,e)=>t+e));return n===o.MULTISIG_SIZE?n+e.TYPE_SIZE:n}}function A(t){return M(t,r.ACCOUNT_SIZE)}function S(t,n){let r=0;for(;_(r)<=n.length;){const i=n.readUInt16LE(r),o=n.readUInt16LE(r+e.TYPE_SIZE),s=_(r);if(i==t)return n.slice(s,s+o);r=s+o}return null}function I(t){const n=[];let r=0;for(;r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getImmutableOwner=e.IMMUTABLE_OWNER_SIZE=e.ImmutableOwnerLayout=void 0;const r=n(39386),i=n(90758);e.ImmutableOwnerLayout=(0,r.struct)([]),e.IMMUTABLE_OWNER_SIZE=e.ImmutableOwnerLayout.span,e.getImmutableOwner=function(t){const n=(0,i.getExtensionData)(i.ExtensionType.ImmutableOwner,t.tlvData);return null!==n?e.ImmutableOwnerLayout.decode(n):null}},66832:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(21026),e),i(n(2941),e),i(n(34347),e),i(n(90758),e),i(n(44416),e),i(n(33661),e),i(n(64304),e),i(n(2886),e),i(n(61732),e),i(n(59795),e),i(n(36882),e),i(n(28795),e),i(n(86874),e),i(n(95310),e)},10186:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.updateRateInterestBearingMint=e.createInterestBearingMint=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(74227),u=n(90758),c=n(50472);e.createInterestBearingMint=function(t,e,n,o,d,l,h,f=i.Keypair.generate(),p,m=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(0,u.getMintLen)([u.ExtensionType.InterestBearingConfig]),s=yield t.getMinimumBalanceForRentExemption(r),g=(new i.Transaction).add(i.SystemProgram.createAccount({fromPubkey:e.publicKey,newAccountPubkey:f.publicKey,space:r,lamports:s,programId:m}),(0,c.createInitializeInterestBearingMintInstruction)(f.publicKey,d,l,m),(0,a.createInitializeMintInstruction)(f.publicKey,h,n,o,m));return yield(0,i.sendAndConfirmTransaction)(t,g,[e,f],p),f.publicKey}))},e.updateRateInterestBearingMint=function(t,e,n,a,u,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(a,d),f=(new i.Transaction).add((0,c.createUpdateRateInterestBearingMintInstruction)(n,r,u,s,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,a,...s],l)}))}},33661:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(10186),e),i(n(50472),e),i(n(4567),e)},50472:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createUpdateRateInterestBearingMintInstruction=e.createInitializeInterestBearingMintInstruction=e.interestBearingMintUpdateRateInstructionData=e.interestBearingMintInitializeInstructionData=e.InterestBearingMintInstruction=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(59546),c=n(47623);var d;!function(t){t[t.Initialize=0]="Initialize",t[t.UpdateRate=1]="UpdateRate"}(d||(e.InterestBearingMintInstruction=d={})),e.interestBearingMintInitializeInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("interestBearingMintInstruction"),(0,o.publicKey)("rateAuthority"),(0,i.s16)("rate")]),e.interestBearingMintUpdateRateInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("interestBearingMintInstruction"),(0,i.s16)("rate")]),e.createInitializeInterestBearingMintInstruction=function(t,n,i,o=a.TOKEN_2022_PROGRAM_ID){const u=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.interestBearingMintInitializeInstructionData.span);return e.interestBearingMintInitializeInstructionData.encode({instruction:c.TokenInstruction.InterestBearingMintExtension,interestBearingMintInstruction:d.Initialize,rateAuthority:n,rate:i},l),new s.TransactionInstruction({keys:u,programId:o,data:l})},e.createUpdateRateInterestBearingMintInstruction=function(t,n,i,o=[],l=a.TOKEN_2022_PROGRAM_ID){const h=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!o.length,isWritable:!1}],n,o),f=r.alloc(e.interestBearingMintUpdateRateInstructionData.span);return e.interestBearingMintUpdateRateInstructionData.encode({instruction:c.TokenInstruction.InterestBearingMintExtension,interestBearingMintInstruction:d.UpdateRate,rate:i},f),new s.TransactionInstruction({keys:h,programId:l,data:f})}},4567:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getInterestBearingMintConfigState=e.INTEREST_BEARING_MINT_CONFIG_STATE_SIZE=e.InterestBearingMintConfigStateLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.InterestBearingMintConfigStateLayout=(0,r.struct)([(0,i.publicKey)("rateAuthority"),(0,r.ns64)("initializationTimestamp"),(0,r.s16)("preUpdateAverageRate"),(0,r.ns64)("lastUpdateTimestamp"),(0,r.s16)("currentRate")]),e.INTEREST_BEARING_MINT_CONFIG_STATE_SIZE=e.InterestBearingMintConfigStateLayout.span,e.getInterestBearingMintConfigState=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.InterestBearingConfig,t.tlvData);return null!==n?e.InterestBearingMintConfigStateLayout.decode(n):null}},53868:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.disableRequiredMemoTransfers=e.enableRequiredMemoTransfers=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(40044);e.enableRequiredMemoTransfers=function(t,e,n,u,c=[],d,l=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(u,c),h=(new i.Transaction).add((0,a.createEnableRequiredMemoTransfersInstruction)(n,r,s,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...s],d)}))},e.disableRequiredMemoTransfers=function(t,e,n,u,c=[],d,l=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(u,c),h=(new i.Transaction).add((0,a.createDisableRequiredMemoTransfersInstruction)(n,r,s,l));return yield(0,i.sendAndConfirmTransaction)(t,h,[e,...s],d)}))}},64304:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(53868),e),i(n(40044),e),i(n(52700),e)},40044:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createDisableRequiredMemoTransfersInstruction=e.createEnableRequiredMemoTransfersInstruction=e.memoTransferInstructionData=e.MemoTransferInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);var d;function l(t,n,i,d,l){if(!(0,s.programSupportsExtensions)(l))throw new a.TokenUnsupportedInstructionError;const h=(0,u.addSigners)([{pubkey:n,isSigner:!1,isWritable:!0}],i,d),f=r.alloc(e.memoTransferInstructionData.span);return e.memoTransferInstructionData.encode({instruction:c.TokenInstruction.MemoTransferExtension,memoTransferInstruction:t},f),new o.TransactionInstruction({keys:h,programId:l,data:f})}!function(t){t[t.Enable=0]="Enable",t[t.Disable=1]="Disable"}(d||(e.MemoTransferInstruction=d={})),e.memoTransferInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("memoTransferInstruction")]),e.createEnableRequiredMemoTransfersInstruction=function(t,e,n=[],r=s.TOKEN_2022_PROGRAM_ID){return l(d.Enable,t,e,n,r)},e.createDisableRequiredMemoTransfersInstruction=function(t,e,n=[],r=s.TOKEN_2022_PROGRAM_ID){return l(d.Disable,t,e,n,r)}},52700:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getMemoTransfer=e.MEMO_TRANSFER_SIZE=e.MemoTransferLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.MemoTransferLayout=(0,r.struct)([(0,i.bool)("requireIncomingTransferMemos")]),e.MEMO_TRANSFER_SIZE=e.MemoTransferLayout.span,e.getMemoTransfer=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.MemoTransfer,t.tlvData);return null!==n?e.MemoTransferLayout.decode(n):null}},2886:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(3755),e),i(n(83239),e)},3755:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createUpdateMetadataPointerInstruction=e.updateMetadataPointerData=e.createInitializeMetadataPointerInstruction=e.initializeMetadataPointerData=e.MetadataPointerInstruction=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623),d=n(59546);var l;!function(t){t[t.Initialize=0]="Initialize",t[t.Update=1]="Update"}(l||(e.MetadataPointerInstruction=l={})),e.initializeMetadataPointerData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("metadataPointerInstruction"),(0,o.publicKey)("authority"),(0,o.publicKey)("metadataAddress")]),e.createInitializeMetadataPointerInstruction=function(t,n,i,o){if(!(0,a.programSupportsExtensions)(o))throw new u.TokenUnsupportedInstructionError;const d=[{pubkey:t,isSigner:!1,isWritable:!0}],h=r.alloc(e.initializeMetadataPointerData.span);return e.initializeMetadataPointerData.encode({instruction:c.TokenInstruction.MetadataPointerExtension,metadataPointerInstruction:l.Initialize,authority:null!=n?n:s.PublicKey.default,metadataAddress:null!=i?i:s.PublicKey.default},h),new s.TransactionInstruction({keys:d,programId:o,data:h})},e.updateMetadataPointerData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("metadataPointerInstruction"),(0,o.publicKey)("metadataAddress")]),e.createUpdateMetadataPointerInstruction=function(t,n,i,o=[],h=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(h))throw new u.TokenUnsupportedInstructionError;const f=(0,d.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],n,o),p=r.alloc(e.updateMetadataPointerData.span);return e.updateMetadataPointerData.encode({instruction:c.TokenInstruction.MetadataPointerExtension,metadataPointerInstruction:l.Update,metadataAddress:null!=i?i:s.PublicKey.default},p),new s.TransactionInstruction({keys:f,programId:h,data:p})}},83239:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getMetadataPointerState=e.METADATA_POINTER_SIZE=e.MetadataPointerLayout=void 0;const r=n(39386),i=n(27278),o=n(18245),s=n(90758);e.MetadataPointerLayout=(0,r.struct)([(0,i.publicKey)("authority"),(0,i.publicKey)("metadataAddress")]),e.METADATA_POINTER_SIZE=e.MetadataPointerLayout.span,e.getMetadataPointerState=function(t){const n=(0,s.getExtensionData)(s.ExtensionType.MetadataPointer,t.tlvData);if(null!==n){const{authority:t,metadataAddress:r}=e.MetadataPointerLayout.decode(n);return{authority:t.equals(o.PublicKey.default)?null:t,metadataAddress:r.equals(o.PublicKey.default)?null:r}}return null}},59795:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getMintCloseAuthority=e.MINT_CLOSE_AUTHORITY_SIZE=e.MintCloseAuthorityLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.MintCloseAuthorityLayout=(0,r.struct)([(0,i.publicKey)("closeAuthority")]),e.MINT_CLOSE_AUTHORITY_SIZE=e.MintCloseAuthorityLayout.span,e.getMintCloseAuthority=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.MintCloseAuthority,t.tlvData);return null!==n?e.MintCloseAuthorityLayout.decode(n):null}},36882:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNonTransferableAccount=e.getNonTransferable=e.NON_TRANSFERABLE_ACCOUNT_SIZE=e.NON_TRANSFERABLE_SIZE=e.NonTransferableLayout=void 0;const r=n(39386),i=n(90758);e.NonTransferableLayout=(0,r.struct)([]),e.NON_TRANSFERABLE_SIZE=e.NonTransferableLayout.span,e.NON_TRANSFERABLE_ACCOUNT_SIZE=e.NonTransferableLayout.span,e.getNonTransferable=function(t){const n=(0,i.getExtensionData)(i.ExtensionType.NonTransferable,t.tlvData);return null!==n?e.NonTransferableLayout.decode(n):null},e.getNonTransferableAccount=function(t){const n=(0,i.getExtensionData)(i.ExtensionType.NonTransferableAccount,t.tlvData);return null!==n?e.NonTransferableLayout.decode(n):null}},86874:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getPermanentDelegate=e.PERMANENT_DELEGATE_SIZE=e.PermanentDelegateLayout=void 0;const r=n(39386),i=n(27278),o=n(90758);e.PermanentDelegateLayout=(0,r.struct)([(0,i.publicKey)("delegate")]),e.PERMANENT_DELEGATE_SIZE=e.PermanentDelegateLayout.span,e.getPermanentDelegate=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.PermanentDelegate,t.tlvData);return null!==n?e.PermanentDelegateLayout.decode(n):null}},4461:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.tokenMetadataUpdateAuthority=e.tokenMetadataRemoveKey=e.tokenMetadataUpdateFieldWithRentTransfer=e.tokenMetadataUpdateField=e.tokenMetadataInitializeWithRentTransfer=e.tokenMetadataInitialize=void 0;const i=n(18245),o=n(99564),s=n(44530),a=n(51421),u=n(90758),c=n(38257),d=n(60913),l=n(40982);e.tokenMetadataInitialize=function(t,e,n,u,c,d,l,h,f=[],p,m=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,a.getSigners)(c,f),g=(new i.Transaction).add((0,o.createInitializeInstruction)({programId:m,metadata:n,updateAuthority:u,mint:n,mintAuthority:r,name:d,symbol:l,uri:h}));return yield(0,i.sendAndConfirmTransaction)(t,g,[e,...s],p)}))},e.tokenMetadataInitializeWithRentTransfer=function(t,e,n,c,l,h,f,p,m=[],g,y=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[b,w]=(0,a.getSigners)(l,m),_=new i.Transaction,v=yield function(t,e,n,i=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=yield t.getAccountInfo(e);if(!r)throw new d.TokenAccountNotFoundError;const s=(0,o.pack)(n).length,a=(0,u.getNewAccountLenForExtensionLen)(r,e,u.ExtensionType.TokenMetadata,s,i);return a<=r.data.length?0:(yield t.getMinimumBalanceForRentExemption(a))-r.lamports}))}(t,n,{updateAuthority:c,mint:n,name:h,symbol:f,uri:p,additionalMetadata:[]},y);return v>0&&_.add(i.SystemProgram.transfer({fromPubkey:e.publicKey,toPubkey:n,lamports:v})),_.add((0,o.createInitializeInstruction)({programId:y,metadata:n,updateAuthority:c,mint:n,mintAuthority:b,name:h,symbol:f,uri:p})),yield(0,i.sendAndConfirmTransaction)(t,_,[e,...w],g)}))},e.tokenMetadataUpdateField=function(t,e,n,u,c,d,l=[],h,f=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,a.getSigners)(u,l),p=(new i.Transaction).add((0,o.createUpdateFieldInstruction)({programId:f,metadata:n,updateAuthority:r,field:c,value:d}));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...s],h)}))},e.tokenMetadataUpdateFieldWithRentTransfer=function(t,e,n,h,f,p,m=[],g,y=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[b,w]=(0,a.getSigners)(h,m),_=new i.Transaction,v=yield function(t,e,n,i,a=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=yield t.getAccountInfo(e);if(!r)throw new d.TokenAccountNotFoundError;const s=(0,l.unpackMint)(e,r,a),h=(0,u.getExtensionData)(u.ExtensionType.TokenMetadata,s.tlvData);if(null===h)throw new Error("TokenMetadata extension not initialized");const f=(0,c.updateTokenMetadata)((0,o.unpack)(h),n,i),p=(0,o.pack)(f).length,m=(0,u.getNewAccountLenForExtensionLen)(r,e,u.ExtensionType.TokenMetadata,p,a);return m<=r.data.length?0:(yield t.getMinimumBalanceForRentExemption(m))-r.lamports}))}(t,n,f,p,y);return v>0&&_.add(i.SystemProgram.transfer({fromPubkey:e.publicKey,toPubkey:n,lamports:v})),_.add((0,o.createUpdateFieldInstruction)({programId:y,metadata:n,updateAuthority:b,field:f,value:p})),yield(0,i.sendAndConfirmTransaction)(t,_,[e,...w],g)}))},e.tokenMetadataRemoveKey=function(t,e,n,u,c,d,l=[],h,f=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,a.getSigners)(u,l),p=(new i.Transaction).add((0,o.createRemoveKeyInstruction)({programId:f,metadata:n,updateAuthority:r,key:c,idempotent:d}));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...s],h)}))},e.tokenMetadataUpdateAuthority=function(t,e,n,u,c,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,a.getSigners)(u,d),f=(new i.Transaction).add((0,o.createUpdateAuthorityInstruction)({programId:h,metadata:n,oldAuthority:r,newAuthority:c}));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...s],l)}))}},61732:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(4461),e),i(n(38257),e)},38257:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getTokenMetadata=e.updateTokenMetadata=void 0;const i=n(99564),o=n(44530),s=n(90758),a=n(66446);e.updateTokenMetadata=function(t,e,n){const r=(t=>t===i.Field.Name||"Name"===t||"name"===t?"name":t===i.Field.Symbol||"Symbol"===t||"symbol"===t?"symbol":t===i.Field.Uri||"Uri"===t||"uri"===t?"uri":t)(e);if("mint"===r||"updateAuthority"===r)throw new Error(`Cannot update ${r} via this instruction`);if(["name","symbol","uri"].includes(r))return Object.assign(Object.assign({},t),{[r]:n});const o=[...t.additionalMetadata],s=t.additionalMetadata.findIndex((t=>t[0]===r));return-1===s?o.push([r,n]):o[s]=[r,n],Object.assign(Object.assign({},t),{additionalMetadata:o})},e.getTokenMetadata=function(t,e,n,u=o.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=yield(0,a.getMint)(t,e,n,u),o=(0,s.getExtensionData)(s.ExtensionType.TokenMetadata,r.tlvData);return null===o?null:(0,i.unpack)(o)}))}},25297:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.harvestWithheldTokensToMint=e.withdrawWithheldTokensFromAccounts=e.withdrawWithheldTokensFromMint=e.transferCheckedWithFee=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(29520);e.transferCheckedWithFee=function(t,e,n,u,c,d,l,h,f,p=[],m,g=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(d,p),y=(new i.Transaction).add((0,a.createTransferCheckedWithFeeInstruction)(n,u,c,r,l,h,f,p,g));return yield(0,i.sendAndConfirmTransaction)(t,y,[e,...s],m)}))},e.withdrawWithheldTokensFromMint=function(t,e,n,u,c,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(c,d),f=(new i.Transaction).add((0,a.createWithdrawWithheldTokensFromMintInstruction)(n,u,r,s,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...s],l)}))},e.withdrawWithheldTokensFromAccounts=function(t,e,n,u,c,d,l,h,f=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(c,d),p=(new i.Transaction).add((0,a.createWithdrawWithheldTokensFromAccountsInstruction)(n,u,r,s,l,f));return yield(0,i.sendAndConfirmTransaction)(t,p,[e,...s],h)}))},e.harvestWithheldTokensToMint=function(t,e,n,o,u,c=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(new i.Transaction).add((0,a.createHarvestWithheldTokensToMintInstruction)(n,o,c));return yield(0,i.sendAndConfirmTransaction)(t,r,[e],u)}))}},28795:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(25297),e),i(n(29520),e),i(n(96663),e)},29520:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHarvestWithheldTokensToMintInstructionUnchecked=e.decodeHarvestWithheldTokensToMintInstruction=e.createHarvestWithheldTokensToMintInstruction=e.harvestWithheldTokensToMintInstructionData=e.decodeWithdrawWithheldTokensFromAccountsInstructionUnchecked=e.decodeWithdrawWithheldTokensFromAccountsInstruction=e.createWithdrawWithheldTokensFromAccountsInstruction=e.withdrawWithheldTokensFromAccountsInstructionData=e.decodeWithdrawWithheldTokensFromMintInstructionUnchecked=e.decodeWithdrawWithheldTokensFromMintInstruction=e.createWithdrawWithheldTokensFromMintInstruction=e.withdrawWithheldTokensFromMintInstructionData=e.decodeTransferCheckedWithFeeInstructionUnchecked=e.decodeTransferCheckedWithFeeInstruction=e.createTransferCheckedWithFeeInstruction=e.transferCheckedWithFeeInstructionData=e.decodeInitializeTransferFeeConfigInstructionUnchecked=e.decodeInitializeTransferFeeConfigInstruction=e.createInitializeTransferFeeConfigInstruction=e.initializeTransferFeeConfigInstructionData=e.TransferFeeInstruction=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);var l;function h({programId:t,keys:[n],data:r}){const{instruction:i,transferFeeInstruction:o,transferFeeConfigAuthorityOption:s,transferFeeConfigAuthority:a,withdrawWithheldAuthorityOption:u,withdrawWithheldAuthority:c,transferFeeBasisPoints:d,maximumFee:l}=e.initializeTransferFeeConfigInstructionData.decode(r);return{programId:t,keys:{mint:n},data:{instruction:i,transferFeeInstruction:o,transferFeeConfigAuthority:s?a:null,withdrawWithheldAuthority:u?c:null,transferFeeBasisPoints:d,maximumFee:l}}}function f({programId:t,keys:[n,r,i,o,...s],data:a}){const{instruction:u,transferFeeInstruction:c,amount:d,decimals:l,fee:h}=e.transferCheckedWithFeeInstructionData.decode(a);return{programId:t,keys:{source:n,mint:r,destination:i,authority:o,signers:s},data:{instruction:u,transferFeeInstruction:c,amount:d,decimals:l,fee:h}}}function p({programId:t,keys:[n,r,i,...o],data:s}){const{instruction:a,transferFeeInstruction:u}=e.withdrawWithheldTokensFromMintInstructionData.decode(s);return{programId:t,keys:{mint:n,destination:r,authority:i,signers:o},data:{instruction:a,transferFeeInstruction:u}}}function m({programId:t,keys:n,data:r}){const{instruction:i,transferFeeInstruction:o,numTokenAccounts:s}=e.withdrawWithheldTokensFromAccountsInstructionData.decode(r),[a,u,c,d,l]=[n[0],n[1],n[2],n.slice(3,3+s),n.slice(-1*s)];return{programId:t,keys:{mint:a,destination:u,authority:c,signers:d,sources:l},data:{instruction:i,transferFeeInstruction:o,numTokenAccounts:s}}}function g({programId:t,keys:[n,...r],data:i}){const{instruction:o,transferFeeInstruction:s}=e.harvestWithheldTokensToMintInstructionData.decode(i);return{programId:t,keys:{mint:n,sources:r},data:{instruction:o,transferFeeInstruction:s}}}!function(t){t[t.InitializeTransferFeeConfig=0]="InitializeTransferFeeConfig",t[t.TransferCheckedWithFee=1]="TransferCheckedWithFee",t[t.WithdrawWithheldTokensFromMint=2]="WithdrawWithheldTokensFromMint",t[t.WithdrawWithheldTokensFromAccounts=3]="WithdrawWithheldTokensFromAccounts",t[t.HarvestWithheldTokensToMint=4]="HarvestWithheldTokensToMint",t[t.SetTransferFee=5]="SetTransferFee"}(l||(e.TransferFeeInstruction=l={})),e.initializeTransferFeeConfigInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction"),(0,i.u8)("transferFeeConfigAuthorityOption"),(0,o.publicKey)("transferFeeConfigAuthority"),(0,i.u8)("withdrawWithheldAuthorityOption"),(0,o.publicKey)("withdrawWithheldAuthority"),(0,i.u16)("transferFeeBasisPoints"),(0,o.u64)("maximumFee")]),e.createInitializeTransferFeeConfigInstruction=function(t,n,i,o,c,h=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(h))throw new u.TokenUnsupportedInstructionError;const f=[{pubkey:t,isSigner:!1,isWritable:!0}],p=r.alloc(e.initializeTransferFeeConfigInstructionData.span);return e.initializeTransferFeeConfigInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.InitializeTransferFeeConfig,transferFeeConfigAuthorityOption:n?1:0,transferFeeConfigAuthority:n||new s.PublicKey(0),withdrawWithheldAuthorityOption:i?1:0,withdrawWithheldAuthority:i||new s.PublicKey(0),transferFeeBasisPoints:o,maximumFee:c},p),new s.TransactionInstruction({keys:f,programId:h,data:p})},e.decodeInitializeTransferFeeConfigInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeTransferFeeConfigInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=h(t);if(i.instruction!==d.TokenInstruction.TransferFeeExtension||i.transferFeeInstruction!==l.InitializeTransferFeeConfig)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeInitializeTransferFeeConfigInstructionUnchecked=h,e.transferCheckedWithFeeInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction"),(0,o.u64)("amount"),(0,i.u8)("decimals"),(0,o.u64)("fee")]),e.createTransferCheckedWithFeeInstruction=function(t,n,i,o,h,f,p,m=[],g=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(g))throw new u.TokenUnsupportedInstructionError;const y=r.alloc(e.transferCheckedWithFeeInstructionData.span);e.transferCheckedWithFeeInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.TransferCheckedWithFee,amount:h,decimals:f,fee:p},y);const b=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!0}],o,m);return new s.TransactionInstruction({keys:b,programId:g,data:y})},e.decodeTransferCheckedWithFeeInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.transferCheckedWithFeeInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{source:r,mint:i,destination:o,authority:s,signers:a},data:c}=f(t);if(c.instruction!==d.TokenInstruction.TransferFeeExtension||c.transferFeeInstruction!==l.TransferCheckedWithFee)throw new u.TokenInvalidInstructionTypeError;if(!i)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{source:r,mint:i,destination:o,authority:s,signers:a||null},data:c}},e.decodeTransferCheckedWithFeeInstructionUnchecked=f,e.withdrawWithheldTokensFromMintInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction")]),e.createWithdrawWithheldTokensFromMintInstruction=function(t,n,i,o=[],h=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(h))throw new u.TokenUnsupportedInstructionError;const f=r.alloc(e.withdrawWithheldTokensFromMintInstructionData.span);e.withdrawWithheldTokensFromMintInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.WithdrawWithheldTokensFromMint},f);const p=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,o);return new s.TransactionInstruction({keys:p,programId:h,data:f})},e.decodeWithdrawWithheldTokensFromMintInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.withdrawWithheldTokensFromMintInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,destination:i,authority:o,signers:s},data:a}=p(t);if(a.instruction!==d.TokenInstruction.TransferFeeExtension||a.transferFeeInstruction!==l.WithdrawWithheldTokensFromMint)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,destination:i,authority:o,signers:s||null},data:a}},e.decodeWithdrawWithheldTokensFromMintInstructionUnchecked=p,e.withdrawWithheldTokensFromAccountsInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction"),(0,i.u8)("numTokenAccounts")]),e.createWithdrawWithheldTokensFromAccountsInstruction=function(t,n,i,o,h,f=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(f))throw new u.TokenUnsupportedInstructionError;const p=r.alloc(e.withdrawWithheldTokensFromAccountsInstructionData.span);e.withdrawWithheldTokensFromAccountsInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.WithdrawWithheldTokensFromAccounts,numTokenAccounts:h.length},p);const m=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,o);for(const t of h)m.push({pubkey:t,isSigner:!1,isWritable:!0});return new s.TransactionInstruction({keys:m,programId:f,data:p})},e.decodeWithdrawWithheldTokensFromAccountsInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.withdrawWithheldTokensFromAccountsInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,destination:i,authority:o,signers:s,sources:a},data:c}=m(t);if(c.instruction!==d.TokenInstruction.TransferFeeExtension||c.transferFeeInstruction!==l.WithdrawWithheldTokensFromAccounts)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,destination:i,authority:o,signers:s||null,sources:a||null},data:c}},e.decodeWithdrawWithheldTokensFromAccountsInstructionUnchecked=m,e.harvestWithheldTokensToMintInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("transferFeeInstruction")]),e.createHarvestWithheldTokensToMintInstruction=function(t,n,i=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(i))throw new u.TokenUnsupportedInstructionError;const o=r.alloc(e.harvestWithheldTokensToMintInstructionData.span);e.harvestWithheldTokensToMintInstructionData.encode({instruction:d.TokenInstruction.TransferFeeExtension,transferFeeInstruction:l.HarvestWithheldTokensToMint},o);const c=[];c.push({pubkey:t,isSigner:!1,isWritable:!0});for(const t of n)c.push({pubkey:t,isSigner:!1,isWritable:!0});return new s.TransactionInstruction({keys:c,programId:i,data:o})},e.decodeHarvestWithheldTokensToMintInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.harvestWithheldTokensToMintInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,sources:i},data:o}=g(t);if(o.instruction!==d.TokenInstruction.TransferFeeExtension||o.transferFeeInstruction!==l.HarvestWithheldTokensToMint)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,sources:i},data:o}},e.decodeHarvestWithheldTokensToMintInstructionUnchecked=g},96663:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTransferFeeAmount=e.getTransferFeeConfig=e.TRANSFER_FEE_AMOUNT_SIZE=e.TransferFeeAmountLayout=e.calculateEpochFee=e.getEpochFee=e.TRANSFER_FEE_CONFIG_SIZE=e.TransferFeeConfigLayout=e.calculateFee=e.transferFeeLayout=e.ONE_IN_BASIS_POINTS=e.MAX_FEE_BASIS_POINTS=void 0;const r=n(39386),i=n(27278),o=n(90758);function s(t){return(0,r.struct)([(0,i.u64)("epoch"),(0,i.u64)("maximumFee"),(0,r.u16)("transferFeeBasisPoints")],t)}function a(t,n){const r=t.transferFeeBasisPoints;if(0===r||n===BigInt(0))return BigInt(0);{const i=(n*BigInt(r)+e.ONE_IN_BASIS_POINTS-BigInt(1))/e.ONE_IN_BASIS_POINTS,o=i>t.maximumFee?t.maximumFee:i;return BigInt(o)}}function u(t,e){return e>=t.newerTransferFee.epoch?t.newerTransferFee:t.olderTransferFee}e.MAX_FEE_BASIS_POINTS=1e4,e.ONE_IN_BASIS_POINTS=BigInt(e.MAX_FEE_BASIS_POINTS),e.transferFeeLayout=s,e.calculateFee=a,e.TransferFeeConfigLayout=(0,r.struct)([(0,i.publicKey)("transferFeeConfigAuthority"),(0,i.publicKey)("withdrawWithheldAuthority"),(0,i.u64)("withheldAmount"),s("olderTransferFee"),s("newerTransferFee")]),e.TRANSFER_FEE_CONFIG_SIZE=e.TransferFeeConfigLayout.span,e.getEpochFee=u,e.calculateEpochFee=function(t,e,n){return a(u(t,e),n)},e.TransferFeeAmountLayout=(0,r.struct)([(0,i.u64)("withheldAmount")]),e.TRANSFER_FEE_AMOUNT_SIZE=e.TransferFeeAmountLayout.span,e.getTransferFeeConfig=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.TransferFeeConfig,t.tlvData);return null!==n?e.TransferFeeConfigLayout.decode(n):null},e.getTransferFeeAmount=function(t){const n=(0,o.getExtensionData)(o.ExtensionType.TransferFeeAmount,t.tlvData);return null!==n?e.TransferFeeAmountLayout.decode(n):null}},28680:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.transferCheckedWithFeeAndTransferHook=e.transferCheckedWithTransferHook=e.updateTransferHook=e.initializeTransferHook=void 0;const i=n(18245),o=n(51421),s=n(44530),a=n(92187);e.initializeTransferHook=function(t,e,n,o,u,c,d=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=(new i.Transaction).add((0,a.createInitializeTransferHookInstruction)(n,o,u,d));return yield(0,i.sendAndConfirmTransaction)(t,r,[e],c)}))},e.updateTransferHook=function(t,e,n,u,c,d=[],l,h=s.TOKEN_2022_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(c,d),f=(new i.Transaction).add((0,a.createUpdateTransferHookInstruction)(n,r,u,s,h));return yield(0,i.sendAndConfirmTransaction)(t,f,[e,...s],l)}))},e.transferCheckedWithTransferHook=function(t,e,n,u,c,d,l,h,f=[],p,m=s.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(d,f),g=(new i.Transaction).add(yield(0,a.createTransferCheckedWithTransferHookInstruction)(t,n,u,c,r,l,h,s,null==p?void 0:p.commitment,m));return yield(0,i.sendAndConfirmTransaction)(t,g,[e,...s],p)}))},e.transferCheckedWithFeeAndTransferHook=function(t,e,n,u,c,d,l,h,f,p=[],m,g=s.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const[r,s]=(0,o.getSigners)(d,p),y=(new i.Transaction).add(yield(0,a.createTransferCheckedWithFeeAndTransferHookInstruction)(t,n,u,c,r,l,h,f,s,null==m?void 0:m.commitment,g));return yield(0,i.sendAndConfirmTransaction)(t,y,[e,...s],m)}))}},95310:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(28680),e),i(n(92187),e),i(n(76020),e),i(n(73322),e)},92187:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.createTransferCheckedWithFeeAndTransferHookInstruction=e.createTransferCheckedWithTransferHookInstruction=e.addExtraAccountsToInstruction=e.createUpdateTransferHookInstruction=e.updateTransferHookInstructionData=e.createInitializeTransferHookInstruction=e.initializeTransferHookInstructionData=e.TransferHookInstruction=void 0;const o=n(39386),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623),l=n(27278),h=n(35593),f=n(29520),p=n(66446),m=n(73322);var g;function y(t,e){const n=e.filter((e=>e.pubkey===t.pubkey)).reduce(((t,e)=>t?{isSigner:t.isSigner||e.isSigner,isWritable:t.isWritable||e.isWritable}:{isSigner:e.isSigner,isWritable:e.isWritable}),void 0);if(n){const{isSigner:e,isWritable:r}=n;e||e===t.isSigner||(t.isSigner=!1),r||r===t.isWritable||(t.isWritable=!1)}return t}function b(t,e,n,r,o=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){if(!(0,a.programSupportsExtensions)(o))throw new u.TokenUnsupportedInstructionError;const i=yield(0,p.getMint)(t,n,r,o),c=(0,m.getTransferHook)(i);if(null==c)return e;const d=(0,m.getExtraAccountMetaAddress)(n,c.programId),l=yield t.getAccountInfo(d,r);if(null==l)return e;const h=(0,m.getExtraAccountMetas)(l),f=e.keys;for(const n of h){const r=y(yield(0,m.resolveExtraAccountMeta)(t,n,f,e.data,c.programId),f);f.push(r)}return f.push({pubkey:c.programId,isSigner:!1,isWritable:!1}),f.push({pubkey:d,isSigner:!1,isWritable:!1}),new s.TransactionInstruction({keys:f,programId:o,data:e.data})}))}!function(t){t[t.Initialize=0]="Initialize",t[t.Update=1]="Update"}(g||(e.TransferHookInstruction=g={})),e.initializeTransferHookInstructionData=(0,o.struct)([(0,o.u8)("instruction"),(0,o.u8)("transferHookInstruction"),(0,l.publicKey)("authority"),(0,l.publicKey)("transferHookProgramId")]),e.createInitializeTransferHookInstruction=function(t,n,i,o){if(!(0,a.programSupportsExtensions)(o))throw new u.TokenUnsupportedInstructionError;const c=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.initializeTransferHookInstructionData.span);return e.initializeTransferHookInstructionData.encode({instruction:d.TokenInstruction.TransferHookExtension,transferHookInstruction:g.Initialize,authority:n,transferHookProgramId:i},l),new s.TransactionInstruction({keys:c,programId:o,data:l})},e.updateTransferHookInstructionData=(0,o.struct)([(0,o.u8)("instruction"),(0,o.u8)("transferHookInstruction"),(0,l.publicKey)("transferHookProgramId")]),e.createUpdateTransferHookInstruction=function(t,n,i,o=[],l=a.TOKEN_2022_PROGRAM_ID){if(!(0,a.programSupportsExtensions)(l))throw new u.TokenUnsupportedInstructionError;const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],n,o),f=r.alloc(e.updateTransferHookInstructionData.span);return e.updateTransferHookInstructionData.encode({instruction:d.TokenInstruction.TransferHookExtension,transferHookInstruction:g.Update,transferHookProgramId:i},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.addExtraAccountsToInstruction=b,e.createTransferCheckedWithTransferHookInstruction=function(t,e,n,r,o,s,u,c=[],d,l=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=(0,h.createTransferCheckedInstruction)(e,n,r,o,s,u,c,l);return yield b(t,i,n,d,l)}))},e.createTransferCheckedWithFeeAndTransferHookInstruction=function(t,e,n,r,o,s,u,c,d=[],l,h=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=(0,f.createTransferCheckedWithFeeInstruction)(e,n,r,o,s,u,c,d,h);return yield b(t,i,n,l,h)}))}},76020:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.unpackSeeds=void 0;const o=n(60913);function s(t,e,n,s){return i(this,void 0,void 0,(function*(){const[a,...u]=t,c=new Uint8Array(u);switch(a){case 0:return null;case 1:return function(t){if(t.length<1)throw new o.TokenTransferHookInvalidSeed;const[e,...n]=t;if(n.length{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAmountToUiAmountInstructionUnchecked=e.decodeAmountToUiAmountInstruction=e.createAmountToUiAmountInstruction=e.amountToUiAmountInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n],data:r}){return{programId:t,keys:{mint:n},data:e.amountToUiAmountInstructionData.decode(r)}}e.amountToUiAmountInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createAmountToUiAmountInstruction=function(t,n,i=a.TOKEN_PROGRAM_ID){const o=[{pubkey:t,isSigner:!1,isWritable:!1}],u=r.alloc(e.amountToUiAmountInstructionData.span);return e.amountToUiAmountInstructionData.encode({instruction:c.TokenInstruction.AmountToUiAmount,amount:BigInt(n)},u),new s.TransactionInstruction({keys:o,programId:i,data:u})},e.decodeAmountToUiAmountInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.amountToUiAmountInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=d(t);if(i.instruction!==c.TokenInstruction.AmountToUiAmount)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeAmountToUiAmountInstructionUnchecked=d},55431:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeApproveInstructionUnchecked=e.decodeApproveInstruction=e.createApproveInstruction=e.approveInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,delegate:r,owner:i,multiSigners:o},data:e.approveInstructionData.decode(s)}}e.approveInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createApproveInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],i,u),f=r.alloc(e.approveInstructionData.span);return e.approveInstructionData.encode({instruction:d.TokenInstruction.Approve,amount:BigInt(o)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeApproveInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.approveInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,delegate:i,owner:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.Approve)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,delegate:i,owner:o,multiSigners:s},data:c}},e.decodeApproveInstructionUnchecked=l},18228:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeApproveCheckedInstructionUnchecked=e.decodeApproveCheckedInstruction=e.createApproveCheckedInstruction=e.approveCheckedInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,o,...s],data:a}){return{programId:t,keys:{account:n,mint:r,delegate:i,owner:o,multiSigners:s},data:e.approveCheckedInstructionData.decode(a)}}e.approveCheckedInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount"),(0,i.u8)("decimals")]),e.createApproveCheckedInstruction=function(t,n,i,o,u,l,h=[],f=a.TOKEN_PROGRAM_ID){const p=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1}],o,h),m=r.alloc(e.approveCheckedInstructionData.span);return e.approveCheckedInstructionData.encode({instruction:d.TokenInstruction.ApproveChecked,amount:BigInt(u),decimals:l},m),new s.TransactionInstruction({keys:p,programId:f,data:m})},e.decodeApproveCheckedInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.approveCheckedInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,delegate:o,owner:s,multiSigners:c},data:h}=l(t);if(h.instruction!==d.TokenInstruction.ApproveChecked)throw new u.TokenInvalidInstructionTypeError;if(!(r&&i&&o&&s))throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,delegate:o,owner:s,multiSigners:c},data:h}},e.decodeApproveCheckedInstructionUnchecked=l},31183:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createRecoverNestedInstruction=e.createAssociatedTokenAccountIdempotentInstruction=e.createAssociatedTokenAccountInstruction=void 0;const i=n(18245),o=n(44530);function s(t,e,n,r,s,a=o.TOKEN_PROGRAM_ID,u=o.ASSOCIATED_TOKEN_PROGRAM_ID){const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:i.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}];return new i.TransactionInstruction({keys:c,programId:u,data:s})}e.createAssociatedTokenAccountInstruction=function(t,e,n,i,a=o.TOKEN_PROGRAM_ID,u=o.ASSOCIATED_TOKEN_PROGRAM_ID){return s(t,e,n,i,r.alloc(0),a,u)},e.createAssociatedTokenAccountIdempotentInstruction=function(t,e,n,i,a=o.TOKEN_PROGRAM_ID,u=o.ASSOCIATED_TOKEN_PROGRAM_ID){return s(t,e,n,i,r.from([1]),a,u)},e.createRecoverNestedInstruction=function(t,e,n,s,a,u,c=o.TOKEN_PROGRAM_ID,d=o.ASSOCIATED_TOKEN_PROGRAM_ID){const l=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:a,isSigner:!1,isWritable:!1},{pubkey:u,isSigner:!0,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!1}];return new i.TransactionInstruction({keys:l,programId:d,data:r.from([2])})}},8339:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeBurnInstructionUnchecked=e.decodeBurnInstruction=e.createBurnInstruction=e.burnInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,mint:r,owner:i,multiSigners:o},data:e.burnInstructionData.decode(s)}}e.burnInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createBurnInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,u),f=r.alloc(e.burnInstructionData.span);return e.burnInstructionData.encode({instruction:d.TokenInstruction.Burn,amount:BigInt(o)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeBurnInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.burnInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,owner:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.Burn)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,owner:o,multiSigners:s},data:c}},e.decodeBurnInstructionUnchecked=l},1853:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeBurnCheckedInstructionUnchecked=e.decodeBurnCheckedInstruction=e.createBurnCheckedInstruction=e.burnCheckedInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,mint:r,owner:i,multiSigners:o},data:e.burnCheckedInstructionData.decode(s)}}e.burnCheckedInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount"),(0,i.u8)("decimals")]),e.createBurnCheckedInstruction=function(t,n,i,o,u,l=[],h=a.TOKEN_PROGRAM_ID){const f=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,l),p=r.alloc(e.burnCheckedInstructionData.span);return e.burnCheckedInstructionData.encode({instruction:d.TokenInstruction.BurnChecked,amount:BigInt(o),decimals:u},p),new s.TransactionInstruction({keys:f,programId:h,data:p})},e.decodeBurnCheckedInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.burnCheckedInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,owner:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.BurnChecked)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,owner:o,multiSigners:s},data:c}},e.decodeBurnCheckedInstructionUnchecked=l},36038:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeCloseAccountInstructionUnchecked=e.decodeCloseAccountInstruction=e.createCloseAccountInstruction=e.closeAccountInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);function d({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,destination:r,authority:i,multiSigners:o},data:e.closeAccountInstructionData.decode(s)}}e.closeAccountInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createCloseAccountInstruction=function(t,n,i,a=[],d=s.TOKEN_PROGRAM_ID){const l=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,a),h=r.alloc(e.closeAccountInstructionData.span);return e.closeAccountInstructionData.encode({instruction:c.TokenInstruction.CloseAccount},h),new o.TransactionInstruction({keys:l,programId:d,data:h})},e.decodeCloseAccountInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.closeAccountInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,destination:i,authority:o,multiSigners:u},data:l}=d(t);if(l.instruction!==c.TokenInstruction.CloseAccount)throw new a.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,destination:i,authority:o,multiSigners:u},data:l}},e.decodeCloseAccountInstructionUnchecked=d},42421:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createCreateNativeMintInstruction=e.createNativeMintInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);e.createNativeMintInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createCreateNativeMintInstruction=function(t,n=s.NATIVE_MINT_2022,i=s.TOKEN_2022_PROGRAM_ID){if(!(0,s.programSupportsExtensions)(i))throw new a.TokenUnsupportedInstructionError;const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:o.SystemProgram.programId,isSigner:!1,isWritable:!1}],d=r.alloc(e.createNativeMintInstructionData.span);return e.createNativeMintInstructionData.encode({instruction:u.TokenInstruction.CreateNativeMint},d),new o.TransactionInstruction({keys:c,programId:i,data:d})}},7561:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isUiamountToAmountInstruction=e.isAmountToUiAmountInstruction=e.isInitializeMint2Instruction=e.isInitializeAccount3Instruction=e.isSyncNativeInstruction=e.isInitializeAccount2Instruction=e.isBurnCheckedInstruction=e.isMintToCheckedInstruction=e.isApproveCheckedInstruction=e.isTransferCheckedInstruction=e.isThawAccountInstruction=e.isFreezeAccountInstruction=e.isCloseAccountInstruction=e.isBurnInstruction=e.isMintToInstruction=e.isSetAuthorityInstruction=e.isRevokeInstruction=e.isApproveInstruction=e.isTransferInstruction=e.isInitializeMultisigInstruction=e.isInitializeAccountInstruction=e.isInitializeMintInstruction=e.decodeInstruction=void 0;const r=n(39386),i=n(44530),o=n(60913),s=n(10540),a=n(55431),u=n(18228),c=n(8339),d=n(1853),l=n(36038),h=n(56513),f=n(58328),p=n(63642),m=n(25910),g=n(74227),y=n(19066),b=n(65061),w=n(74761),_=n(70698),v=n(62216),k=n(95816),M=n(75836),A=n(19040),S=n(72874),I=n(35593),x=n(47623),E=n(21470);e.decodeInstruction=function(t,e=i.TOKEN_PROGRAM_ID){if(!t.data.length)throw new o.TokenInvalidInstructionDataError;const n=(0,r.u8)().decode(t.data);if(n===x.TokenInstruction.InitializeMint)return(0,g.decodeInitializeMintInstruction)(t,e);if(n===x.TokenInstruction.InitializeAccount)return(0,f.decodeInitializeAccountInstruction)(t,e);if(n===x.TokenInstruction.InitializeMultisig)return(0,b.decodeInitializeMultisigInstruction)(t,e);if(n===x.TokenInstruction.Transfer)return(0,S.decodeTransferInstruction)(t,e);if(n===x.TokenInstruction.Approve)return(0,a.decodeApproveInstruction)(t,e);if(n===x.TokenInstruction.Revoke)return(0,v.decodeRevokeInstruction)(t,e);if(n===x.TokenInstruction.SetAuthority)return(0,k.decodeSetAuthorityInstruction)(t,e);if(n===x.TokenInstruction.MintTo)return(0,w.decodeMintToInstruction)(t,e);if(n===x.TokenInstruction.Burn)return(0,c.decodeBurnInstruction)(t,e);if(n===x.TokenInstruction.CloseAccount)return(0,l.decodeCloseAccountInstruction)(t,e);if(n===x.TokenInstruction.FreezeAccount)return(0,h.decodeFreezeAccountInstruction)(t,e);if(n===x.TokenInstruction.ThawAccount)return(0,A.decodeThawAccountInstruction)(t,e);if(n===x.TokenInstruction.TransferChecked)return(0,I.decodeTransferCheckedInstruction)(t,e);if(n===x.TokenInstruction.ApproveChecked)return(0,u.decodeApproveCheckedInstruction)(t,e);if(n===x.TokenInstruction.MintToChecked)return(0,_.decodeMintToCheckedInstruction)(t,e);if(n===x.TokenInstruction.BurnChecked)return(0,d.decodeBurnCheckedInstruction)(t,e);if(n===x.TokenInstruction.InitializeAccount2)return(0,p.decodeInitializeAccount2Instruction)(t,e);if(n===x.TokenInstruction.SyncNative)return(0,M.decodeSyncNativeInstruction)(t,e);if(n===x.TokenInstruction.InitializeAccount3)return(0,m.decodeInitializeAccount3Instruction)(t,e);if(n===x.TokenInstruction.InitializeMint2)return(0,y.decodeInitializeMint2Instruction)(t,e);if(n===x.TokenInstruction.AmountToUiAmount)return(0,s.decodeAmountToUiAmountInstruction)(t,e);if(n===x.TokenInstruction.UiAmountToAmount)return(0,E.decodeUiAmountToAmountInstruction)(t,e);if(n===x.TokenInstruction.InitializeMultisig2)throw new o.TokenInvalidInstructionTypeError;throw new o.TokenInvalidInstructionTypeError},e.isInitializeMintInstruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeMint},e.isInitializeAccountInstruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeAccount},e.isInitializeMultisigInstruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeMultisig},e.isTransferInstruction=function(t){return t.data.instruction===x.TokenInstruction.Transfer},e.isApproveInstruction=function(t){return t.data.instruction===x.TokenInstruction.Approve},e.isRevokeInstruction=function(t){return t.data.instruction===x.TokenInstruction.Revoke},e.isSetAuthorityInstruction=function(t){return t.data.instruction===x.TokenInstruction.SetAuthority},e.isMintToInstruction=function(t){return t.data.instruction===x.TokenInstruction.MintTo},e.isBurnInstruction=function(t){return t.data.instruction===x.TokenInstruction.Burn},e.isCloseAccountInstruction=function(t){return t.data.instruction===x.TokenInstruction.CloseAccount},e.isFreezeAccountInstruction=function(t){return t.data.instruction===x.TokenInstruction.FreezeAccount},e.isThawAccountInstruction=function(t){return t.data.instruction===x.TokenInstruction.ThawAccount},e.isTransferCheckedInstruction=function(t){return t.data.instruction===x.TokenInstruction.TransferChecked},e.isApproveCheckedInstruction=function(t){return t.data.instruction===x.TokenInstruction.ApproveChecked},e.isMintToCheckedInstruction=function(t){return t.data.instruction===x.TokenInstruction.MintToChecked},e.isBurnCheckedInstruction=function(t){return t.data.instruction===x.TokenInstruction.BurnChecked},e.isInitializeAccount2Instruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeAccount2},e.isSyncNativeInstruction=function(t){return t.data.instruction===x.TokenInstruction.SyncNative},e.isInitializeAccount3Instruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeAccount3},e.isInitializeMint2Instruction=function(t){return t.data.instruction===x.TokenInstruction.InitializeMint2},e.isAmountToUiAmountInstruction=function(t){return t.data.instruction===x.TokenInstruction.AmountToUiAmount},e.isUiamountToAmountInstruction=function(t){return t.data.instruction===x.TokenInstruction.UiAmountToAmount}},56513:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeFreezeAccountInstructionUnchecked=e.decodeFreezeAccountInstruction=e.createFreezeAccountInstruction=e.freezeAccountInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);function d({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,mint:r,authority:i,multiSigners:o},data:e.freezeAccountInstructionData.decode(s)}}e.freezeAccountInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createFreezeAccountInstruction=function(t,n,i,a=[],d=s.TOKEN_PROGRAM_ID){const l=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],i,a),h=r.alloc(e.freezeAccountInstructionData.span);return e.freezeAccountInstructionData.encode({instruction:c.TokenInstruction.FreezeAccount},h),new o.TransactionInstruction({keys:l,programId:d,data:h})},e.decodeFreezeAccountInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.freezeAccountInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,authority:o,multiSigners:u},data:l}=d(t);if(l.instruction!==c.TokenInstruction.FreezeAccount)throw new a.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,authority:o,multiSigners:u},data:l}},e.decodeFreezeAccountInstructionUnchecked=d},32689:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.createEmitInstruction=e.createUpdateAuthorityInstruction=e.createRemoveKeyInstruction=e.createUpdateFieldInstruction=e.createInitializeInstruction=void 0;var o=n(99564);Object.defineProperty(e,"createInitializeInstruction",{enumerable:!0,get:function(){return o.createInitializeInstruction}}),Object.defineProperty(e,"createUpdateFieldInstruction",{enumerable:!0,get:function(){return o.createUpdateFieldInstruction}}),Object.defineProperty(e,"createRemoveKeyInstruction",{enumerable:!0,get:function(){return o.createRemoveKeyInstruction}}),Object.defineProperty(e,"createUpdateAuthorityInstruction",{enumerable:!0,get:function(){return o.createUpdateAuthorityInstruction}}),Object.defineProperty(e,"createEmitInstruction",{enumerable:!0,get:function(){return o.createEmitInstruction}}),i(n(31183),e),i(n(7561),e),i(n(47623),e),i(n(74227),e),i(n(58328),e),i(n(65061),e),i(n(72874),e),i(n(55431),e),i(n(62216),e),i(n(95816),e),i(n(74761),e),i(n(8339),e),i(n(36038),e),i(n(56513),e),i(n(19040),e),i(n(35593),e),i(n(18228),e),i(n(70698),e),i(n(1853),e),i(n(63642),e),i(n(75836),e),i(n(25910),e),i(n(38817),e),i(n(19066),e),i(n(51327),e),i(n(10540),e),i(n(21470),e),i(n(36520),e),i(n(93537),e),i(n(42421),e),i(n(66780),e),i(n(68205),e)},58328:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeAccountInstructionUnchecked=e.decodeInitializeAccountInstruction=e.createInitializeAccountInstruction=e.initializeAccountInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);function c({programId:t,keys:[n,r,i,o],data:s}){return{programId:t,keys:{account:n,mint:r,owner:i,rent:o},data:e.initializeAccountInstructionData.decode(s)}}e.initializeAccountInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createInitializeAccountInstruction=function(t,n,i,a=s.TOKEN_PROGRAM_ID){const c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],d=r.alloc(e.initializeAccountInstructionData.span);return e.initializeAccountInstructionData.encode({instruction:u.TokenInstruction.InitializeAccount},d),new o.TransactionInstruction({keys:c,programId:a,data:d})},e.decodeInitializeAccountInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeAccountInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,owner:o,rent:d},data:l}=c(t);if(l.instruction!==u.TokenInstruction.InitializeAccount)throw new a.TokenInvalidInstructionTypeError;if(!(r&&i&&o&&d))throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,owner:o,rent:d},data:l}},e.decodeInitializeAccountInstructionUnchecked=c},63642:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeAccount2InstructionUnchecked=e.decodeInitializeAccount2Instruction=e.createInitializeAccount2Instruction=e.initializeAccount2InstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n,r,i],data:o}){return{programId:t,keys:{account:n,mint:r,rent:i},data:e.initializeAccount2InstructionData.decode(o)}}e.initializeAccount2InstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.publicKey)("owner")]),e.createInitializeAccount2Instruction=function(t,n,i,o=a.TOKEN_PROGRAM_ID){const u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],d=r.alloc(e.initializeAccount2InstructionData.span);return e.initializeAccount2InstructionData.encode({instruction:c.TokenInstruction.InitializeAccount2,owner:i},d),new s.TransactionInstruction({keys:u,programId:o,data:d})},e.decodeInitializeAccount2Instruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeAccount2InstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,rent:o},data:s}=d(t);if(s.instruction!==c.TokenInstruction.InitializeAccount2)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,rent:o},data:s}},e.decodeInitializeAccount2InstructionUnchecked=d},25910:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeAccount3InstructionUnchecked=e.decodeInitializeAccount3Instruction=e.createInitializeAccount3Instruction=e.initializeAccount3InstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n,r],data:i}){return{programId:t,keys:{account:n,mint:r},data:e.initializeAccount3InstructionData.decode(i)}}e.initializeAccount3InstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.publicKey)("owner")]),e.createInitializeAccount3Instruction=function(t,n,i,o=a.TOKEN_PROGRAM_ID){const u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],d=r.alloc(e.initializeAccount3InstructionData.span);return e.initializeAccount3InstructionData.encode({instruction:c.TokenInstruction.InitializeAccount3,owner:i},d),new s.TransactionInstruction({keys:u,programId:o,data:d})},e.decodeInitializeAccount3Instruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeAccount3InstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i},data:o}=d(t);if(o.instruction!==c.TokenInstruction.InitializeAccount3)throw new u.TokenInvalidInstructionTypeError;if(!r||!i)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i},data:o}},e.decodeInitializeAccount3InstructionUnchecked=d},51327:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeImmutableOwnerInstructionUnchecked=e.decodeInitializeImmutableOwnerInstruction=e.createInitializeImmutableOwnerInstruction=e.initializeImmutableOwnerInstructionData=void 0;const i=n(39386),o=n(18245),s=n(60913),a=n(47623);function u({programId:t,keys:[n],data:r}){const{instruction:i}=e.initializeImmutableOwnerInstructionData.decode(r);return{programId:t,keys:{account:n},data:{instruction:i}}}e.initializeImmutableOwnerInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createInitializeImmutableOwnerInstruction=function(t,n){const i=[{pubkey:t,isSigner:!1,isWritable:!0}],s=r.alloc(e.initializeImmutableOwnerInstructionData.span);return e.initializeImmutableOwnerInstructionData.encode({instruction:a.TokenInstruction.InitializeImmutableOwner},s),new o.TransactionInstruction({keys:i,programId:n,data:s})},e.decodeInitializeImmutableOwnerInstruction=function(t,n){if(!t.programId.equals(n))throw new s.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeImmutableOwnerInstructionData.span)throw new s.TokenInvalidInstructionDataError;const{keys:{account:r},data:i}=u(t);if(i.instruction!==a.TokenInstruction.InitializeImmutableOwner)throw new s.TokenInvalidInstructionTypeError;if(!r)throw new s.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r},data:i}},e.decodeInitializeImmutableOwnerInstructionUnchecked=u},74227:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeMintInstructionUnchecked=e.decodeInitializeMintInstruction=e.createInitializeMintInstruction=e.initializeMintInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n,r],data:i}){const{instruction:o,decimals:s,mintAuthority:a,freezeAuthorityOption:u,freezeAuthority:c}=e.initializeMintInstructionData.decode(i);return{programId:t,keys:{mint:n,rent:r},data:{instruction:o,decimals:s,mintAuthority:a,freezeAuthority:u?c:null}}}e.initializeMintInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("decimals"),(0,o.publicKey)("mintAuthority"),(0,i.u8)("freezeAuthorityOption"),(0,o.publicKey)("freezeAuthority")]),e.createInitializeMintInstruction=function(t,n,i,o,u=a.TOKEN_PROGRAM_ID){const d=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],l=r.alloc(e.initializeMintInstructionData.span);return e.initializeMintInstructionData.encode({instruction:c.TokenInstruction.InitializeMint,decimals:n,mintAuthority:i,freezeAuthorityOption:o?1:0,freezeAuthority:o||new s.PublicKey(0)},l),new s.TransactionInstruction({keys:d,programId:u,data:l})},e.decodeInitializeMintInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeMintInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,rent:i},data:o}=d(t);if(o.instruction!==c.TokenInstruction.InitializeMint)throw new u.TokenInvalidInstructionTypeError;if(!r||!i)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,rent:i},data:o}},e.decodeInitializeMintInstructionUnchecked=d},19066:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeMint2InstructionUnchecked=e.decodeInitializeMint2Instruction=e.createInitializeMint2Instruction=e.initializeMint2InstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n],data:r}){const{instruction:i,decimals:o,mintAuthority:s,freezeAuthorityOption:a,freezeAuthority:u}=e.initializeMint2InstructionData.decode(r);return{programId:t,keys:{mint:n},data:{instruction:i,decimals:o,mintAuthority:s,freezeAuthority:a?u:null}}}e.initializeMint2InstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("decimals"),(0,o.publicKey)("mintAuthority"),(0,i.u8)("freezeAuthorityOption"),(0,o.publicKey)("freezeAuthority")]),e.createInitializeMint2Instruction=function(t,n,i,o,u=a.TOKEN_PROGRAM_ID){const d=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.initializeMint2InstructionData.span);return e.initializeMint2InstructionData.encode({instruction:c.TokenInstruction.InitializeMint2,decimals:n,mintAuthority:i,freezeAuthorityOption:o?1:0,freezeAuthority:o||new s.PublicKey(0)},l),new s.TransactionInstruction({keys:d,programId:u,data:l})},e.decodeInitializeMint2Instruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeMint2InstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=d(t);if(i.instruction!==c.TokenInstruction.InitializeMint2)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeInitializeMint2InstructionUnchecked=d},36520:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeMintCloseAuthorityInstructionUnchecked=e.decodeInitializeMintCloseAuthorityInstruction=e.createInitializeMintCloseAuthorityInstruction=e.initializeMintCloseAuthorityInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(47623);function d({programId:t,keys:[n],data:r}){const{instruction:i,closeAuthorityOption:o,closeAuthority:s}=e.initializeMintCloseAuthorityInstructionData.decode(r);return{programId:t,keys:{mint:n},data:{instruction:i,closeAuthority:o?s:null}}}e.initializeMintCloseAuthorityInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("closeAuthorityOption"),(0,o.publicKey)("closeAuthority")]),e.createInitializeMintCloseAuthorityInstruction=function(t,n,i){if(!(0,a.programSupportsExtensions)(i))throw new u.TokenUnsupportedInstructionError;const o=[{pubkey:t,isSigner:!1,isWritable:!0}],d=r.alloc(e.initializeMintCloseAuthorityInstructionData.span);return e.initializeMintCloseAuthorityInstructionData.encode({instruction:c.TokenInstruction.InitializeMintCloseAuthority,closeAuthorityOption:n?1:0,closeAuthority:n||new s.PublicKey(0)},d),new s.TransactionInstruction({keys:o,programId:i,data:d})},e.decodeInitializeMintCloseAuthorityInstruction=function(t,n){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeMintCloseAuthorityInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=d(t);if(i.instruction!==c.TokenInstruction.InitializeMintCloseAuthority)throw new u.TokenInvalidInstructionTypeError;if(!r)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeInitializeMintCloseAuthorityInstructionUnchecked=d},65061:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializeMultisigInstructionUnchecked=e.decodeInitializeMultisigInstruction=e.createInitializeMultisigInstruction=e.initializeMultisigInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);function c({programId:t,keys:[n,r,...i],data:o}){return{programId:t,keys:{account:n,rent:r,signers:i},data:e.initializeMultisigInstructionData.decode(o)}}e.initializeMultisigInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("m")]),e.createInitializeMultisigInstruction=function(t,n,i,a=s.TOKEN_PROGRAM_ID){const c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:o.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];for(const t of n)c.push({pubkey:t instanceof o.PublicKey?t:t.publicKey,isSigner:!1,isWritable:!1});const d=r.alloc(e.initializeMultisigInstructionData.span);return e.initializeMultisigInstructionData.encode({instruction:u.TokenInstruction.InitializeMultisig,m:i},d),new o.TransactionInstruction({keys:c,programId:a,data:d})},e.decodeInitializeMultisigInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializeMultisigInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,rent:i,signers:o},data:d}=c(t);if(d.instruction!==u.TokenInstruction.InitializeMultisig)throw new a.TokenInvalidInstructionTypeError;if(!r||!i||!o.length)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,rent:i,signers:o},data:d}},e.decodeInitializeMultisigInstructionUnchecked=c},38817:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},66780:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createInitializeNonTransferableMintInstruction=e.initializeNonTransferableMintInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);e.initializeNonTransferableMintInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createInitializeNonTransferableMintInstruction=function(t,n){if(!(0,s.programSupportsExtensions)(n))throw new a.TokenUnsupportedInstructionError;const i=[{pubkey:t,isSigner:!1,isWritable:!0}],c=r.alloc(e.initializeNonTransferableMintInstructionData.span);return e.initializeNonTransferableMintInstructionData.encode({instruction:u.TokenInstruction.InitializeNonTransferableMint},c),new o.TransactionInstruction({keys:i,programId:n,data:c})}},68205:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeInitializePermanentDelegateInstructionUnchecked=e.decodeInitializePermanentDelegateInstruction=e.createInitializePermanentDelegateInstruction=e.initializePermanentDelegateInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(18245),u=n(44530),c=n(60913),d=n(47623);function l({programId:t,keys:[n],data:r}){const{instruction:i,delegate:o}=e.initializePermanentDelegateInstructionData.decode(r);return{programId:t,keys:{mint:n},data:{instruction:i,delegate:o}}}e.initializePermanentDelegateInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.publicKey)("delegate")]),e.createInitializePermanentDelegateInstruction=function(t,n,i){if(!(0,u.programSupportsExtensions)(i))throw new c.TokenUnsupportedInstructionError;const o=[{pubkey:t,isSigner:!1,isWritable:!0}],l=r.alloc(e.initializePermanentDelegateInstructionData.span);return e.initializePermanentDelegateInstructionData.encode({instruction:d.TokenInstruction.InitializePermanentDelegate,delegate:n||new s.PublicKey(0)},l),new a.TransactionInstruction({keys:o,programId:i,data:l})},e.decodeInitializePermanentDelegateInstruction=function(t,n){if(!t.programId.equals(n))throw new c.TokenInvalidInstructionProgramError;if(t.data.length!==e.initializePermanentDelegateInstructionData.span)throw new c.TokenInvalidInstructionDataError;const{keys:{mint:r},data:i}=l(t);if(i.instruction!==d.TokenInstruction.InitializePermanentDelegate)throw new c.TokenInvalidInstructionTypeError;if(!r)throw new c.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r},data:i}},e.decodeInitializePermanentDelegateInstructionUnchecked=l},59546:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.addSigners=void 0;const r=n(18245);e.addSigners=function(t,e,n){if(n.length){t.push({pubkey:e,isSigner:!1,isWritable:!1});for(const e of n)t.push({pubkey:e instanceof r.PublicKey?e:e.publicKey,isSigner:!0,isWritable:!1})}else t.push({pubkey:e,isSigner:!0,isWritable:!1});return t}},74761:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeMintToInstructionUnchecked=e.decodeMintToInstruction=e.createMintToInstruction=e.mintToInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{mint:n,destination:r,authority:i,multiSigners:o},data:e.mintToInstructionData.decode(s)}}e.mintToInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createMintToInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,u),f=r.alloc(e.mintToInstructionData.span);return e.mintToInstructionData.encode({instruction:d.TokenInstruction.MintTo,amount:BigInt(o)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeMintToInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.mintToInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,destination:i,authority:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.MintTo)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,destination:i,authority:o,multiSigners:s},data:c}},e.decodeMintToInstructionUnchecked=l},70698:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeMintToCheckedInstructionUnchecked=e.decodeMintToCheckedInstruction=e.createMintToCheckedInstruction=e.mintToCheckedInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{mint:n,destination:r,authority:i,multiSigners:o},data:e.mintToCheckedInstructionData.decode(s)}}e.mintToCheckedInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount"),(0,i.u8)("decimals")]),e.createMintToCheckedInstruction=function(t,n,i,o,u,l=[],h=a.TOKEN_PROGRAM_ID){const f=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,l),p=r.alloc(e.mintToCheckedInstructionData.span);return e.mintToCheckedInstructionData.encode({instruction:d.TokenInstruction.MintToChecked,amount:BigInt(o),decimals:u},p),new s.TransactionInstruction({keys:f,programId:h,data:p})},e.decodeMintToCheckedInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.mintToCheckedInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{mint:r,destination:i,authority:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.MintToChecked)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{mint:r,destination:i,authority:o,multiSigners:s},data:c}},e.decodeMintToCheckedInstructionUnchecked=l},93537:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.createReallocateInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);e.createReallocateInstruction=function(t,e,n,d,l=[],h=s.TOKEN_2022_PROGRAM_ID){if(!(0,s.programSupportsExtensions)(h))throw new a.TokenUnsupportedInstructionError;const f=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:o.SystemProgram.programId,isSigner:!1,isWritable:!1}],p=(0,u.addSigners)(f,d,l),m=(0,i.struct)([(0,i.u8)("instruction"),(0,i.seq)((0,i.u16)(),n.length,"extensionTypes")]),g=r.alloc(m.span);return m.encode({instruction:c.TokenInstruction.Reallocate,extensionTypes:n},g),new o.TransactionInstruction({keys:p,programId:h,data:g})}},62216:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeRevokeInstructionUnchecked=e.decodeRevokeInstruction=e.createRevokeInstruction=e.revokeInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);function d({programId:t,keys:[n,r,...i],data:o}){return{programId:t,keys:{account:n,owner:r,multiSigners:i},data:e.revokeInstructionData.decode(o)}}e.revokeInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createRevokeInstruction=function(t,n,i=[],a=s.TOKEN_PROGRAM_ID){const d=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],n,i),l=r.alloc(e.revokeInstructionData.span);return e.revokeInstructionData.encode({instruction:c.TokenInstruction.Revoke},l),new o.TransactionInstruction({keys:d,programId:a,data:l})},e.decodeRevokeInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.revokeInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,owner:i,multiSigners:o},data:u}=d(t);if(u.instruction!==c.TokenInstruction.Revoke)throw new a.TokenInvalidInstructionTypeError;if(!r||!i)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,owner:i,multiSigners:o},data:u}},e.decodeRevokeInstructionUnchecked=d},95816:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSetAuthorityInstructionUnchecked=e.decodeSetAuthorityInstruction=e.createSetAuthorityInstruction=e.setAuthorityInstructionData=e.AuthorityType=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);var l;function h({programId:t,keys:[n,r,...i],data:o}){const{instruction:s,authorityType:a,newAuthorityOption:u,newAuthority:c}=e.setAuthorityInstructionData.decode(o);return{programId:t,keys:{account:n,currentAuthority:r,multiSigners:i},data:{instruction:s,authorityType:a,newAuthority:u?c:null}}}!function(t){t[t.MintTokens=0]="MintTokens",t[t.FreezeAccount=1]="FreezeAccount",t[t.AccountOwner=2]="AccountOwner",t[t.CloseAccount=3]="CloseAccount",t[t.TransferFeeConfig=4]="TransferFeeConfig",t[t.WithheldWithdraw=5]="WithheldWithdraw",t[t.CloseMint=6]="CloseMint",t[t.InterestRate=7]="InterestRate",t[t.PermanentDelegate=8]="PermanentDelegate",t[t.ConfidentialTransferMint=9]="ConfidentialTransferMint",t[t.TransferHookProgramId=10]="TransferHookProgramId",t[t.ConfidentialTransferFeeConfig=11]="ConfidentialTransferFeeConfig",t[t.MetadataPointer=12]="MetadataPointer"}(l||(e.AuthorityType=l={})),e.setAuthorityInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,i.u8)("authorityType"),(0,i.u8)("newAuthorityOption"),(0,o.publicKey)("newAuthority")]),e.createSetAuthorityInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0}],n,u),f=r.alloc(e.setAuthorityInstructionData.span);return e.setAuthorityInstructionData.encode({instruction:d.TokenInstruction.SetAuthority,authorityType:i,newAuthorityOption:o?1:0,newAuthority:o||new s.PublicKey(0)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeSetAuthorityInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.setAuthorityInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{account:r,currentAuthority:i,multiSigners:o},data:s}=h(t);if(s.instruction!==d.TokenInstruction.SetAuthority)throw new u.TokenInvalidInstructionTypeError;if(!r||!i)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,currentAuthority:i,multiSigners:o},data:s}},e.decodeSetAuthorityInstructionUnchecked=h},75836:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSyncNativeInstructionUnchecked=e.decodeSyncNativeInstruction=e.createSyncNativeInstruction=e.syncNativeInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);function c({programId:t,keys:[n],data:r}){return{programId:t,keys:{account:n},data:e.syncNativeInstructionData.decode(r)}}e.syncNativeInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createSyncNativeInstruction=function(t,n=s.TOKEN_PROGRAM_ID){const i=[{pubkey:t,isSigner:!1,isWritable:!0}],a=r.alloc(e.syncNativeInstructionData.span);return e.syncNativeInstructionData.encode({instruction:u.TokenInstruction.SyncNative},a),new o.TransactionInstruction({keys:i,programId:n,data:a})},e.decodeSyncNativeInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.syncNativeInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r},data:i}=c(t);if(i.instruction!==u.TokenInstruction.SyncNative)throw new a.TokenInvalidInstructionTypeError;if(!r)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r},data:i}},e.decodeSyncNativeInstructionUnchecked=c},19040:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeThawAccountInstructionUnchecked=e.decodeThawAccountInstruction=e.createThawAccountInstruction=e.thawAccountInstructionData=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(59546),c=n(47623);function d({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{account:n,mint:r,authority:i,multiSigners:o},data:e.thawAccountInstructionData.decode(s)}}e.thawAccountInstructionData=(0,i.struct)([(0,i.u8)("instruction")]),e.createThawAccountInstruction=function(t,n,i,a=[],d=s.TOKEN_PROGRAM_ID){const l=(0,u.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1}],i,a),h=r.alloc(e.thawAccountInstructionData.span);return e.thawAccountInstructionData.encode({instruction:c.TokenInstruction.ThawAccount},h),new o.TransactionInstruction({keys:l,programId:d,data:h})},e.decodeThawAccountInstruction=function(t,n=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new a.TokenInvalidInstructionProgramError;if(t.data.length!==e.thawAccountInstructionData.span)throw new a.TokenInvalidInstructionDataError;const{keys:{account:r,mint:i,authority:o,multiSigners:u},data:l}=d(t);if(l.instruction!==c.TokenInstruction.ThawAccount)throw new a.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new a.TokenInvalidInstructionKeysError;return{programId:n,keys:{account:r,mint:i,authority:o,multiSigners:u},data:l}},e.decodeThawAccountInstructionUnchecked=d},72874:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeTransferInstructionUnchecked=e.decodeTransferInstruction=e.createTransferInstruction=e.transferInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,...o],data:s}){return{programId:t,keys:{source:n,destination:r,owner:i,multiSigners:o},data:e.transferInstructionData.decode(s)}}e.transferInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount")]),e.createTransferInstruction=function(t,n,i,o,u=[],l=a.TOKEN_PROGRAM_ID){const h=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0}],i,u),f=r.alloc(e.transferInstructionData.span);return e.transferInstructionData.encode({instruction:d.TokenInstruction.Transfer,amount:BigInt(o)},f),new s.TransactionInstruction({keys:h,programId:l,data:f})},e.decodeTransferInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.transferInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{source:r,destination:i,owner:o,multiSigners:s},data:c}=l(t);if(c.instruction!==d.TokenInstruction.Transfer)throw new u.TokenInvalidInstructionTypeError;if(!r||!i||!o)throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{source:r,destination:i,owner:o,multiSigners:s},data:c}},e.decodeTransferInstructionUnchecked=l},35593:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeTransferCheckedInstructionUnchecked=e.decodeTransferCheckedInstruction=e.createTransferCheckedInstruction=e.transferCheckedInstructionData=void 0;const i=n(39386),o=n(27278),s=n(18245),a=n(44530),u=n(60913),c=n(59546),d=n(47623);function l({programId:t,keys:[n,r,i,o,...s],data:a}){return{programId:t,keys:{source:n,mint:r,destination:i,owner:o,multiSigners:s},data:e.transferCheckedInstructionData.decode(a)}}e.transferCheckedInstructionData=(0,i.struct)([(0,i.u8)("instruction"),(0,o.u64)("amount"),(0,i.u8)("decimals")]),e.createTransferCheckedInstruction=function(t,n,i,o,u,l,h=[],f=a.TOKEN_PROGRAM_ID){const p=(0,c.addSigners)([{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!0}],o,h),m=r.alloc(e.transferCheckedInstructionData.span);return e.transferCheckedInstructionData.encode({instruction:d.TokenInstruction.TransferChecked,amount:BigInt(u),decimals:l},m),new s.TransactionInstruction({keys:p,programId:f,data:m})},e.decodeTransferCheckedInstruction=function(t,n=a.TOKEN_PROGRAM_ID){if(!t.programId.equals(n))throw new u.TokenInvalidInstructionProgramError;if(t.data.length!==e.transferCheckedInstructionData.span)throw new u.TokenInvalidInstructionDataError;const{keys:{source:r,mint:i,destination:o,owner:s,multiSigners:c},data:h}=l(t);if(h.instruction!==d.TokenInstruction.TransferChecked)throw new u.TokenInvalidInstructionTypeError;if(!(r&&i&&o&&s))throw new u.TokenInvalidInstructionKeysError;return{programId:n,keys:{source:r,mint:i,destination:o,owner:s,multiSigners:c},data:h}},e.decodeTransferCheckedInstructionUnchecked=l},47623:(t,e)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenInstruction=void 0,function(t){t[t.InitializeMint=0]="InitializeMint",t[t.InitializeAccount=1]="InitializeAccount",t[t.InitializeMultisig=2]="InitializeMultisig",t[t.Transfer=3]="Transfer",t[t.Approve=4]="Approve",t[t.Revoke=5]="Revoke",t[t.SetAuthority=6]="SetAuthority",t[t.MintTo=7]="MintTo",t[t.Burn=8]="Burn",t[t.CloseAccount=9]="CloseAccount",t[t.FreezeAccount=10]="FreezeAccount",t[t.ThawAccount=11]="ThawAccount",t[t.TransferChecked=12]="TransferChecked",t[t.ApproveChecked=13]="ApproveChecked",t[t.MintToChecked=14]="MintToChecked",t[t.BurnChecked=15]="BurnChecked",t[t.InitializeAccount2=16]="InitializeAccount2",t[t.SyncNative=17]="SyncNative",t[t.InitializeAccount3=18]="InitializeAccount3",t[t.InitializeMultisig2=19]="InitializeMultisig2",t[t.InitializeMint2=20]="InitializeMint2",t[t.GetAccountDataSize=21]="GetAccountDataSize",t[t.InitializeImmutableOwner=22]="InitializeImmutableOwner",t[t.AmountToUiAmount=23]="AmountToUiAmount",t[t.UiAmountToAmount=24]="UiAmountToAmount",t[t.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",t[t.TransferFeeExtension=26]="TransferFeeExtension",t[t.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",t[t.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",t[t.Reallocate=29]="Reallocate",t[t.MemoTransferExtension=30]="MemoTransferExtension",t[t.CreateNativeMint=31]="CreateNativeMint",t[t.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",t[t.InterestBearingMintExtension=33]="InterestBearingMintExtension",t[t.CpiGuardExtension=34]="CpiGuardExtension",t[t.InitializePermanentDelegate=35]="InitializePermanentDelegate",t[t.TransferHookExtension=36]="TransferHookExtension",t[t.MetadataPointerExtension=39]="MetadataPointerExtension"}(n||(e.TokenInstruction=n={}))},21470:(t,e,n)=>{"use strict";var r=n(48764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decodeUiAmountToAmountInstructionUnchecked=e.decodeUiAmountToAmountInstruction=e.createUiAmountToAmountInstruction=void 0;const i=n(39386),o=n(18245),s=n(44530),a=n(60913),u=n(47623);function c({programId:t,keys:[e],data:n}){return{programId:t,keys:{mint:e},data:(0,i.struct)([(0,i.u8)("instruction"),(0,i.blob)(n.length-1,"amount")]).decode(n)}}e.createUiAmountToAmountInstruction=function(t,e,n=s.TOKEN_PROGRAM_ID){const a=[{pubkey:t,isSigner:!1,isWritable:!1}],c=r.from(e,"utf8"),d=(0,i.struct)([(0,i.u8)("instruction"),(0,i.blob)(c.length,"amount")]),l=r.alloc(d.span);return d.encode({instruction:u.TokenInstruction.UiAmountToAmount,amount:c},l),new o.TransactionInstruction({keys:a,programId:n,data:l})},e.decodeUiAmountToAmountInstruction=function(t,e=s.TOKEN_PROGRAM_ID){if(!t.programId.equals(e))throw new a.TokenInvalidInstructionProgramError;const n=(0,i.struct)([(0,i.u8)("instruction"),(0,i.blob)(t.data.length-1,"amount")]);if(t.data.length!==n.span)throw new a.TokenInvalidInstructionDataError;const{keys:{mint:r},data:o}=c(t);if(o.instruction!==u.TokenInstruction.UiAmountToAmount)throw new a.TokenInvalidInstructionTypeError;if(!r)throw new a.TokenInvalidInstructionKeysError;return{programId:e,keys:{mint:r},data:o}},e.decodeUiAmountToAmountInstructionUnchecked=c},48820:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.unpackAccount=e.getMinimumBalanceForRentExemptAccountWithExtensions=e.getMinimumBalanceForRentExemptAccount=e.getMultipleAccounts=e.getAccount=e.ACCOUNT_SIZE=e.AccountLayout=e.AccountState=void 0;const o=n(39386),s=n(27278),a=n(44530),u=n(60913),c=n(21026),d=n(90758),l=n(22114);var h;function f(t,e,n){return i(this,void 0,void 0,(function*(){const r=(0,d.getAccountLen)(e);return yield t.getMinimumBalanceForRentExemption(r,n)}))}function p(t,n,i=a.TOKEN_PROGRAM_ID){if(!n)throw new u.TokenAccountNotFoundError;if(!n.owner.equals(i))throw new u.TokenInvalidAccountOwnerError;if(n.data.lengthe.ACCOUNT_SIZE){if(n.data.length===l.MULTISIG_SIZE)throw new u.TokenInvalidAccountSizeError;if(n.data[e.ACCOUNT_SIZE]!=c.AccountType.Account)throw new u.TokenInvalidAccountError;s=n.data.slice(e.ACCOUNT_SIZE+c.ACCOUNT_TYPE_SIZE)}return{address:t,mint:o.mint,owner:o.owner,amount:o.amount,delegate:o.delegateOption?o.delegate:null,delegatedAmount:o.delegatedAmount,isInitialized:o.state!==h.Uninitialized,isFrozen:o.state===h.Frozen,isNative:!!o.isNativeOption,rentExemptReserve:o.isNativeOption?o.isNative:null,closeAuthority:o.closeAuthorityOption?o.closeAuthority:null,tlvData:s}}!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(h||(e.AccountState=h={})),e.AccountLayout=(0,o.struct)([(0,s.publicKey)("mint"),(0,s.publicKey)("owner"),(0,s.u64)("amount"),(0,o.u32)("delegateOption"),(0,s.publicKey)("delegate"),(0,o.u8)("state"),(0,o.u32)("isNativeOption"),(0,s.u64)("isNative"),(0,s.u64)("delegatedAmount"),(0,o.u32)("closeAuthorityOption"),(0,s.publicKey)("closeAuthority")]),e.ACCOUNT_SIZE=e.AccountLayout.span,e.getAccount=function(t,e,n,r=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=yield t.getAccountInfo(e,n);return p(e,i,r)}))},e.getMultipleAccounts=function(t,e,n,r=a.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=yield t.getMultipleAccountsInfo(e,n);return e.map(((t,e)=>p(t,i[e],r)))}))},e.getMinimumBalanceForRentExemptAccount=function(t,e){return i(this,void 0,void 0,(function*(){return yield f(t,[],e)}))},e.getMinimumBalanceForRentExemptAccountWithExtensions=f,e.unpackAccount=p},40982:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(48820),e),i(n(66446),e),i(n(22114),e)},66446:function(t,e,n){"use strict";var r=n(48764).Buffer,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getAssociatedTokenAddressSync=e.getAssociatedTokenAddress=e.getMinimumBalanceForRentExemptMintWithExtensions=e.getMinimumBalanceForRentExemptMint=e.unpackMint=e.getMint=e.MINT_SIZE=e.MintLayout=void 0;const o=n(39386),s=n(27278),a=n(18245),u=n(44530),c=n(60913),d=n(21026),l=n(90758),h=n(48820),f=n(22114);function p(t,n,i=u.TOKEN_PROGRAM_ID){if(!n)throw new c.TokenAccountNotFoundError;if(!n.owner.equals(i))throw new c.TokenInvalidAccountOwnerError;if(n.data.lengthe.MINT_SIZE){if(n.data.length<=h.ACCOUNT_SIZE)throw new c.TokenInvalidAccountSizeError;if(n.data.length===f.MULTISIG_SIZE)throw new c.TokenInvalidAccountSizeError;if(n.data[h.ACCOUNT_SIZE]!=d.AccountType.Mint)throw new c.TokenInvalidMintError;s=n.data.slice(h.ACCOUNT_SIZE+d.ACCOUNT_TYPE_SIZE)}return{address:t,mintAuthority:o.mintAuthorityOption?o.mintAuthority:null,supply:o.supply,decimals:o.decimals,isInitialized:o.isInitialized,freezeAuthority:o.freezeAuthorityOption?o.freezeAuthority:null,tlvData:s}}function m(t,e,n){return i(this,void 0,void 0,(function*(){const r=(0,l.getMintLen)(e);return yield t.getMinimumBalanceForRentExemption(r,n)}))}e.MintLayout=(0,o.struct)([(0,o.u32)("mintAuthorityOption"),(0,s.publicKey)("mintAuthority"),(0,s.u64)("supply"),(0,o.u8)("decimals"),(0,s.bool)("isInitialized"),(0,o.u32)("freezeAuthorityOption"),(0,s.publicKey)("freezeAuthority")]),e.MINT_SIZE=e.MintLayout.span,e.getMint=function(t,e,n,r=u.TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){const i=yield t.getAccountInfo(e,n);return p(e,i,r)}))},e.unpackMint=p,e.getMinimumBalanceForRentExemptMint=function(t,e){return i(this,void 0,void 0,(function*(){return yield m(t,[],e)}))},e.getMinimumBalanceForRentExemptMintWithExtensions=m,e.getAssociatedTokenAddress=function(t,e,n=!1,r=u.TOKEN_PROGRAM_ID,o=u.ASSOCIATED_TOKEN_PROGRAM_ID){return i(this,void 0,void 0,(function*(){if(!n&&!a.PublicKey.isOnCurve(e.toBuffer()))throw new c.TokenOwnerOffCurveError;const[i]=yield a.PublicKey.findProgramAddress([e.toBuffer(),r.toBuffer(),t.toBuffer()],o);return i}))},e.getAssociatedTokenAddressSync=function(t,e,n=!1,r=u.TOKEN_PROGRAM_ID,i=u.ASSOCIATED_TOKEN_PROGRAM_ID){if(!n&&!a.PublicKey.isOnCurve(e.toBuffer()))throw new c.TokenOwnerOffCurveError;const[o]=a.PublicKey.findProgramAddressSync([e.toBuffer(),r.toBuffer(),t.toBuffer()],i);return o}},22114:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getMinimumBalanceForRentExemptMultisig=e.unpackMultisig=e.getMultisig=e.MULTISIG_SIZE=e.MultisigLayout=void 0;const i=n(39386),o=n(27278),s=n(44530),a=n(60913);function u(t,n,r=s.TOKEN_PROGRAM_ID){if(!n)throw new a.TokenAccountNotFoundError;if(!n.owner.equals(r))throw new a.TokenInvalidAccountOwnerError;if(n.data.length!=e.MULTISIG_SIZE)throw new a.TokenInvalidAccountSizeError;const i=e.MultisigLayout.decode(n.data);return Object.assign({address:t},i)}e.MultisigLayout=(0,i.struct)([(0,i.u8)("m"),(0,i.u8)("n"),(0,o.bool)("isInitialized"),(0,o.publicKey)("signer1"),(0,o.publicKey)("signer2"),(0,o.publicKey)("signer3"),(0,o.publicKey)("signer4"),(0,o.publicKey)("signer5"),(0,o.publicKey)("signer6"),(0,o.publicKey)("signer7"),(0,o.publicKey)("signer8"),(0,o.publicKey)("signer9"),(0,o.publicKey)("signer10"),(0,o.publicKey)("signer11")]),e.MULTISIG_SIZE=e.MultisigLayout.span,e.getMultisig=function(t,e,n,i=s.TOKEN_PROGRAM_ID){return r(this,void 0,void 0,(function*(){const r=yield t.getAccountInfo(e,n);return u(e,r,i)}))},e.unpackMultisig=u,e.getMinimumBalanceForRentExemptMultisig=function(t,n){return r(this,void 0,void 0,(function*(){return yield t.getMinimumBalanceForRentExemption(e.MULTISIG_SIZE,n)}))}},94297:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TlvInvalidAccountDataError=e.TlvError=void 0;class n extends Error{constructor(t){super(t)}}e.TlvError=n,e.TlvInvalidAccountDataError=class extends n{constructor(){super(...arguments),this.name="TlvInvalidAccountDataError"}}},1431:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(64545),e),i(n(67985),e),i(n(94297),e)},64545:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.splDiscriminate=void 0;const r=n(55835);e.splDiscriminate=(t,e=8)=>(0,r.createHash)("sha256").update(t).digest().subarray(0,e)},67985:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TlvState=void 0;const r=n(94297);e.TlvState=class{constructor(t,e=2,n=2,r=0){this.tlvData=t.subarray(r),this.discriminatorSize=e,this.lengthSize=n}get data(){return this.tlvData}readEntryLength(t,e,n){switch(t){case 1:return n(this.tlvData.readUInt8(e));case 2:return n(this.tlvData.readUInt16LE(e));case 4:return n(this.tlvData.readUInt32LE(e));case 8:return n(this.tlvData.readBigUInt64LE(e))}}firstBytes(t){const e=this.bytesRepeating(t,1);return e.length>0?e[0]:null}bytesRepeating(t,e=0){const n=[];let i=0;for(;ithis.tlvData.length)throw new r.TlvInvalidAccountDataError;const o=this.tlvData.subarray(i,i+this.discriminatorSize);i+=this.discriminatorSize;const s=this.readEntryLength(this.lengthSize,i,Number);if(i+=this.lengthSize,i+s>this.tlvData.length)throw new r.TlvInvalidAccountDataError;if(o.equals(t)&&n.push(this.tlvData.subarray(i,i+s)),e>0&&n.length>=e)break;i+=s}return n}discriminators(){const t=[];let e=0;for(;ethis.tlvData.length)throw new r.TlvInvalidAccountDataError;const n=this.tlvData.subarray(e,e+this.discriminatorSize);t.push(n),e+=this.discriminatorSize;const i=this.readEntryLength(this.lengthSize,e,Number);if(e+=this.lengthSize,e+i>this.tlvData.length)throw new r.TlvInvalidAccountDataError;e+=i}return t}}},64572:(t,e,n)=>{"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e,n){return i=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e),(e="symbol"==r(i)?i:String(i))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t;var i}n.d(e,{Z:()=>i})},93527:(t,e,n)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function i(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Uint8Array expected");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function o(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)}function s(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function a(t,e){i(t);const n=e.outputLen;if(t.lengths,J8:()=>a,Rx:()=>r,aI:()=>i,vp:()=>o})},4359:(t,e,n)=>{"use strict";n.d(e,{VR:()=>a,bc:()=>o,l3:()=>s});var r=n(93527),i=n(23486);const o=(t,e,n)=>t&e^~t&n,s=(t,e,n)=>t&e^t&n^e&n;class a extends i.kb{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.GL)(this.buffer)}update(t){(0,r.Gg)(this);const{view:e,buffer:n,blockLen:o}=this,s=(t=(0,i.O0)(t)).length;for(let r=0;ro-a&&(this.process(n,0),a=0);for(let t=a;t>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;t.setUint32(e+u,s,r),t.setUint32(e+c,a,r)}(n,o-8,BigInt(8*this.length),s),this.process(n,0);const u=(0,i.GL)(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,l=this.get();if(d>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t{"use strict";n.d(e,{J:()=>c});var r=n(4359),i=n(23486);const o=new Uint32Array([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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class u extends r.VR{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)a[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=a[t-15],n=a[t-2],r=(0,i.np)(e,7)^(0,i.np)(e,18)^e>>>3,o=(0,i.np)(n,17)^(0,i.np)(n,19)^n>>>10;a[t]=o+a[t-7]+r+a[t-16]|0}let{A:n,B:s,C:u,D:c,E:d,F:l,G:h,H:f}=this;for(let t=0;t<64;t++){const e=f+((0,i.np)(d,6)^(0,i.np)(d,11)^(0,i.np)(d,25))+(0,r.bc)(d,l,h)+o[t]+a[t]|0,p=((0,i.np)(n,2)^(0,i.np)(n,13)^(0,i.np)(n,22))+(0,r.l3)(n,s,u)|0;f=h,h=l,l=d,d=c+e|0,c=u,u=s,s=n,n=e+p|0}n=n+this.A|0,s=s+this.B|0,u=u+this.C|0,c=c+this.D|0,d=d+this.E|0,l=l+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(n,s,u,c,d,l,h,f)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const c=(0,i.hE)((()=>new u))},23486:(t,e,n)=>{"use strict";n.d(e,{kb:()=>p,l1:()=>d,eV:()=>f,GL:()=>s,iA:()=>u,O6:()=>g,np:()=>a,O0:()=>h,Jq:()=>o,iY:()=>l,hE:()=>m});const r="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;var i=n(93527);const o=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),s=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),a=(t,e)=>t<<32-e|t>>>e,u=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],c=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function d(t){for(let e=0;et().update(h(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function g(t=32){if(r&&"function"==typeof r.getRandomValues)return r.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}},53471:(t,e,n)=>{"use strict";n.d(e,{AG:()=>_,G0:()=>x,IM:()=>M,IX:()=>g,O7:()=>y,Rx:()=>v,Ue:()=>l,Yj:()=>m,Z_:()=>A,_4:()=>E,bc:()=>S,dt:()=>I,eE:()=>b,hu:()=>d,i0:()=>w,jt:()=>k,oQ:()=>T});class r extends TypeError{constructor(t,e){let n;const{message:r,...i}=t,{path:o}=t;super(0===o.length?r:"At path: "+o.join(".")+" -- "+r),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[t,...e()]}}}function i(t){return"object"==typeof t&&null!=t}function o(t){return"string"==typeof t?JSON.stringify(t):""+t}function s(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:s}=e,{type:a}=n,{refinement:u,message:c="Expected a value of type `"+a+"`"+(u?" with refinement `"+u+"`":"")+", but received: `"+o(r)+"`"}=t;return{value:r,type:a,refinement:u,key:i[i.length-1],path:i,branch:s,...t,message:c}}function*a(t,e,n,r){var o;i(o=t)&&"function"==typeof o[Symbol.iterator]||(t=[t]);for(const i of t){const t=s(i,e,n,r);t&&(yield t)}}function*u(t,e,n={}){const{path:r=[],branch:o=[t],coerce:s=!1,mask:a=!1}=n,c={path:r,branch:o};if(s&&(t=e.coercer(t,c),a&&"type"!==e.type&&i(e.schema)&&i(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let d=!0;for(const n of e.validator(t,c))d=!1,yield[n,void 0];for(let[n,l,h]of e.entries(t,c)){const e=u(l,h,{path:void 0===n?r:[...r,n],branch:void 0===n?o:[...o,l],coerce:s,mask:a});for(const r of e)r[0]?(d=!1,yield[r[0],void 0]):s&&(l=r[1],void 0===n?t=l:t instanceof Map?t.set(n,l):t instanceof Set?t.add(l):i(t)&&(t[n]=l))}if(d)for(const n of e.refiner(t,c))d=!1,yield[n,void 0];d&&(yield[void 0,t])}class c{constructor(t){const{type:e,schema:n,validator:r,refiner:i,coercer:o=(t=>t),entries:s=function*(){}}=t;this.type=e,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(t,e)=>a(r(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>a(i(t,e),e,this,t):()=>[]}assert(t){return d(t,this)}create(t){return l(t,this)}is(t){return h(t,this)}mask(t){return function(t,e){const n=f(t,e,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(t,this)}validate(t,e={}){return f(t,this,e)}}function d(t,e){const n=f(t,e);if(n[0])throw n[0]}function l(t,e){const n=f(t,e,{coerce:!0});if(n[0])throw n[0];return n[1]}function h(t,e){return!f(t,e)[0]}function f(t,e,n={}){const i=u(t,e,n),o=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(i);return o[0]?[new r(o[0],(function*(){for(const t of i)t[0]&&(yield t[0])})),void 0]:[void 0,o[1]]}function p(t,e){return new c({type:t,schema:null,validator:e})}function m(){return p("any",(()=>!0))}function g(t){return new c({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+o(t)})}function y(){return p("boolean",(t=>"boolean"==typeof t))}function b(t){return p("instance",(e=>e instanceof t||"Expected a `"+t.name+"` instance, but received: "+o(e)))}function w(t){const e=o(t),n=typeof t;return new c({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||"Expected the literal `"+e+"`, but received: "+o(n)})}function _(t){return new c({...t,validator:(e,n)=>null===e||t.validator(e,n),refiner:(e,n)=>null===e||t.refiner(e,n)})}function v(){return p("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+o(t)))}function k(t){return new c({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function M(t,e){return new c({type:"record",schema:null,*entries(n){if(i(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:t=>i(t)||"Expected an object, but received: "+o(t)})}function A(){return p("string",(t=>"string"==typeof t||"Expected a string, but received: "+o(t)))}function S(t){const e=p("never",(()=>!1));return new c({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(t.length,n.length);for(let i=0;iArray.isArray(t)||"Expected an array, but received: "+o(t)})}function I(t){const e=Object.keys(t);return new c({type:"type",schema:t,*entries(n){if(i(n))for(const r of e)yield[r,n[r],t[r]]},validator:t=>i(t)||"Expected an object, but received: "+o(t)})}function x(t){const e=t.map((t=>t.type)).join(" | ");return new c({type:"union",schema:null,validator(n,r){const i=[];for(const e of t){const[...t]=u(n,e,r),[o]=t;if(!o[0])return[];for(const[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+o(n),...i]}})}function E(){return p("unknown",(()=>!0))}function T(t,e,n){return new c({...t,coercer:(r,i)=>h(r,e)?t.coercer(n(r,i),i):t.coercer(r,i)})}},21127:(t,e,n)=>{"use strict";function r(t,e,n){return e<=t&&t<=n}function i(t){if(void 0===t)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}function o(t){this.tokens=[].slice.call(t)}n.r(e),n.d(e,{TextDecoder:()=>c,TextEncoder:()=>d}),o.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.push(e.shift());else this.tokens.push(t)}};var s=-1;function a(t,e){if(t)throw TypeError("Decoder error");return e||65533}var u="utf-8";function c(t,e){if(!(this instanceof c))return new c(t,e);if((t=void 0!==t?String(t).toLowerCase():u)!==u)throw new Error("Encoding not supported. Only utf-8 is supported");e=i(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(e.fatal),this._ignoreBOM=Boolean(e.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function d(t,e){if(!(this instanceof d))return new d(t,e);if((t=void 0!==t?String(t).toLowerCase():u)!==u)throw new Error("Encoding not supported. Only utf-8 is supported");e=i(e),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function l(t){var e=t.fatal,n=0,i=0,o=0,u=128,c=191;this.handler=function(t,d){if(-1===d&&0!==o)return o=0,a(e);if(-1===d)return s;if(0===o){if(r(d,0,127))return d;if(r(d,194,223))o=1,n=d-192;else if(r(d,224,239))224===d&&(u=160),237===d&&(c=159),o=2,n=d-224;else{if(!r(d,240,244))return a(e);240===d&&(u=144),244===d&&(c=143),o=3,n=d-240}return n<<=6*o,null}if(!r(d,u,c))return n=o=i=0,u=128,c=191,t.prepend(d),a(e);if(u=128,c=191,n+=d-128<<6*(o-(i+=1)),i!==o)return null;var l=n;return n=o=i=0,l}}function h(t){t.fatal,this.handler=function(t,e){if(-1===e)return s;if(r(e,0,127))return e;var n,i;r(e,128,2047)?(n=1,i=192):r(e,2048,65535)?(n=2,i=224):r(e,65536,1114111)&&(n=3,i=240);for(var o=[(e>>6*n)+i];n>0;){var a=e>>6*(n-1);o.push(128|63&a),n-=1}return o}}c.prototype={decode:function(t,e){var n;n="object"==typeof t&&t instanceof ArrayBuffer?new Uint8Array(t):"object"==typeof t&&"buffer"in t&&t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e=i(e),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var r,a=new o(n),u=[];!a.endOfStream()&&(r=this._decoder.handler(a,a.read()))!==s;)null!==r&&(Array.isArray(r)?u.push.apply(u,r):u.push(r));if(!this._streaming){do{if((r=this._decoder.handler(a,a.read()))===s)break;null!==r&&(Array.isArray(r)?u.push.apply(u,r):u.push(r))}while(!a.endOfStream());this._decoder=null}return u.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===u[0]?(this._BOMseen=!0,u.shift()):this._BOMseen=!0)),function(t){for(var e="",n=0;n>10),56320+(1023&r)))}return e}(u)}},d.prototype={encode:function(t,e){t=t?String(t):"",e=i(e),this._streaming||(this._encoder=new h(this._options)),this._streaming=Boolean(e.stream);for(var n,r=[],a=new o(function(t){for(var e=String(t),n=e.length,r=0,i=[];r57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(r===n-1)i.push(65533);else{var s=t.charCodeAt(r+1);if(56320<=s&&s<=57343){var a=1023&o,u=1023&s;i.push(65536+(a<<10)+u),r+=1}else i.push(65533)}r+=1}return i}(t));!a.endOfStream()&&(n=this._encoder.handler(a,a.read()))!==s;)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;(n=this._encoder.handler(a,a.read()))!==s;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}}},92220:t=>{"use strict";t.exports=JSON.parse('{"version":"0.2.0","name":"whirlpool","instructions":[{"name":"initializeConfig","docs":["Initializes a WhirlpoolsConfig account that hosts info & authorities","required to govern a set of Whirlpools.","","### Parameters","- `fee_authority` - Authority authorized to initialize fee-tiers and set customs fees.","- `collect_protocol_fees_authority` - Authority authorized to collect protocol fees.","- `reward_emissions_super_authority` - Authority authorized to set reward authorities in pools."],"accounts":[{"name":"config","isMut":true,"isSigner":true},{"name":"funder","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[{"name":"feeAuthority","type":"publicKey"},{"name":"collectProtocolFeesAuthority","type":"publicKey"},{"name":"rewardEmissionsSuperAuthority","type":"publicKey"},{"name":"defaultProtocolFeeRate","type":"u16"}]},{"name":"initializePool","docs":["Initializes a Whirlpool account.","Fee rate is set to the default values on the config and supplied fee_tier.","","### Parameters","- `bumps` - The bump value when deriving the PDA of the Whirlpool address.","- `tick_spacing` - The desired tick spacing for this pool.","- `initial_sqrt_price` - The desired initial sqrt-price for this pool","","#### Special Errors","`InvalidTokenMintOrder` - The order of mints have to be ordered by","`SqrtPriceOutOfBounds` - provided initial_sqrt_price is not between 2^-64 to 2^64",""],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":true},{"name":"tokenVaultB","isMut":true,"isSigner":true},{"name":"feeTier","isMut":false,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"bumps","type":{"defined":"WhirlpoolBumps"}},{"name":"tickSpacing","type":"u16"},{"name":"initialSqrtPrice","type":"u128"}]},{"name":"initializeTickArray","docs":["Initializes a tick_array account to represent a tick-range in a Whirlpool.","","### Parameters","- `start_tick_index` - The starting tick index for this tick-array.","Has to be a multiple of TickArray size & the tick spacing of this pool.","","#### Special Errors","- `InvalidStartTick` - if the provided start tick is out of bounds or is not a multiple of","TICK_ARRAY_SIZE * tick spacing."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"tickArray","isMut":true,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[{"name":"startTickIndex","type":"i32"}]},{"name":"initializeFeeTier","docs":["Initializes a fee_tier account usable by Whirlpools in a WhirlpoolConfig space.","","### Authority","- \\"fee_authority\\" - Set authority in the WhirlpoolConfig","","### Parameters","- `tick_spacing` - The tick-spacing that this fee-tier suggests the default_fee_rate for.","- `default_fee_rate` - The default fee rate that a pool will use if the pool uses this","fee tier during initialization.","","#### Special Errors","- `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds MAX_FEE_RATE."],"accounts":[{"name":"config","isMut":false,"isSigner":false},{"name":"feeTier","isMut":true,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"feeAuthority","isMut":false,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[{"name":"tickSpacing","type":"u16"},{"name":"defaultFeeRate","type":"u16"}]},{"name":"initializeReward","docs":["Initialize reward for a Whirlpool. A pool can only support up to a set number of rewards.","","### Authority","- \\"reward_authority\\" - assigned authority by the reward_super_authority for the specified","reward-index in this Whirlpool","","### Parameters","- `reward_index` - The reward index that we\'d like to initialize. (0 <= index <= NUM_REWARDS)","","#### Special Errors","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"funder","isMut":true,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardMint","isMut":false,"isSigner":false},{"name":"rewardVault","isMut":true,"isSigner":true},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"setRewardEmissions","docs":["Set the reward emissions for a reward in a Whirlpool.","","### Authority","- \\"reward_authority\\" - assigned authority by the reward_super_authority for the specified","reward-index in this Whirlpool","","### Parameters","- `reward_index` - The reward index (0 <= index <= NUM_REWARDS) that we\'d like to modify.","- `emissions_per_second_x64` - The amount of rewards emitted in this pool.","","#### Special Errors","- `RewardVaultAmountInsufficient` - The amount of rewards in the reward vault cannot emit","more than a day of desired emissions.","- `InvalidTimestamp` - Provided timestamp is not in order with the previous timestamp.","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"rewardVault","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"},{"name":"emissionsPerSecondX64","type":"u128"}]},{"name":"openPosition","docs":["Open a position in a Whirlpool. A unique token will be minted to represent the position","in the users wallet. The position will start off with 0 liquidity.","","### Parameters","- `tick_lower_index` - The tick specifying the lower end of the position range.","- `tick_upper_index` - The tick specifying the upper end of the position range.","","#### Special Errors","- `InvalidTickIndex` - If a provided tick is out of bounds, out of order or not a multiple of","the tick-spacing in this pool."],"accounts":[{"name":"funder","isMut":true,"isSigner":true},{"name":"owner","isMut":false,"isSigner":false},{"name":"position","isMut":true,"isSigner":false},{"name":"positionMint","isMut":true,"isSigner":true},{"name":"positionTokenAccount","isMut":true,"isSigner":false},{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false},{"name":"associatedTokenProgram","isMut":false,"isSigner":false}],"args":[{"name":"bumps","type":{"defined":"OpenPositionBumps"}},{"name":"tickLowerIndex","type":"i32"},{"name":"tickUpperIndex","type":"i32"}]},{"name":"openPositionWithMetadata","docs":["Open a position in a Whirlpool. A unique token will be minted to represent the position","in the users wallet. Additional Metaplex metadata is appended to identify the token.","The position will start off with 0 liquidity.","","### Parameters","- `tick_lower_index` - The tick specifying the lower end of the position range.","- `tick_upper_index` - The tick specifying the upper end of the position range.","","#### Special Errors","- `InvalidTickIndex` - If a provided tick is out of bounds, out of order or not a multiple of","the tick-spacing in this pool."],"accounts":[{"name":"funder","isMut":true,"isSigner":true},{"name":"owner","isMut":false,"isSigner":false},{"name":"position","isMut":true,"isSigner":false},{"name":"positionMint","isMut":true,"isSigner":true},{"name":"positionMetadataAccount","isMut":true,"isSigner":false,"docs":["https://github.com/metaplex-foundation/metaplex-program-library/blob/master/token-metadata/program/src/utils.rs#L873"]},{"name":"positionTokenAccount","isMut":true,"isSigner":false},{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false},{"name":"associatedTokenProgram","isMut":false,"isSigner":false},{"name":"metadataProgram","isMut":false,"isSigner":false},{"name":"metadataUpdateAuth","isMut":false,"isSigner":false}],"args":[{"name":"bumps","type":{"defined":"OpenPositionWithMetadataBumps"}},{"name":"tickLowerIndex","type":"i32"},{"name":"tickUpperIndex","type":"i32"}]},{"name":"increaseLiquidity","docs":["Add liquidity to a position in the Whirlpool. This call also updates the position\'s accrued fees and rewards.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position.","","### Parameters","- `liquidity_amount` - The total amount of Liquidity the user is willing to deposit.","- `token_max_a` - The maximum amount of tokenA the user is willing to deposit.","- `token_max_b` - The maximum amount of tokenB the user is willing to deposit.","","#### Special Errors","- `LiquidityZero` - Provided liquidity amount is zero.","- `LiquidityTooHigh` - Provided liquidity exceeds u128::max.","- `TokenMaxExceeded` - The required token to perform this operation exceeds the user defined amount."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":true,"isSigner":false},{"name":"tickArrayUpper","isMut":true,"isSigner":false}],"args":[{"name":"liquidityAmount","type":"u128"},{"name":"tokenMaxA","type":"u64"},{"name":"tokenMaxB","type":"u64"}]},{"name":"decreaseLiquidity","docs":["Withdraw liquidity from a position in the Whirlpool. This call also updates the position\'s accrued fees and rewards.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position.","","### Parameters","- `liquidity_amount` - The total amount of Liquidity the user desires to withdraw.","- `token_min_a` - The minimum amount of tokenA the user is willing to withdraw.","- `token_min_b` - The minimum amount of tokenB the user is willing to withdraw.","","#### Special Errors","- `LiquidityZero` - Provided liquidity amount is zero.","- `LiquidityTooHigh` - Provided liquidity exceeds u128::max.","- `TokenMinSubceeded` - The required token to perform this operation subceeds the user defined amount."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":true,"isSigner":false},{"name":"tickArrayUpper","isMut":true,"isSigner":false}],"args":[{"name":"liquidityAmount","type":"u128"},{"name":"tokenMinA","type":"u64"},{"name":"tokenMinB","type":"u64"}]},{"name":"updateFeesAndRewards","docs":["Update the accrued fees and rewards for a position.","","#### Special Errors","- `TickNotFound` - Provided tick array account does not contain the tick for this position.","- `LiquidityZero` - Position has zero liquidity and therefore already has the most updated fees and reward values."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"position","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":false,"isSigner":false},{"name":"tickArrayUpper","isMut":false,"isSigner":false}],"args":[]},{"name":"collectFees","docs":["Collect fees accrued for this position.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"collectReward","docs":["Collect rewards accrued for this position.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"rewardOwnerAccount","isMut":true,"isSigner":false},{"name":"rewardVault","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"collectProtocolFees","docs":["Collect the protocol fees accrued in this Whirlpool","","### Authority","- `collect_protocol_fees_authority` - assigned authority in the WhirlpoolConfig that can collect protocol fees"],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"collectProtocolFeesAuthority","isMut":false,"isSigner":true},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tokenDestinationA","isMut":true,"isSigner":false},{"name":"tokenDestinationB","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"swap","docs":["Perform a swap in this Whirlpool","","### Authority","- \\"token_authority\\" - The authority to withdraw tokens from the input token account.","","### Parameters","- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).","- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).","- `sqrt_price_limit` - The maximum/minimum price the swap will swap to.","- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.","- `a_to_b` - The direction of the swap. True if swapping from A to B. False if swapping from B to A.","","#### Special Errors","- `ZeroTradableAmount` - User provided parameter `amount` is 0.","- `InvalidSqrtPriceLimitDirection` - User provided parameter `sqrt_price_limit` does not match the direction of the trade.","- `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool\'s max/min bounds for sqrt-price.","- `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.","- `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.","- `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.","- `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.","- `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0."],"accounts":[{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"tokenAuthority","isMut":false,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArray0","isMut":true,"isSigner":false},{"name":"tickArray1","isMut":true,"isSigner":false},{"name":"tickArray2","isMut":true,"isSigner":false},{"name":"oracle","isMut":false,"isSigner":false}],"args":[{"name":"amount","type":"u64"},{"name":"otherAmountThreshold","type":"u64"},{"name":"sqrtPriceLimit","type":"u128"},{"name":"amountSpecifiedIsInput","type":"bool"},{"name":"aToB","type":"bool"}]},{"name":"closePosition","docs":["Close a position in a Whirlpool. Burns the position token in the owner\'s wallet.","","### Authority","- \\"position_authority\\" - The authority that owns the position token.","","#### Special Errors","- `ClosePositionNotEmpty` - The provided position account is not empty."],"accounts":[{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"receiver","isMut":true,"isSigner":false},{"name":"position","isMut":true,"isSigner":false},{"name":"positionMint","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"setDefaultFeeRate","docs":["Set the default_fee_rate for a FeeTier","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority in the WhirlpoolConfig","","### Parameters","- `default_fee_rate` - The default fee rate that a pool will use if the pool uses this","fee tier during initialization.","","#### Special Errors","- `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds MAX_FEE_RATE."],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"feeTier","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true}],"args":[{"name":"defaultFeeRate","type":"u16"}]},{"name":"setDefaultProtocolFeeRate","docs":["Sets the default protocol fee rate for a WhirlpoolConfig","Protocol fee rate is represented as a basis point.","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can modify pool fees in the WhirlpoolConfig","","### Parameters","- `default_protocol_fee_rate` - Rate that is referenced during the initialization of a Whirlpool using this config.","","#### Special Errors","- `ProtocolFeeRateMaxExceeded` - If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE."],"accounts":[{"name":"whirlpoolsConfig","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true}],"args":[{"name":"defaultProtocolFeeRate","type":"u16"}]},{"name":"setFeeRate","docs":["Sets the fee rate for a Whirlpool.","Fee rate is represented as hundredths of a basis point.","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can modify pool fees in the WhirlpoolConfig","","### Parameters","- `fee_rate` - The rate that the pool will use to calculate fees going onwards.","","#### Special Errors","- `FeeRateMaxExceeded` - If the provided fee_rate exceeds MAX_FEE_RATE."],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true}],"args":[{"name":"feeRate","type":"u16"}]},{"name":"setProtocolFeeRate","docs":["Sets the protocol fee rate for a Whirlpool.","Protocol fee rate is represented as a basis point.","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can modify pool fees in the WhirlpoolConfig","","### Parameters","- `protocol_fee_rate` - The rate that the pool will use to calculate protocol fees going onwards.","","#### Special Errors","- `ProtocolFeeRateMaxExceeded` - If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE."],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true}],"args":[{"name":"protocolFeeRate","type":"u16"}]},{"name":"setFeeAuthority","docs":["Sets the fee authority for a WhirlpoolConfig.","The fee authority can set the fee & protocol fee rate for individual pools or","set the default fee rate for newly minted pools.","Only the current fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can modify pool fees in the WhirlpoolConfig"],"accounts":[{"name":"whirlpoolsConfig","isMut":true,"isSigner":false},{"name":"feeAuthority","isMut":false,"isSigner":true},{"name":"newFeeAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"setCollectProtocolFeesAuthority","docs":["Sets the fee authority to collect protocol fees for a WhirlpoolConfig.","Only the current collect protocol fee authority has permission to invoke this instruction.","","### Authority","- \\"fee_authority\\" - Set authority that can collect protocol fees in the WhirlpoolConfig"],"accounts":[{"name":"whirlpoolsConfig","isMut":true,"isSigner":false},{"name":"collectProtocolFeesAuthority","isMut":false,"isSigner":true},{"name":"newCollectProtocolFeesAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"setRewardAuthority","docs":["Set the whirlpool reward authority at the provided `reward_index`.","Only the current reward authority for this reward index has permission to invoke this instruction.","","### Authority","- \\"reward_authority\\" - Set authority that can control reward emission for this particular reward.","","#### Special Errors","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"newRewardAuthority","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"setRewardAuthorityBySuperAuthority","docs":["Set the whirlpool reward authority at the provided `reward_index`.","Only the current reward super authority has permission to invoke this instruction.","","### Authority","- \\"reward_authority\\" - Set authority that can control reward emission for this particular reward.","","#### Special Errors","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardEmissionsSuperAuthority","isMut":false,"isSigner":true},{"name":"newRewardAuthority","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"setRewardEmissionsSuperAuthority","docs":["Set the whirlpool reward super authority for a WhirlpoolConfig","Only the current reward super authority has permission to invoke this instruction.","This instruction will not change the authority on any `WhirlpoolRewardInfo` whirlpool rewards.","","### Authority","- \\"reward_emissions_super_authority\\" - Set authority that can control reward authorities for all pools in this config space."],"accounts":[{"name":"whirlpoolsConfig","isMut":true,"isSigner":false},{"name":"rewardEmissionsSuperAuthority","isMut":false,"isSigner":true},{"name":"newRewardEmissionsSuperAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"twoHopSwap","docs":["Perform a two-hop swap in this Whirlpool","","### Authority","- \\"token_authority\\" - The authority to withdraw tokens from the input token account.","","### Parameters","- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).","- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).","- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.","- `a_to_b_one` - The direction of the swap of hop one. True if swapping from A to B. False if swapping from B to A.","- `a_to_b_two` - The direction of the swap of hop two. True if swapping from A to B. False if swapping from B to A.","- `sqrt_price_limit_one` - The maximum/minimum price the swap will swap to in the first hop.","- `sqrt_price_limit_two` - The maximum/minimum price the swap will swap to in the second hop.","","#### Special Errors","- `ZeroTradableAmount` - User provided parameter `amount` is 0.","- `InvalidSqrtPriceLimitDirection` - User provided parameter `sqrt_price_limit` does not match the direction of the trade.","- `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool\'s max/min bounds for sqrt-price.","- `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.","- `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.","- `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.","- `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.","- `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0.","- `InvalidIntermediaryMint` - Error if the intermediary mint between hop one and two do not equal.","- `DuplicateTwoHopPool` - Error if whirlpool one & two are the same pool."],"accounts":[{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"tokenAuthority","isMut":false,"isSigner":true},{"name":"whirlpoolOne","isMut":true,"isSigner":false},{"name":"whirlpoolTwo","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountOneA","isMut":true,"isSigner":false},{"name":"tokenVaultOneA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountOneB","isMut":true,"isSigner":false},{"name":"tokenVaultOneB","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountTwoA","isMut":true,"isSigner":false},{"name":"tokenVaultTwoA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountTwoB","isMut":true,"isSigner":false},{"name":"tokenVaultTwoB","isMut":true,"isSigner":false},{"name":"tickArrayOne0","isMut":true,"isSigner":false},{"name":"tickArrayOne1","isMut":true,"isSigner":false},{"name":"tickArrayOne2","isMut":true,"isSigner":false},{"name":"tickArrayTwo0","isMut":true,"isSigner":false},{"name":"tickArrayTwo1","isMut":true,"isSigner":false},{"name":"tickArrayTwo2","isMut":true,"isSigner":false},{"name":"oracleOne","isMut":false,"isSigner":false},{"name":"oracleTwo","isMut":false,"isSigner":false}],"args":[{"name":"amount","type":"u64"},{"name":"otherAmountThreshold","type":"u64"},{"name":"amountSpecifiedIsInput","type":"bool"},{"name":"aToBOne","type":"bool"},{"name":"aToBTwo","type":"bool"},{"name":"sqrtPriceLimitOne","type":"u128"},{"name":"sqrtPriceLimitTwo","type":"u128"}]},{"name":"initializePositionBundle","docs":["Initializes a PositionBundle account that bundles several positions.","A unique token will be minted to represent the position bundle in the users wallet."],"accounts":[{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleMint","isMut":true,"isSigner":true},{"name":"positionBundleTokenAccount","isMut":true,"isSigner":false},{"name":"positionBundleOwner","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false},{"name":"associatedTokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"initializePositionBundleWithMetadata","docs":["Initializes a PositionBundle account that bundles several positions.","A unique token will be minted to represent the position bundle in the users wallet.","Additional Metaplex metadata is appended to identify the token."],"accounts":[{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleMint","isMut":true,"isSigner":true},{"name":"positionBundleMetadata","isMut":true,"isSigner":false,"docs":["https://github.com/metaplex-foundation/metaplex-program-library/blob/773a574c4b34e5b9f248a81306ec24db064e255f/token-metadata/program/src/utils/metadata.rs#L100"]},{"name":"positionBundleTokenAccount","isMut":true,"isSigner":false},{"name":"positionBundleOwner","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"metadataUpdateAuth","isMut":false,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false},{"name":"associatedTokenProgram","isMut":false,"isSigner":false},{"name":"metadataProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"deletePositionBundle","docs":["Delete a PositionBundle account. Burns the position bundle token in the owner\'s wallet.","","### Authority","- `position_bundle_owner` - The owner that owns the position bundle token.","","### Special Errors","- `PositionBundleNotDeletable` - The provided position bundle has open positions."],"accounts":[{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleMint","isMut":true,"isSigner":false},{"name":"positionBundleTokenAccount","isMut":true,"isSigner":false},{"name":"positionBundleOwner","isMut":false,"isSigner":true},{"name":"receiver","isMut":true,"isSigner":false},{"name":"tokenProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"openBundledPosition","docs":["Open a bundled position in a Whirlpool. No new tokens are issued","because the owner of the position bundle becomes the owner of the position.","The position will start off with 0 liquidity.","","### Authority","- `position_bundle_authority` - authority that owns the token corresponding to this desired position bundle.","","### Parameters","- `bundle_index` - The bundle index that we\'d like to open.","- `tick_lower_index` - The tick specifying the lower end of the position range.","- `tick_upper_index` - The tick specifying the upper end of the position range.","","#### Special Errors","- `InvalidBundleIndex` - If the provided bundle index is out of bounds.","- `InvalidTickIndex` - If a provided tick is out of bounds, out of order or not a multiple of","the tick-spacing in this pool."],"accounts":[{"name":"bundledPosition","isMut":true,"isSigner":false},{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleTokenAccount","isMut":false,"isSigner":false},{"name":"positionBundleAuthority","isMut":false,"isSigner":true},{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"bundleIndex","type":"u16"},{"name":"tickLowerIndex","type":"i32"},{"name":"tickUpperIndex","type":"i32"}]},{"name":"closeBundledPosition","docs":["Close a bundled position in a Whirlpool.","","### Authority","- `position_bundle_authority` - authority that owns the token corresponding to this desired position bundle.","","### Parameters","- `bundle_index` - The bundle index that we\'d like to close.","","#### Special Errors","- `InvalidBundleIndex` - If the provided bundle index is out of bounds.","- `ClosePositionNotEmpty` - The provided position account is not empty."],"accounts":[{"name":"bundledPosition","isMut":true,"isSigner":false},{"name":"positionBundle","isMut":true,"isSigner":false},{"name":"positionBundleTokenAccount","isMut":false,"isSigner":false},{"name":"positionBundleAuthority","isMut":false,"isSigner":true},{"name":"receiver","isMut":true,"isSigner":false}],"args":[{"name":"bundleIndex","type":"u16"}]},{"name":"collectFeesV2","docs":["Collect fees accrued for this position.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false}],"args":[{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"collectProtocolFeesV2","docs":["Collect the protocol fees accrued in this Whirlpool","","### Authority","- `collect_protocol_fees_authority` - assigned authority in the WhirlpoolConfig that can collect protocol fees"],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"collectProtocolFeesAuthority","isMut":false,"isSigner":true},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tokenDestinationA","isMut":true,"isSigner":false},{"name":"tokenDestinationB","isMut":true,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false}],"args":[{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"collectRewardV2","docs":["Collect rewards accrued for this position.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position."],"accounts":[{"name":"whirlpool","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"rewardOwnerAccount","isMut":true,"isSigner":false},{"name":"rewardMint","isMut":false,"isSigner":false},{"name":"rewardVault","isMut":true,"isSigner":false},{"name":"rewardTokenProgram","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"decreaseLiquidityV2","docs":["Withdraw liquidity from a position in the Whirlpool. This call also updates the position\'s accrued fees and rewards.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position.","","### Parameters","- `liquidity_amount` - The total amount of Liquidity the user desires to withdraw.","- `token_min_a` - The minimum amount of tokenA the user is willing to withdraw.","- `token_min_b` - The minimum amount of tokenB the user is willing to withdraw.","","#### Special Errors","- `LiquidityZero` - Provided liquidity amount is zero.","- `LiquidityTooHigh` - Provided liquidity exceeds u128::max.","- `TokenMinSubceeded` - The required token to perform this operation subceeds the user defined amount."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":true,"isSigner":false},{"name":"tickArrayUpper","isMut":true,"isSigner":false}],"args":[{"name":"liquidityAmount","type":"u128"},{"name":"tokenMinA","type":"u64"},{"name":"tokenMinB","type":"u64"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"increaseLiquidityV2","docs":["Add liquidity to a position in the Whirlpool. This call also updates the position\'s accrued fees and rewards.","","### Authority","- `position_authority` - authority that owns the token corresponding to this desired position.","","### Parameters","- `liquidity_amount` - The total amount of Liquidity the user is willing to deposit.","- `token_max_a` - The maximum amount of tokenA the user is willing to deposit.","- `token_max_b` - The maximum amount of tokenB the user is willing to deposit.","","#### Special Errors","- `LiquidityZero` - Provided liquidity amount is zero.","- `LiquidityTooHigh` - Provided liquidity exceeds u128::max.","- `TokenMaxExceeded` - The required token to perform this operation exceeds the user defined amount."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false},{"name":"positionAuthority","isMut":false,"isSigner":true},{"name":"position","isMut":true,"isSigner":false},{"name":"positionTokenAccount","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArrayLower","isMut":true,"isSigner":false},{"name":"tickArrayUpper","isMut":true,"isSigner":false}],"args":[{"name":"liquidityAmount","type":"u128"},{"name":"tokenMaxA","type":"u64"},{"name":"tokenMaxB","type":"u64"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"initializePoolV2","docs":["Initializes a Whirlpool account.","Fee rate is set to the default values on the config and supplied fee_tier.","","### Parameters","- `bumps` - The bump value when deriving the PDA of the Whirlpool address.","- `tick_spacing` - The desired tick spacing for this pool.","- `initial_sqrt_price` - The desired initial sqrt-price for this pool","","#### Special Errors","`InvalidTokenMintOrder` - The order of mints have to be ordered by","`SqrtPriceOutOfBounds` - provided initial_sqrt_price is not between 2^-64 to 2^64",""],"accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenBadgeA","isMut":false,"isSigner":false},{"name":"tokenBadgeB","isMut":false,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":true},{"name":"tokenVaultB","isMut":true,"isSigner":true},{"name":"feeTier","isMut":false,"isSigner":false},{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"tickSpacing","type":"u16"},{"name":"initialSqrtPrice","type":"u128"}]},{"name":"initializeRewardV2","docs":["Initialize reward for a Whirlpool. A pool can only support up to a set number of rewards.","","### Authority","- \\"reward_authority\\" - assigned authority by the reward_super_authority for the specified","reward-index in this Whirlpool","","### Parameters","- `reward_index` - The reward index that we\'d like to initialize. (0 <= index <= NUM_REWARDS)","","#### Special Errors","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"funder","isMut":true,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardMint","isMut":false,"isSigner":false},{"name":"rewardTokenBadge","isMut":false,"isSigner":false},{"name":"rewardVault","isMut":true,"isSigner":true},{"name":"rewardTokenProgram","isMut":false,"isSigner":false},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"rent","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"}]},{"name":"setRewardEmissionsV2","docs":["Set the reward emissions for a reward in a Whirlpool.","","### Authority","- \\"reward_authority\\" - assigned authority by the reward_super_authority for the specified","reward-index in this Whirlpool","","### Parameters","- `reward_index` - The reward index (0 <= index <= NUM_REWARDS) that we\'d like to modify.","- `emissions_per_second_x64` - The amount of rewards emitted in this pool.","","#### Special Errors","- `RewardVaultAmountInsufficient` - The amount of rewards in the reward vault cannot emit","more than a day of desired emissions.","- `InvalidTimestamp` - Provided timestamp is not in order with the previous timestamp.","- `InvalidRewardIndex` - If the provided reward index doesn\'t match the lowest uninitialized","index in this pool, or exceeds NUM_REWARDS, or","all reward slots for this pool has been initialized."],"accounts":[{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"rewardAuthority","isMut":false,"isSigner":true},{"name":"rewardVault","isMut":false,"isSigner":false}],"args":[{"name":"rewardIndex","type":"u8"},{"name":"emissionsPerSecondX64","type":"u128"}]},{"name":"swapV2","docs":["Perform a swap in this Whirlpool","","### Authority","- \\"token_authority\\" - The authority to withdraw tokens from the input token account.","","### Parameters","- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).","- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).","- `sqrt_price_limit` - The maximum/minimum price the swap will swap to.","- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.","- `a_to_b` - The direction of the swap. True if swapping from A to B. False if swapping from B to A.","","#### Special Errors","- `ZeroTradableAmount` - User provided parameter `amount` is 0.","- `InvalidSqrtPriceLimitDirection` - User provided parameter `sqrt_price_limit` does not match the direction of the trade.","- `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool\'s max/min bounds for sqrt-price.","- `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.","- `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.","- `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.","- `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.","- `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0."],"accounts":[{"name":"tokenProgramA","isMut":false,"isSigner":false},{"name":"tokenProgramB","isMut":false,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false},{"name":"tokenAuthority","isMut":false,"isSigner":true},{"name":"whirlpool","isMut":true,"isSigner":false},{"name":"tokenMintA","isMut":false,"isSigner":false},{"name":"tokenMintB","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountA","isMut":true,"isSigner":false},{"name":"tokenVaultA","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountB","isMut":true,"isSigner":false},{"name":"tokenVaultB","isMut":true,"isSigner":false},{"name":"tickArray0","isMut":true,"isSigner":false},{"name":"tickArray1","isMut":true,"isSigner":false},{"name":"tickArray2","isMut":true,"isSigner":false},{"name":"oracle","isMut":true,"isSigner":false}],"args":[{"name":"amount","type":"u64"},{"name":"otherAmountThreshold","type":"u64"},{"name":"sqrtPriceLimit","type":"u128"},{"name":"amountSpecifiedIsInput","type":"bool"},{"name":"aToB","type":"bool"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"twoHopSwapV2","docs":["Perform a two-hop swap in this Whirlpool","","### Authority","- \\"token_authority\\" - The authority to withdraw tokens from the input token account.","","### Parameters","- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).","- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).","- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.","- `a_to_b_one` - The direction of the swap of hop one. True if swapping from A to B. False if swapping from B to A.","- `a_to_b_two` - The direction of the swap of hop two. True if swapping from A to B. False if swapping from B to A.","- `sqrt_price_limit_one` - The maximum/minimum price the swap will swap to in the first hop.","- `sqrt_price_limit_two` - The maximum/minimum price the swap will swap to in the second hop.","","#### Special Errors","- `ZeroTradableAmount` - User provided parameter `amount` is 0.","- `InvalidSqrtPriceLimitDirection` - User provided parameter `sqrt_price_limit` does not match the direction of the trade.","- `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool\'s max/min bounds for sqrt-price.","- `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.","- `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.","- `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.","- `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.","- `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0.","- `InvalidIntermediaryMint` - Error if the intermediary mint between hop one and two do not equal.","- `DuplicateTwoHopPool` - Error if whirlpool one & two are the same pool."],"accounts":[{"name":"whirlpoolOne","isMut":true,"isSigner":false},{"name":"whirlpoolTwo","isMut":true,"isSigner":false},{"name":"tokenMintInput","isMut":false,"isSigner":false},{"name":"tokenMintIntermediate","isMut":false,"isSigner":false},{"name":"tokenMintOutput","isMut":false,"isSigner":false},{"name":"tokenProgramInput","isMut":false,"isSigner":false},{"name":"tokenProgramIntermediate","isMut":false,"isSigner":false},{"name":"tokenProgramOutput","isMut":false,"isSigner":false},{"name":"tokenOwnerAccountInput","isMut":true,"isSigner":false},{"name":"tokenVaultOneInput","isMut":true,"isSigner":false},{"name":"tokenVaultOneIntermediate","isMut":true,"isSigner":false},{"name":"tokenVaultTwoIntermediate","isMut":true,"isSigner":false},{"name":"tokenVaultTwoOutput","isMut":true,"isSigner":false},{"name":"tokenOwnerAccountOutput","isMut":true,"isSigner":false},{"name":"tokenAuthority","isMut":false,"isSigner":true},{"name":"tickArrayOne0","isMut":true,"isSigner":false},{"name":"tickArrayOne1","isMut":true,"isSigner":false},{"name":"tickArrayOne2","isMut":true,"isSigner":false},{"name":"tickArrayTwo0","isMut":true,"isSigner":false},{"name":"tickArrayTwo1","isMut":true,"isSigner":false},{"name":"tickArrayTwo2","isMut":true,"isSigner":false},{"name":"oracleOne","isMut":true,"isSigner":false},{"name":"oracleTwo","isMut":true,"isSigner":false},{"name":"memoProgram","isMut":false,"isSigner":false}],"args":[{"name":"amount","type":"u64"},{"name":"otherAmountThreshold","type":"u64"},{"name":"amountSpecifiedIsInput","type":"bool"},{"name":"aToBOne","type":"bool"},{"name":"aToBTwo","type":"bool"},{"name":"sqrtPriceLimitOne","type":"u128"},{"name":"sqrtPriceLimitTwo","type":"u128"},{"name":"remainingAccountsInfo","type":{"defined":"RemainingAccountsInfo"}}]},{"name":"initializeConfigExtension","accounts":[{"name":"config","isMut":false,"isSigner":false},{"name":"configExtension","isMut":true,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"feeAuthority","isMut":false,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"setConfigExtensionAuthority","accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpoolsConfigExtension","isMut":true,"isSigner":false},{"name":"configExtensionAuthority","isMut":false,"isSigner":true},{"name":"newConfigExtensionAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"setTokenBadgeAuthority","accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpoolsConfigExtension","isMut":true,"isSigner":false},{"name":"configExtensionAuthority","isMut":false,"isSigner":true},{"name":"newTokenBadgeAuthority","isMut":false,"isSigner":false}],"args":[]},{"name":"initializeTokenBadge","accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpoolsConfigExtension","isMut":false,"isSigner":false},{"name":"tokenBadgeAuthority","isMut":false,"isSigner":true},{"name":"tokenMint","isMut":false,"isSigner":false},{"name":"tokenBadge","isMut":true,"isSigner":false},{"name":"funder","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"deleteTokenBadge","accounts":[{"name":"whirlpoolsConfig","isMut":false,"isSigner":false},{"name":"whirlpoolsConfigExtension","isMut":false,"isSigner":false},{"name":"tokenBadgeAuthority","isMut":false,"isSigner":true},{"name":"tokenMint","isMut":false,"isSigner":false},{"name":"tokenBadge","isMut":true,"isSigner":false},{"name":"receiver","isMut":true,"isSigner":false}],"args":[]}],"accounts":[{"name":"WhirlpoolsConfigExtension","type":{"kind":"struct","fields":[{"name":"whirlpoolsConfig","type":"publicKey"},{"name":"configExtensionAuthority","type":"publicKey"},{"name":"tokenBadgeAuthority","type":"publicKey"}]}},{"name":"WhirlpoolsConfig","type":{"kind":"struct","fields":[{"name":"feeAuthority","type":"publicKey"},{"name":"collectProtocolFeesAuthority","type":"publicKey"},{"name":"rewardEmissionsSuperAuthority","type":"publicKey"},{"name":"defaultProtocolFeeRate","type":"u16"}]}},{"name":"FeeTier","type":{"kind":"struct","fields":[{"name":"whirlpoolsConfig","type":"publicKey"},{"name":"tickSpacing","type":"u16"},{"name":"defaultFeeRate","type":"u16"}]}},{"name":"PositionBundle","type":{"kind":"struct","fields":[{"name":"positionBundleMint","type":"publicKey"},{"name":"positionBitmap","type":{"array":["u8",32]}}]}},{"name":"Position","type":{"kind":"struct","fields":[{"name":"whirlpool","type":"publicKey"},{"name":"positionMint","type":"publicKey"},{"name":"liquidity","type":"u128"},{"name":"tickLowerIndex","type":"i32"},{"name":"tickUpperIndex","type":"i32"},{"name":"feeGrowthCheckpointA","type":"u128"},{"name":"feeOwedA","type":"u64"},{"name":"feeGrowthCheckpointB","type":"u128"},{"name":"feeOwedB","type":"u64"},{"name":"rewardInfos","type":{"array":[{"defined":"PositionRewardInfo"},3]}}]}},{"name":"TickArray","type":{"kind":"struct","fields":[{"name":"startTickIndex","type":"i32"},{"name":"ticks","type":{"array":[{"defined":"Tick"},88]}},{"name":"whirlpool","type":"publicKey"}]}},{"name":"TokenBadge","type":{"kind":"struct","fields":[{"name":"whirlpoolsConfig","type":"publicKey"},{"name":"tokenMint","type":"publicKey"}]}},{"name":"Whirlpool","type":{"kind":"struct","fields":[{"name":"whirlpoolsConfig","type":"publicKey"},{"name":"whirlpoolBump","type":{"array":["u8",1]}},{"name":"tickSpacing","type":"u16"},{"name":"tickSpacingSeed","type":{"array":["u8",2]}},{"name":"feeRate","type":"u16"},{"name":"protocolFeeRate","type":"u16"},{"name":"liquidity","type":"u128"},{"name":"sqrtPrice","type":"u128"},{"name":"tickCurrentIndex","type":"i32"},{"name":"protocolFeeOwedA","type":"u64"},{"name":"protocolFeeOwedB","type":"u64"},{"name":"tokenMintA","type":"publicKey"},{"name":"tokenVaultA","type":"publicKey"},{"name":"feeGrowthGlobalA","type":"u128"},{"name":"tokenMintB","type":"publicKey"},{"name":"tokenVaultB","type":"publicKey"},{"name":"feeGrowthGlobalB","type":"u128"},{"name":"rewardLastUpdatedTimestamp","type":"u64"},{"name":"rewardInfos","type":{"array":[{"defined":"WhirlpoolRewardInfo"},3]}}]}}],"types":[{"name":"OpenPositionBumps","type":{"kind":"struct","fields":[{"name":"positionBump","type":"u8"}]}},{"name":"OpenPositionWithMetadataBumps","type":{"kind":"struct","fields":[{"name":"positionBump","type":"u8"},{"name":"metadataBump","type":"u8"}]}},{"name":"PositionRewardInfo","type":{"kind":"struct","fields":[{"name":"growthInsideCheckpoint","type":"u128"},{"name":"amountOwed","type":"u64"}]}},{"name":"Tick","type":{"kind":"struct","fields":[{"name":"initialized","type":"bool"},{"name":"liquidityNet","type":"i128"},{"name":"liquidityGross","type":"u128"},{"name":"feeGrowthOutsideA","type":"u128"},{"name":"feeGrowthOutsideB","type":"u128"},{"name":"rewardGrowthsOutside","type":{"array":["u128",3]}}]}},{"name":"WhirlpoolRewardInfo","docs":["Stores the state relevant for tracking liquidity mining rewards at the `Whirlpool` level.","These values are used in conjunction with `PositionRewardInfo`, `Tick.reward_growths_outside`,","and `Whirlpool.reward_last_updated_timestamp` to determine how many rewards are earned by open","positions."],"type":{"kind":"struct","fields":[{"name":"mint","docs":["Reward token mint."],"type":"publicKey"},{"name":"vault","docs":["Reward vault token account."],"type":"publicKey"},{"name":"authority","docs":["Authority account that has permission to initialize the reward and set emissions."],"type":"publicKey"},{"name":"emissionsPerSecondX64","docs":["Q64.64 number that indicates how many tokens per second are earned per unit of liquidity."],"type":"u128"},{"name":"growthGlobalX64","docs":["Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward","emissions were turned on."],"type":"u128"}]}},{"name":"WhirlpoolBumps","type":{"kind":"struct","fields":[{"name":"whirlpoolBump","type":"u8"}]}},{"name":"RemainingAccountsSlice","type":{"kind":"struct","fields":[{"name":"accountsType","type":{"defined":"AccountsType"}},{"name":"length","type":"u8"}]}},{"name":"RemainingAccountsInfo","type":{"kind":"struct","fields":[{"name":"slices","type":{"vec":{"defined":"RemainingAccountsSlice"}}}]}},{"name":"CurrIndex","type":{"kind":"enum","variants":[{"name":"Below"},{"name":"Inside"},{"name":"Above"}]}},{"name":"TickLabel","type":{"kind":"enum","variants":[{"name":"Upper"},{"name":"Lower"}]}},{"name":"Direction","type":{"kind":"enum","variants":[{"name":"Left"},{"name":"Right"}]}},{"name":"AccountsType","type":{"kind":"enum","variants":[{"name":"TransferHookA"},{"name":"TransferHookB"},{"name":"TransferHookReward"},{"name":"TransferHookInput"},{"name":"TransferHookIntermediate"},{"name":"TransferHookOutput"}]}}],"errors":[{"code":6000,"name":"InvalidEnum","msg":"Enum value could not be converted"},{"code":6001,"name":"InvalidStartTick","msg":"Invalid start tick index provided."},{"code":6002,"name":"TickArrayExistInPool","msg":"Tick-array already exists in this whirlpool"},{"code":6003,"name":"TickArrayIndexOutofBounds","msg":"Attempt to search for a tick-array failed"},{"code":6004,"name":"InvalidTickSpacing","msg":"Tick-spacing is not supported"},{"code":6005,"name":"ClosePositionNotEmpty","msg":"Position is not empty It cannot be closed"},{"code":6006,"name":"DivideByZero","msg":"Unable to divide by zero"},{"code":6007,"name":"NumberCastError","msg":"Unable to cast number into BigInt"},{"code":6008,"name":"NumberDownCastError","msg":"Unable to down cast number"},{"code":6009,"name":"TickNotFound","msg":"Tick not found within tick array"},{"code":6010,"name":"InvalidTickIndex","msg":"Provided tick index is either out of bounds or uninitializable"},{"code":6011,"name":"SqrtPriceOutOfBounds","msg":"Provided sqrt price out of bounds"},{"code":6012,"name":"LiquidityZero","msg":"Liquidity amount must be greater than zero"},{"code":6013,"name":"LiquidityTooHigh","msg":"Liquidity amount must be less than i64::MAX"},{"code":6014,"name":"LiquidityOverflow","msg":"Liquidity overflow"},{"code":6015,"name":"LiquidityUnderflow","msg":"Liquidity underflow"},{"code":6016,"name":"LiquidityNetError","msg":"Tick liquidity net underflowed or overflowed"},{"code":6017,"name":"TokenMaxExceeded","msg":"Exceeded token max"},{"code":6018,"name":"TokenMinSubceeded","msg":"Did not meet token min"},{"code":6019,"name":"MissingOrInvalidDelegate","msg":"Position token account has a missing or invalid delegate"},{"code":6020,"name":"InvalidPositionTokenAmount","msg":"Position token amount must be 1"},{"code":6021,"name":"InvalidTimestampConversion","msg":"Timestamp should be convertible from i64 to u64"},{"code":6022,"name":"InvalidTimestamp","msg":"Timestamp should be greater than the last updated timestamp"},{"code":6023,"name":"InvalidTickArraySequence","msg":"Invalid tick array sequence provided for instruction."},{"code":6024,"name":"InvalidTokenMintOrder","msg":"Token Mint in wrong order"},{"code":6025,"name":"RewardNotInitialized","msg":"Reward not initialized"},{"code":6026,"name":"InvalidRewardIndex","msg":"Invalid reward index"},{"code":6027,"name":"RewardVaultAmountInsufficient","msg":"Reward vault requires amount to support emissions for at least one day"},{"code":6028,"name":"FeeRateMaxExceeded","msg":"Exceeded max fee rate"},{"code":6029,"name":"ProtocolFeeRateMaxExceeded","msg":"Exceeded max protocol fee rate"},{"code":6030,"name":"MultiplicationShiftRightOverflow","msg":"Multiplication with shift right overflow"},{"code":6031,"name":"MulDivOverflow","msg":"Muldiv overflow"},{"code":6032,"name":"MulDivInvalidInput","msg":"Invalid div_u256 input"},{"code":6033,"name":"MultiplicationOverflow","msg":"Multiplication overflow"},{"code":6034,"name":"InvalidSqrtPriceLimitDirection","msg":"Provided SqrtPriceLimit not in the same direction as the swap."},{"code":6035,"name":"ZeroTradableAmount","msg":"There are no tradable amount to swap."},{"code":6036,"name":"AmountOutBelowMinimum","msg":"Amount out below minimum threshold"},{"code":6037,"name":"AmountInAboveMaximum","msg":"Amount in above maximum threshold"},{"code":6038,"name":"TickArraySequenceInvalidIndex","msg":"Invalid index for tick array sequence"},{"code":6039,"name":"AmountCalcOverflow","msg":"Amount calculated overflows"},{"code":6040,"name":"AmountRemainingOverflow","msg":"Amount remaining overflows"},{"code":6041,"name":"InvalidIntermediaryMint","msg":"Invalid intermediary mint"},{"code":6042,"name":"DuplicateTwoHopPool","msg":"Duplicate two hop pool"},{"code":6043,"name":"InvalidBundleIndex","msg":"Bundle index is out of bounds"},{"code":6044,"name":"BundledPositionAlreadyOpened","msg":"Position has already been opened"},{"code":6045,"name":"BundledPositionAlreadyClosed","msg":"Position has already been closed"},{"code":6046,"name":"PositionBundleNotDeletable","msg":"Unable to delete PositionBundle with open positions"},{"code":6047,"name":"UnsupportedTokenMint","msg":"Token mint has unsupported attributes"},{"code":6048,"name":"RemainingAccountsInvalidSlice","msg":"Invalid remaining accounts"},{"code":6049,"name":"RemainingAccountsInsufficient","msg":"Insufficient remaining accounts"},{"code":6050,"name":"NoExtraAccountsForTransferHook","msg":"Unable to call transfer hook without extra accounts"},{"code":6051,"name":"IntermediateTokenAmountMismatch","msg":"Output and input amount mismatch"}]}')},44946:t=>{"use strict";t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},75207:t=>{"use strict";t.exports=JSON.parse('{"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"}}')},1308:t=>{"use strict";t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},29799:t=>{"use strict";t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},18597:t=>{"use strict";t.exports={i8:"6.5.4"}},22562:t=>{"use strict";t.exports=JSON.parse('{"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"}')}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{"use strict";function t(){}function e(t,e){for(const n in e)t[n]=e[n];return t}function r(t){return t()}function i(){return Object.create(null)}function o(t){t.forEach(r)}function s(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(t){return 0===Object.keys(t).length}function c(e,...n){if(null==e)return t;const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}function d(t,e,n,r){if(t){const i=l(t,e,n,r);return t[0](i)}}function l(t,n,r,i){return t[1]&&i?e(r.ctx.slice(),t[1](i(n))):r.ctx}function h(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(void 0===e.dirty)return i;if("object"==typeof i){const t=[],n=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],n=t.ctx.length/32;for(let t=0;t{this._listeners.delete(t),this._observer.unobserve(t)}}_getObserver(){var t;return null!==(t=this._observer)&&void 0!==t?t:this._observer=new ResizeObserver((t=>{var e;for(const n of t)y.entries.set(n.target,n),null===(e=this._listeners.get(n.target))||void 0===e||e(n)}))}}y.entries="WeakMap"in g?new WeakMap:void 0;let b,w=!1;function _(t,e){t.appendChild(e)}function v(t,e,n){t.insertBefore(e,n||null)}function k(t){t.parentNode&&t.parentNode.removeChild(t)}function M(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function T(t){return function(e){return e.preventDefault(),t.call(this,e)}}function P(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function B(t,e){e=""+e,t.data!==e&&(t.data=e)}function L(t,e){t.value=null==e?"":e}function $(t,e,n,r){null==n?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function R(t,e,n){for(let n=0;nt.call(this,e)))}new Map;const U=[],j=[];let Y=[];const F=[],W=Promise.resolve();let H=!1;function K(){H||(H=!0,W.then(J))}function q(){return K(),W}function V(t){Y.push(t)}function G(t){F.push(t)}const Z=new Set;let X=0;function J(){if(0!==X)return;const t=b;do{try{for(;X{tt.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}else r&&r()}function at(t,e){const n=e.token={};function r(t,r,i,o){if(e.token!==n)return;e.resolved=o;let s=e.ctx;void 0!==i&&(s=s.slice(),s[i]=o);const a=t&&(e.current=t)(s);let u=!1;e.block&&(e.blocks?e.blocks.forEach(((t,n)=>{n!==r&&t&&(rt(),st(t,1,1,(()=>{e.blocks[n]===t&&(e.blocks[n]=null)})),it())})):e.block.d(1),a.c(),ot(a,1),a.m(e.mount(),e.anchor),u=!0),e.block=a,e.blocks&&(e.blocks[r]=a),u&&J()}if(!(i=t)||"object"!=typeof i&&"function"!=typeof i||"function"!=typeof i.then){if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}else{const n=N();if(t.then((t=>{C(n),r(e.then,1,e.value,t),C(null)}),(t=>{if(C(n),r(e.catch,2,e.error,t),C(null),!e.hasCatch)throw t})),e.current!==e.pending)return r(e.pending,0),!0}var i}function ut(t,e,n){const r=e.slice(),{resolved:i}=t;t.current===t.then&&(r[t.value]=i),t.current===t.catch&&(r[t.error]=i),t.block.p(r,n)}function ct(t,e){const n={},r={},i={$$scope:1};let o=t.length;for(;o--;){const s=t[o],a=e[o];if(a){for(const t in s)t in a||(r[t]=1);for(const t in a)i[t]||(n[t]=a[t],i[t]=1);t[o]=a}else for(const t in s)i[t]=1}for(const t in r)t in n||(n[t]=void 0);return n}function dt(t){return"object"==typeof t&&null!==t?t:{}}function lt(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function ht(t){t&&t.c()}function ft(t,e,n,i){const{fragment:a,after_update:u}=t.$$;a&&a.m(e,n),i||V((()=>{const e=t.$$.on_mount.map(r).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):o(e),t.$$.on_mount=[]})),u.forEach(V)}function pt(t,e){const n=t.$$;null!==n.fragment&&(function(t){const e=[],n=[];Y.forEach((r=>-1===t.indexOf(r)?e.push(r):n.push(r))),n.forEach((t=>t())),Y=e}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function mt(e,n,r,s,a,u,c,d=[-1]){const l=b;C(e);const h=e.$$={fragment:null,ctx:[],props:u,update:t,not_equal:a,bound:i(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(l?l.$$.context:[])),callbacks:i(),dirty:d,skip_bound:!1,root:n.target||l.$$.root};c&&c(h.root);let f=!1;if(h.ctx=r?r(e,n.props||{},((t,n,...r)=>{const i=r.length?r[0]:n;return h.ctx&&a(h.ctx[t],h.ctx[t]=i)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](i),f&&function(t,e){-1===t.$$.dirty[0]&&(U.push(t),K(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){this.$$set&&!u(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});class gt{$destroy(){pt(this,1),this.$destroy=t}$on(e,n){if(!s(n))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){this.$$set&&!u(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function yt(e){let n,r,i;return{c(){n=A("h2"),n.textContent="Supported Accounts",r=I(),i=A("ul"),i.innerHTML="
  • Whirlpool / Whirlpool
  • \n
  • Whirlpool / WhirlpoolsConfig
  • \n
  • Whirlpool / WhirlpoolsConfigExtension
  • \n
  • Whirlpool / TokenBadge
  • \n
  • Whirlpool / FeeTier
  • \n
  • Whirlpool / Position
  • \n
  • Whirlpool / TickArray
  • \n
  • Whirlpool / PositionBundle
  • \n
  • Token / Mint
  • \n
  • Token / Account
  • \n
  • Token2022 / Mint
  • \n
  • Token2022 / Account
  • \n
  • TokenSwap / SwapState
  • \n
  • Aquafarm / GlobalFarm
  • \n
  • Aquafarm / UserFarm
  • \n
  • Generic
  • "},m(t,e){v(t,n,e),v(t,r,e),v(t,i,e)},p:t,i:t,o:t,d(t){t&&k(n),t&&k(r),t&&k(i)}}}function bt(t){let e,n;return{c(){e=S("@"),n=S(t[2])},m(t,r){v(t,e,r),v(t,n,r)},p(t,e){4&e&&B(n,t[2])},d(t){t&&k(e),t&&k(n)}}}function wt(t){let e,n,r,i,o,s,a,u,c=void 0!==t[2]&&bt(t);const l=t[4].default,m=d(l,t,t[3],null);return{c(){e=A("dt"),n=A("b"),r=S(t[0]),i=I(),o=A("sub"),s=S(t[1]),c&&c.c(),a=A("dd"),m&&m.c(),$(o,"color","#666")},m(t,d){v(t,e,d),_(e,n),_(n,r),_(e,i),_(e,o),_(o,s),c&&c.m(o,null),v(t,a,d),m&&m.m(a,null),u=!0},p(t,[e]){(!u||1&e)&&B(r,t[0]),(!u||2&e)&&B(s,t[1]),void 0!==t[2]?c?c.p(t,e):(c=bt(t),c.c(),c.m(o,null)):c&&(c.d(1),c=null),m&&m.p&&(!u||8&e)&&f(m,l,t,t[3],u?h(l,t[3],e,null):p(t[3]),null)},i(t){u||(ot(m,t),u=!0)},o(t){st(m,t),u=!1},d(t){t&&k(e),c&&c.d(),t&&k(a),m&&m.d(t)}}}function _t(t,e,n){let{$$slots:r={},$$scope:i}=e,{name:o}=e,{type:s=""}=e,{offset:a}=e;return t.$$set=t=>{"name"in t&&n(0,o=t.name),"type"in t&&n(1,s=t.type),"offset"in t&&n(2,a=t.offset),"$$scope"in t&&n(3,i=t.$$scope)},[o,s,a,i,r]}const vt=class extends gt{constructor(t){super(),mt(this,t,_t,wt,a,{name:0,type:1,offset:2})}};var kt=n(78845),Mt=n(18245);let At;function St(t){At=new Mt.Connection(t,"confirmed")}function It(){return At}const xt=[{id:"helius",name:"Mainnet HELIUS",network:"mainnet",url:"https://rpc-proxy-account-microscope.yugure.dev"},{id:"solana",name:"Mainnet Solana",network:"mainnet",url:"https://api.mainnet-beta.solana.com"},{id:"devnet",name:"Devnet Solana",network:"devnet",url:"https://api.devnet.solana.com"},{id:"localnet",name:"Test Validator",network:"localnet",url:"http://localhost:8899"}];function Et(){for(const t of xt)if(t.url===At.rpcEndpoint)return t;return{id:"custom",name:"custom",network:"custom",url:At.rpcEndpoint}}var Tt,Pt,Bt=9e15,Lt=1e9,$t="0123456789abcdef",Rt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ot="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Dt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Bt,maxE:Bt,crypto:!1},Ct=!0,Nt="[DecimalError] ",zt=Nt+"Invalid argument: ",Ut=Nt+"Precision limit exceeded",jt=Nt+"crypto unavailable",Yt="[object Decimal]",Ft=Math.floor,Wt=Math.pow,Ht=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Kt=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,qt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Vt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Gt=1e7,Zt=7,Xt=Rt.length-1,Jt=Ot.length-1,Qt={toStringTag:Yt};function te(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;en)throw Error(zt+t)}function ne(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=Zt,i=0):(i=Math.ceil((e+1)/Zt),e%=Zt),o=Wt(10,Zt-e),a=t[i]%o|0,null==r?e<3?(0==e?a=a/100|0:1==e&&(a=a/10|0),s=n<4&&99999==a||n>3&&49999==a||5e4==a||0==a):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(t[i+1]/o/100|0)==Wt(10,e-2)-1||(a==o/2||0==a)&&0==(t[i+1]/o/100|0):e<4?(0==e?a=a/1e3|0:1==e?a=a/100|0:2==e&&(a=a/10|0),s=(r||n<4)&&9999==a||!r&&n>3&&4999==a):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==Wt(10,e-3)-1,s}function re(t,e,n){for(var r,i,o=[0],s=0,a=t.length;sn-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}Qt.absoluteValue=Qt.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),oe(t)},Qt.ceil=function(){return oe(new this.constructor(this),this.e+1,2)},Qt.clampedTo=Qt.clamp=function(t,e){var n=this,r=n.constructor;if(t=new r(t),e=new r(e),!t.s||!e.s)return new r(NaN);if(t.gt(e))throw Error(zt+e);return n.cmp(t)<0?t:n.cmp(e)>0?e:new r(n)},Qt.comparedTo=Qt.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,u=o.s,c=t.s;if(!s||!a)return u&&c?u!==c?u:s===a?0:!s^u<0?1:-1:NaN;if(!s[0]||!a[0])return s[0]?u:a[0]?-c:0;if(u!==c)return u;if(o.e!==t.e)return o.e>t.e^u<0?1:-1;for(e=0,n=(r=s.length)<(i=a.length)?r:i;ea[e]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1},Qt.cosine=Qt.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+Zt,r.rounding=1,n=function(t,e){var n,r,i;if(e.isZero())return e;(r=e.d.length)<32?i=(1/ve(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=_e(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}(r,ke(r,n)),r.precision=t,r.rounding=e,oe(2==Pt||3==Pt?n.neg():n,t,e,!0)):new r(1):new r(NaN)},Qt.cubeRoot=Qt.cbrt=function(){var t,e,n,r,i,o,s,a,u,c,d=this,l=d.constructor;if(!d.isFinite()||d.isZero())return new l(d);for(Ct=!1,(o=d.s*Wt(d.s*d,1/3))&&Math.abs(o)!=1/0?r=new l(o.toString()):(n=te(d.d),(o=((t=d.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=Wt(n,1/3),t=Ft((t+1)/3)-(t%3==(t<0?-1:2)),(r=new l(n=o==1/0?"5e"+t:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+t)).s=d.s),s=(t=l.precision)+3;;)if(c=(u=(a=r).times(a).times(a)).plus(d),r=ie(c.plus(d).times(a),c.plus(u),s+2,1),te(a.d).slice(0,s)===(n=te(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(oe(r,t+1,1),e=!r.times(r).times(r).eq(d));break}if(!i&&(oe(a,t+1,0),a.times(a).times(a).eq(d))){r=a;break}s+=4,i=1}return Ct=!0,oe(r,t,l.rounding,e)},Qt.decimalPlaces=Qt.dp=function(){var t,e=this.d,n=NaN;if(e){if(n=((t=e.length-1)-Ft(this.e/Zt))*Zt,t=e[t])for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},Qt.dividedBy=Qt.div=function(t){return ie(this,new this.constructor(t))},Qt.dividedToIntegerBy=Qt.divToInt=function(t){var e=this.constructor;return oe(ie(this,new e(t),0,1,1),e.precision,e.rounding)},Qt.equals=Qt.eq=function(t){return 0===this.cmp(t)},Qt.floor=function(){return oe(new this.constructor(this),this.e+1,3)},Qt.greaterThan=Qt.gt=function(t){return this.cmp(t)>0},Qt.greaterThanOrEqualTo=Qt.gte=function(t){var e=this.cmp(t);return 1==e||0===e},Qt.hyperbolicCosine=Qt.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?e=(1/ve(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),o=_e(s,1,o.times(e),new s(1),!0);for(var u,c=t,d=new s(8);c--;)u=o.times(o),o=a.minus(u.times(d.minus(u.times(d))));return oe(o,s.precision=n,s.rounding=r,!0)},Qt.hyperbolicSine=Qt.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=_e(o,2,i,i,!0);else{t=(t=1.4*Math.sqrt(r))>16?16:0|t,i=_e(o,2,i=i.times(1/ve(5,t)),i,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=n,oe(i,e,n,!0)},Qt.hyperbolicTangent=Qt.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,ie(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},Qt.inverseCosine=Qt.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?e.isNeg()?ce(n,i,o):new n(0):new n(NaN):e.isZero()?ce(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=ce(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))},Qt.inverseHyperbolicCosine=Qt.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,Ct=!1,n=n.times(n).minus(1).sqrt().plus(n),Ct=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)},Qt.inverseHyperbolicSine=Qt.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,Ct=!1,n=n.times(n).plus(1).sqrt().plus(n),Ct=!0,r.precision=t,r.rounding=e,n.ln())},Qt.inverseHyperbolicTangent=Qt.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?oe(new o(i),t,e,!0):(o.precision=n=r-i.e,i=ie(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)},Qt.inverseSine=Qt.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==e?0===e?((t=ce(o,n+4,r).times(.5)).s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},Qt.inverseTangent=Qt.atan=function(){var t,e,n,r,i,o,s,a,u,c=this,d=c.constructor,l=d.precision,h=d.rounding;if(c.isFinite()){if(c.isZero())return new d(c);if(c.abs().eq(1)&&l+4<=Jt)return(s=ce(d,l+4,h).times(.25)).s=c.s,s}else{if(!c.s)return new d(NaN);if(l+4<=Jt)return(s=ce(d,l+4,h).times(.5)).s=c.s,s}for(d.precision=a=l+10,d.rounding=1,t=n=Math.min(28,a/Zt+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Ct=!1,e=Math.ceil(a/Zt),r=1,u=c.times(c),s=new d(c),i=c;-1!==t;)if(i=i.times(u),o=s.minus(i.div(r+=2)),i=i.times(u),void 0!==(s=o.plus(i.div(r+=2))).d[e])for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<this.d.length-2},Qt.isNaN=function(){return!this.s},Qt.isNegative=Qt.isNeg=function(){return this.s<0},Qt.isPositive=Qt.isPos=function(){return this.s>0},Qt.isZero=function(){return!!this.d&&0===this.d[0]},Qt.lessThan=Qt.lt=function(t){return this.cmp(t)<0},Qt.lessThanOrEqualTo=Qt.lte=function(t){return this.cmp(t)<1},Qt.logarithm=Qt.log=function(t){var e,n,r,i,o,s,a,u,c=this,d=c.constructor,l=d.precision,h=d.rounding;if(null==t)t=new d(10),e=!0;else{if(n=(t=new d(t)).d,t.s<0||!n||!n[0]||t.eq(1))return new d(NaN);e=t.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new d(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(Ct=!1,s=ge(c,a=l+5),r=e?ue(d,a+10):ge(t,a),ne((u=ie(s,r,a,1)).d,i=l,h))do{if(s=ge(c,a+=10),r=e?ue(d,a+10):ge(t,a),u=ie(s,r,a,1),!o){+te(u.d).slice(i+1,i+15)+1==1e14&&(u=oe(u,l+1,0));break}}while(ne(u.d,i+=10,h));return Ct=!0,oe(u,l,h)},Qt.minus=Qt.sub=function(t){var e,n,r,i,o,s,a,u,c,d,l,h,f=this,p=f.constructor;if(t=new p(t),!f.d||!t.d)return f.s&&t.s?f.d?t.s=-t.s:t=new p(t.d||f.s!==t.s?f:NaN):t=new p(NaN),t;if(f.s!=t.s)return t.s=-t.s,f.plus(t);if(c=f.d,h=t.d,a=p.precision,u=p.rounding,!c[0]||!h[0]){if(h[0])t.s=-t.s;else{if(!c[0])return new p(3===u?-0:0);t=new p(f)}return Ct?oe(t,a,u):t}if(n=Ft(t.e/Zt),d=Ft(f.e/Zt),c=c.slice(),o=d-n){for((l=o<0)?(e=c,o=-o,s=h.length):(e=h,n=d,s=c.length),o>(r=Math.max(Math.ceil(a/Zt),s)+2)&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for((l=(r=c.length)<(s=h.length))&&(s=r),r=0;r0;--r)c[s++]=0;for(r=h.length;r>o;){if(c[--r](s=(o=Math.ceil(a/Zt))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=c.length)-(i=d.length)<0&&(i=s,n=d,d=c,c=n),e=0;i;)e=(c[--i]=c[i]+d[i]+e)/Gt|0,c[i]%=Gt;for(e&&(c.unshift(e),++r),s=c.length;0==c[--s];)c.pop();return t.d=c,t.e=ae(c,r),Ct?oe(t,a,u):t},Qt.precision=Qt.sd=function(t){var e,n=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(zt+t);return n.d?(e=de(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},Qt.round=function(){var t=this,e=t.constructor;return oe(new e(t),t.e+1,e.rounding)},Qt.sine=Qt.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+Zt,r.rounding=1,n=function(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:_e(t,2,e,e);n=(n=1.4*Math.sqrt(r))>16?16:0|n,e=_e(t,2,e=e.times(1/ve(5,n)),e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}(r,ke(r,n)),r.precision=t,r.rounding=e,oe(Pt>2?n.neg():n,t,e,!0)):new r(NaN)},Qt.squareRoot=Qt.sqrt=function(){var t,e,n,r,i,o,s=this,a=s.d,u=s.e,c=s.s,d=s.constructor;if(1!==c||!a||!a[0])return new d(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);for(Ct=!1,0==(c=Math.sqrt(+s))||c==1/0?(((e=te(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=Ft((u+1)/2)-(u<0||u%2),r=new d(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new d(c.toString()),n=(u=d.precision)+3;;)if(r=(o=r).plus(ie(s,o,n+2,1)).times(.5),te(o.d).slice(0,n)===(e=te(r.d)).slice(0,n)){if("9999"!=(e=e.slice(n-3,n+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(oe(r,u+1,1),t=!r.times(r).eq(s));break}if(!i&&(oe(o,u+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}return Ct=!0,oe(r,u,d.rounding,t)},Qt.tangent=Qt.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,(n=n.sin()).s=1,n=ie(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,oe(2==Pt||4==Pt?n.neg():n,t,e,!0)):new r(NaN)},Qt.times=Qt.mul=function(t){var e,n,r,i,o,s,a,u,c,d=this,l=d.constructor,h=d.d,f=(t=new l(t)).d;if(t.s*=d.s,!(h&&h[0]&&f&&f[0]))return new l(!t.s||h&&!h[0]&&!f||f&&!f[0]&&!h?NaN:h&&f?0*t.s:t.s/0);for(n=Ft(d.e/Zt)+Ft(t.e/Zt),(u=h.length)<(c=f.length)&&(o=h,h=f,f=o,s=u,u=c,c=s),o=[],r=s=u+c;r--;)o.push(0);for(r=c;--r>=0;){for(e=0,i=u+r;i>r;)a=o[i]+f[r]*h[i-r-1]+e,o[i--]=a%Gt|0,e=a/Gt|0;o[i]=(o[i]+e)%Gt|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=ae(o,n),Ct?oe(t,l.precision,l.rounding):t},Qt.toBinary=function(t,e){return Me(this,2,t,e)},Qt.toDecimalPlaces=Qt.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),void 0===t?n:(ee(t,0,Lt),void 0===e?e=r.rounding:ee(e,0,8),oe(n,t+n.e+1,e))},Qt.toExponential=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=se(r,!0):(ee(t,0,Lt),void 0===e?e=i.rounding:ee(e,0,8),n=se(r=oe(new i(r),t+1,e),!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},Qt.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return void 0===t?n=se(i):(ee(t,0,Lt),void 0===e?e=o.rounding:ee(e,0,8),n=se(r=oe(new o(i),t+i.e+1,e),!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},Qt.toFraction=function(t){var e,n,r,i,o,s,a,u,c,d,l,h,f=this,p=f.d,m=f.constructor;if(!p)return new m(f);if(c=n=new m(1),r=u=new m(0),s=(o=(e=new m(r)).e=de(p)-f.e-1)%Zt,e.d[0]=Wt(10,s<0?Zt+s:s),null==t)t=o>0?e:c;else{if(!(a=new m(t)).isInt()||a.lt(c))throw Error(zt+a);t=a.gt(e)?o>0?e:c:a}for(Ct=!1,a=new m(te(p)),d=m.precision,m.precision=o=p.length*Zt*2;l=ie(a,e,0,1,1),1!=(i=n.plus(l.times(r))).cmp(t);)n=r,r=i,i=c,c=u.plus(l.times(i)),u=i,i=e,e=a.minus(l.times(i)),a=i;return i=ie(t.minus(n),r,0,1,1),u=u.plus(i.times(c)),n=n.plus(i.times(r)),u.s=c.s=f.s,h=ie(c,r,o,1).minus(f).abs().cmp(ie(u,n,o,1).minus(f).abs())<1?[c,r]:[u,n],m.precision=d,Ct=!0,h},Qt.toHexadecimal=Qt.toHex=function(t,e){return Me(this,16,t,e)},Qt.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),null==t){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),void 0===e?e=r.rounding:ee(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(Ct=!1,n=ie(n,t,0,e,1).times(t),Ct=!0,oe(n)):(t.s=n.s,n=t),n},Qt.toNumber=function(){return+this},Qt.toOctal=function(t,e){return Me(this,8,t,e)},Qt.toPower=Qt.pow=function(t){var e,n,r,i,o,s,a=this,u=a.constructor,c=+(t=new u(t));if(!(a.d&&t.d&&a.d[0]&&t.d[0]))return new u(Wt(+a,c));if((a=new u(a)).eq(1))return a;if(r=u.precision,o=u.rounding,t.eq(1))return oe(a,r,o);if((e=Ft(t.e/Zt))>=t.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=he(u,a,n,r),t.s<0?new u(1).div(i):oe(i,r,o);if((s=a.s)<0){if(eu.maxE+1||e0?s/0:0):(Ct=!1,u.rounding=a.s=1,n=Math.min(12,(e+"").length),(i=me(t.times(ge(a,r+n)),r)).d&&ne((i=oe(i,r+5,1)).d,r,o)&&(e=r+10,+te((i=oe(me(t.times(ge(a,e+n)),e),e+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=oe(i,r+1,0))),i.s=s,Ct=!0,u.rounding=o,oe(i,r,o))},Qt.toPrecision=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=se(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(ee(t,1,Lt),void 0===e?e=i.rounding:ee(e,0,8),n=se(r=oe(new i(r),t,e),t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},Qt.toSignificantDigits=Qt.toSD=function(t,e){var n=this.constructor;return void 0===t?(t=n.precision,e=n.rounding):(ee(t,1,Lt),void 0===e?e=n.rounding:ee(e,0,8)),oe(new n(this),t,e)},Qt.toString=function(){var t=this,e=t.constructor,n=se(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},Qt.truncated=Qt.trunc=function(){return oe(new this.constructor(this),this.e+1,1)},Qt.valueOf=Qt.toJSON=function(){var t=this,e=t.constructor,n=se(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};var ie=function(){function t(t,e,n){var r,i=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+i,t[o]=r%n|0,i=r/n|0;return i&&t.unshift(i),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;)t.shift()}return function(r,i,o,s,a,u){var c,d,l,h,f,p,m,g,y,b,w,_,v,k,M,A,S,I,x,E,T=r.constructor,P=r.s==i.s?1:-1,B=r.d,L=i.d;if(!(B&&B[0]&&L&&L[0]))return new T(r.s&&i.s&&(B?!L||B[0]!=L[0]:L)?B&&0==B[0]||!L?0*P:P/0:NaN);for(u?(f=1,d=r.e-i.e):(u=Gt,f=Zt,d=Ft(r.e/f)-Ft(i.e/f)),x=L.length,S=B.length,b=(y=new T(P)).d=[],l=0;L[l]==(B[l]||0);l++);if(L[l]>(B[l]||0)&&d--,null==o?(k=o=T.precision,s=T.rounding):k=a?o+(r.e-i.e)+1:o,k<0)b.push(1),p=!0;else{if(k=k/f+2|0,l=0,1==x){for(h=0,L=L[0],k++;(l1&&(L=t(L,h,u),B=t(B,h,u),x=L.length,S=B.length),A=x,_=(w=B.slice(0,x)).length;_=u/2&&++I;do{h=0,(c=e(L,w,x,_))<0?(v=w[0],x!=_&&(v=v*u+(w[1]||0)),(h=v/I|0)>1?(h>=u&&(h=u-1),1==(c=e(m=t(L,h,u),w,g=m.length,_=w.length))&&(h--,n(m,x=10;h/=10)l++;y.e=l+d*f-1,oe(y,a?o+y.e+1:o,s,p)}return y}}();function oe(t,e,n,r){var i,o,s,a,u,c,d,l,h,f=t.constructor;t:if(null!=e){if(!(l=t.d))return t;for(i=1,a=l[0];a>=10;a/=10)i++;if((o=e-i)<0)o+=Zt,s=e,u=(d=l[h=0])/Wt(10,i-s-1)%10|0;else if((h=Math.ceil((o+1)/Zt))>=(a=l.length)){if(!r)break t;for(;a++<=h;)l.push(0);d=u=0,i=1,s=(o%=Zt)-Zt+1}else{for(d=a=l[h],i=1;a>=10;a/=10)i++;u=(s=(o%=Zt)-Zt+i)<0?0:d/Wt(10,i-s-1)%10|0}if(r=r||e<0||void 0!==l[h+1]||(s<0?d:d%Wt(10,i-s-1)),c=n<4?(u||r)&&(0==n||n==(t.s<0?3:2)):u>5||5==u&&(4==n||r||6==n&&(o>0?s>0?d/Wt(10,i-s):0:l[h-1])%10&1||n==(t.s<0?8:7)),e<1||!l[0])return l.length=0,c?(e-=t.e+1,l[0]=Wt(10,(Zt-e%Zt)%Zt),t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=h,a=1,h--):(l.length=h+1,a=Wt(10,Zt-o),l[h]=s>0?(d/Wt(10,i-s)%Wt(10,s)|0)*a:0),c)for(;;){if(0==h){for(o=1,s=l[0];s>=10;s/=10)o++;for(s=l[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,l[0]==Gt&&(l[0]=1));break}if(l[h]+=a,l[h]!=Gt)break;l[h--]=0,a=1}for(o=l.length;0===l[--o];)l.pop()}return Ct&&(t.e>f.maxE?(t.d=null,t.e=NaN):t.e0?o=o.charAt(0)+"."+o.slice(1)+le(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+le(-i-1)+o,n&&(r=n-s)>0&&(o+=le(r))):i>=s?(o+=le(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+le(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=le(r))),o}function ae(t,e){var n=t[0];for(e*=Zt;n>=10;n/=10)e++;return e}function ue(t,e,n){if(e>Xt)throw Ct=!0,n&&(t.precision=n),Error(Ut);return oe(new t(Rt),e,1,!0)}function ce(t,e,n){if(e>Jt)throw Error(Ut);return oe(new t(Ot),e,n,!0)}function de(t){var e=t.length-1,n=e*Zt+1;if(e=t[e]){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function le(t){for(var e="";t--;)e+="0";return e}function he(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/Zt+4);for(Ct=!1;;){if(n%2&&Ae((o=o.times(e)).d,s)&&(i=!0),0===(n=Ft(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}Ae((e=e.times(e)).d,s)}return Ct=!0,o}function fe(t){return 1&t.d[t.d.length-1]}function pe(t,e,n){for(var r,i=new t(e[0]),o=0;++o17)return new h(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(Ct=!1,u=p):u=e,a=new h(.03125);t.e>-2;)t=t.times(a),l+=5;for(u+=r=Math.log(Wt(2,l))/Math.LN10*2+5|0,n=o=s=new h(1),h.precision=u;;){if(o=oe(o.times(t),u,1),n=n.times(++d),te((a=s.plus(ie(o,n,u,1))).d).slice(0,u)===te(s.d).slice(0,u)){for(i=l;i--;)s=oe(s.times(s),u,1);if(null!=e)return h.precision=p,s;if(!(c<3&&ne(s.d,u-r,f,c)))return oe(s,h.precision=p,f,Ct=!0);h.precision=u+=10,n=o=a=new h(1),d=0,c++}s=a}}function ge(t,e){var n,r,i,o,s,a,u,c,d,l,h,f=1,p=t,m=p.d,g=p.constructor,y=g.rounding,b=g.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==e?(Ct=!1,d=b):d=e,g.precision=d+=10,r=(n=te(m)).charAt(0),!(Math.abs(o=p.e)<15e14))return c=ue(g,d+2,b).times(o+""),p=ge(new g(r+"."+n.slice(1)),d-10).plus(c),g.precision=b,null==e?oe(p,b,y,Ct=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=te((p=p.times(t)).d)).charAt(0),f++;for(o=p.e,r>1?(p=new g("0."+n),o++):p=new g(r+"."+n.slice(1)),l=p,u=s=p=ie(p.minus(1),p.plus(1),d,1),h=oe(p.times(p),d,1),i=3;;){if(s=oe(s.times(h),d,1),te((c=u.plus(ie(s,new g(i),d,1))).d).slice(0,d)===te(u.d).slice(0,d)){if(u=u.times(2),0!==o&&(u=u.plus(ue(g,d+2,b).times(o+""))),u=ie(u,new g(f),d,1),null!=e)return g.precision=b,u;if(!ne(u.d,d-10,y,a))return oe(u,g.precision=b,y,Ct=!0);g.precision=d+=10,c=s=p=ie(l.minus(1),l.plus(1),d,1),h=oe(p.times(p),d,1),i=a=1}u=c,i+=2}}function ye(t){return String(t.s*t.s/0)}function be(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;48===e.charCodeAt(r);r++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(r,i)){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%Zt,n<0&&(r+=Zt),rt.constructor.maxE?(t.d=null,t.e=NaN):t.e-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Vt.test(e))return be(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Kt.test(e))n=16,e=e.toLowerCase();else if(Ht.test(e))n=2;else{if(!qt.test(e))throw Error(zt+e);n=8}for((o=e.search(/p/i))>0?(u=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),s=(o=e.indexOf("."))>=0,r=t.constructor,s&&(o=(a=(e=e.replace(".","")).length)-o,i=he(r,new r(n),o,2*o)),o=d=(c=re(e,n,Gt)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*t.s):(t.e=ae(c,d),t.d=c,Ct=!1,s&&(t=ie(t,i,4*a)),u&&(t=t.times(Math.abs(u)<54?Wt(2,u):hn.pow(2,u))),Ct=!0,t)}function _e(t,e,n,r,i){var o,s,a,u,c=t.precision,d=Math.ceil(c/Zt);for(Ct=!1,u=n.times(n),a=new t(r);;){if(s=ie(a.times(u),new t(e++*e++),c,1),a=i?r.plus(s):r.minus(s),r=ie(s.times(u),new t(e++*e++),c,1),void 0!==(s=a.plus(r)).d[d]){for(o=d;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=r,r=s,s=o}return Ct=!0,s.d.length=d+1,s}function ve(t,e){for(var n=t;--e;)n*=t;return n}function ke(t,e){var n,r=e.s<0,i=ce(t,t.precision,1),o=i.times(.5);if((e=e.abs()).lte(o))return Pt=r?4:1,e;if((n=e.divToInt(i)).isZero())Pt=r?3:2;else{if((e=e.minus(n.times(i))).lte(o))return Pt=fe(n)?r?2:3:r?4:1,e;Pt=fe(n)?r?1:4:r?3:2}return e.minus(i).abs()}function Me(t,e,n,r){var i,o,s,a,u,c,d,l,h,f=t.constructor,p=void 0!==n;if(p?(ee(n,1,Lt),void 0===r?r=f.rounding:ee(r,0,8)):(n=f.precision,r=f.rounding),t.isFinite()){for(p?(i=2,16==e?n=4*n-3:8==e&&(n=3*n-2)):i=e,(s=(d=se(t)).indexOf("."))>=0&&(d=d.replace(".",""),(h=new f(1)).e=d.length-s,h.d=re(se(h),10,i),h.e=h.d.length),o=u=(l=re(d,10,i)).length;0==l[--u];)l.pop();if(l[0]){if(s<0?o--:((t=new f(t)).d=l,t.e=o,l=(t=ie(t,h,n,r,0,i)).d,o=t.e,c=Tt),s=l[n],a=i/2,c=c||void 0!==l[n+1],c=r<4?(void 0!==s||c)&&(0===r||r===(t.s<0?3:2)):s>a||s===a&&(4===r||c||6===r&&1&l[n-1]||r===(t.s<0?8:7)),l.length=n,c)for(;++l[--n]>i-1;)l[n]=0,n||(++o,l.unshift(1));for(u=l.length;!l[u-1];--u);for(s=0,d="";s1)if(16==e||8==e){for(s=16==e?4:3,--u;u%s;u++)d+="0";for(u=(l=re(d,i,e)).length;!l[u-1];--u);for(s=1,d="1.";su)for(o-=u;o--;)d+="0";else oe)return t.length=e,!0}function Se(t){return new this(t).abs()}function Ie(t){return new this(t).acos()}function xe(t){return new this(t).acosh()}function Ee(t,e){return new this(t).plus(e)}function Te(t){return new this(t).asin()}function Pe(t){return new this(t).asinh()}function Be(t){return new this(t).atan()}function Le(t){return new this(t).atanh()}function $e(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(n=e.s<0?ce(this,r,i):new this(0)).s=t.s:!t.d||e.isZero()?(n=ce(this,o,1).times(.5)).s=t.s:e.s<0?(this.precision=o,this.rounding=1,n=this.atan(ie(t,e,o,1)),e=ce(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(ie(t,e,o,1)):(n=ce(this,o,1).times(e.s>0?.25:.75)).s=t.s:n=new this(NaN),n}function Re(t){return new this(t).cbrt()}function Oe(t){return oe(t=new this(t),t.e+1,2)}function De(t,e,n){return new this(t).clamp(e,n)}function Ce(t){if(!t||"object"!=typeof t)throw Error(Nt+"Object expected");var e,n,r,i=!0===t.defaults,o=["precision",1,Lt,"rounding",0,8,"toExpNeg",-Bt,0,"toExpPos",0,Bt,"maxE",0,Bt,"minE",-Bt,0,"modulo",0,9];for(e=0;e=o[e+1]&&r<=o[e+2]))throw Error(zt+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=Dt[n]),void 0!==(r=t[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(zt+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(jt);this[n]=!0}else this[n]=!1}return this}function Ne(t){return new this(t).cos()}function ze(t){return new this(t).cosh()}function Ue(t,e){return new this(t).div(e)}function je(t){return new this(t).exp()}function Ye(t){return oe(t=new this(t),t.e+1,3)}function Fe(){var t,e,n=new this(0);for(Ct=!1,t=0;t=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(jt);for(e=crypto.randomBytes(r*=4);o=214e7?crypto.randomBytes(4).copy(e,o):(a.push(i%1e7),o+=4);o=r/4}else for(;o=10;i/=10)r++;ro.maxE?(i.e=NaN,i.d=null):t.e=10;n/=10)e++;return void(Ct?e>o.maxE?(i.e=NaN,i.d=null):e`"${t}": ${JSON.stringify(e,null,4)}`)).join(",\n"):null}function En(t,e){return t.symbolAe.symbolA?1:t.symbolBe.symbolB?1:t.tickSpacinge.tickSpacing?1:0}let Tn=null,Pn=null;const Bn="https://api.mainnet.orca.so/v1/token/list";class Ln{constructor(t){this.tokenList=t,this.tokenMintMap=new Map;for(const e of t)this.tokenMintMap.set(e.mint.toBase58(),e)}getTokenInfoByMint(t){return this.tokenMintMap.get(t.toString())}}let $n=null;async function Rn(){if($n)return $n;const t=await(await mn()(Bn)).json(),e=[];return t.tokens.forEach((t=>{e.push({mint:new Mt.PublicKey(t.mint),symbol:zn(t.symbol,t.mint),name:zn(t.name,t.mint),decimals:t.decimals,logoURI:t.logoURI,coingeckoId:t.coingeckoId,whitelisted:t.whitelisted,poolToken:t.poolToken})})),e.sort(((t,e)=>t.symbol.localeCompare(e.symbol))),$n=new Ln(e),$n}const On="https://api.orca.so/configs";class Dn{constructor(t,e,n){this.pools=t,this.aquafarms=e,this.doubledips=n,this.poolAddressMap=new Map;for(const e of t)this.poolAddressMap.set(e.account.toBase58(),e).set(e.poolTokenMint.toBase58(),e);this.aquafarmAddressMap=new Map;for(const t of e)this.aquafarmAddressMap.set(t.account.toBase58(),t).set(t.baseTokenMint.toBase58(),t).set(t.farmTokenMint.toBase58(),t);this.doubledipAddressMap=new Map;for(const t of n)this.doubledipAddressMap.set(t.account.toBase58(),t).set(t.baseTokenMint.toBase58(),t).set(t.farmTokenMint.toBase58(),t);this.tuples=[];for(const t of this.pools){const e=this.getAquaFarmByAddress(t.poolTokenMint),n=this.getDoubleDipByAddress(null==e?void 0:e.farmTokenMint);this.tuples.push({pool:t,aquafarm:e,doubledip:n})}this.tuples.sort(((t,e)=>t.pool.name.localeCompare(e.pool.name)))}getPoolByAddress(t){if(t)return this.poolAddressMap.get(t.toString())}getAquaFarmByAddress(t){if(t)return this.aquafarmAddressMap.get(t.toString())}getDoubleDipByAddress(t){if(t)return this.doubledipAddressMap.get(t.toString())}}let Cn=null;async function Nn(){if(Cn)return Cn;const t=await(await mn()(On)).json(),e=[];Object.keys(t.pools).forEach((n=>{var r;const i=t.pools[n];e.push({name:n,account:new Mt.PublicKey(i.account),authority:new Mt.PublicKey(i.authority),nonce:i.nonce,poolTokenMint:new Mt.PublicKey(i.poolTokenMint),tokenAccountA:new Mt.PublicKey(i.tokenAccountA),tokenAccountB:new Mt.PublicKey(i.tokenAccountB),feeAccount:new Mt.PublicKey(i.feeAccount),feeNumerator:i.feeNumerator,feeDenominator:i.feeDenominator,ownerTradeFeeNumerator:i.ownerTradeFeeNumerator,ownerTradeFeeDenominator:i.ownerTradeFeeDenominator,ownerWithdrawFeeNumerator:i.ownerWithdrawFeeNumerator,ownerWithdrawFeeDenominator:i.ownerWithdrawFeeDenominator,hostFeeNumerator:i.hostFeeNumerator,hostFeeDenominator:i.hostFeeDenominator,tokenAName:i.tokenAName,tokenBName:i.tokenBName,curveType:"ConstantProduct"===i.curveType?"ConstantProduct":"Stable",deprecated:null!==(r=i.deprecated)&&void 0!==r&&r})}));const n=[];Object.keys(t.aquafarms).forEach((e=>{const r=t.aquafarms[e];n.push({account:new Mt.PublicKey(r.account),nonce:r.nonce,tokenProgramId:new Mt.PublicKey(r.tokenProgramId),emissionsAuthority:new Mt.PublicKey(r.emissionsAuthority),removeRewardsAuthority:new Mt.PublicKey(r.removeRewardsAuthority),baseTokenMint:new Mt.PublicKey(r.baseTokenMint),baseTokenVault:new Mt.PublicKey(r.baseTokenVault),rewardTokenMint:new Mt.PublicKey(r.rewardTokenMint),rewardTokenVault:new Mt.PublicKey(r.rewardTokenVault),farmTokenMint:new Mt.PublicKey(r.farmTokenMint)})}));const r=[];Object.keys(t.doubleDips).forEach((e=>{const n=t.doubleDips[e];r.push({account:new Mt.PublicKey(n.account),nonce:n.nonce,tokenProgramId:new Mt.PublicKey(n.tokenProgramId),emissionsAuthority:new Mt.PublicKey(n.emissionsAuthority),removeRewardsAuthority:new Mt.PublicKey(n.removeRewardsAuthority),baseTokenMint:new Mt.PublicKey(n.baseTokenMint),baseTokenVault:new Mt.PublicKey(n.baseTokenVault),rewardTokenMint:new Mt.PublicKey(n.rewardTokenMint),rewardTokenVault:new Mt.PublicKey(n.rewardTokenVault),farmTokenMint:new Mt.PublicKey(n.farmTokenMint),dateStart:n.dateStart,dateEnd:n.dateEnd,totalEmissions:n.totalEmissions})}));const i=new Dn(e,n,r);return Cn=i,i}function zn(t,e){return(null==t?void 0:t.trim())||`❓(${kn(e,4)})`}function Un(t){let e;return{c(){e=S(t[0])},m(t,n){v(t,e,n)},p(t,n){1&n&&B(e,t[0])},d(t){t&&k(e)}}}function jn(t){let e,n,r,i,s,a,u,c,d;function l(t,e){return t[1]?Fn:Yn}let h=l(t),f=h(t),p=("token2022/mint"===t[3]||"token2022/account"===t[3])&&Wn(),m=t[4]&&!t[4].poolToken&&Hn(t),g=t[0]&&Kn(t);return{c(){e=S("📘\n"),n=A("span"),r=A("a"),f.c(),i=I(),p&&p.c(),s=I(),m&&m.c(),a=I(),u=A("span"),g&&g.c(),P(r,"href",t[10]),P(r,"class","svelte-1ugqnji"),$(u,"visibility","hidden"),$(n,"cursor","pointer")},m(o,l){v(o,e,l),v(o,n,l),_(n,r),f.m(r,null),_(r,i),p&&p.m(r,null),_(r,s),m&&m.m(r,null),_(n,a),_(n,u),g&&g.m(u,null),t[12](u),c||(d=[E(n,"mouseenter",t[13]),E(n,"mouseleave",t[14])],c=!0)},p(t,e){h===(h=l(t))&&f?f.p(t,e):(f.d(1),f=h(t),f&&(f.c(),f.m(r,i))),"token2022/mint"===t[3]||"token2022/account"===t[3]?p||(p=Wn(),p.c(),p.m(r,s)):p&&(p.d(1),p=null),t[4]&&!t[4].poolToken?m?m.p(t,e):(m=Hn(t),m.c(),m.m(r,null)):m&&(m.d(1),m=null),t[0]?g?g.p(t,e):(g=Kn(t),g.c(),g.m(u,null)):g&&(g.d(1),g=null)},d(r){r&&k(e),r&&k(n),f.d(),p&&p.d(),m&&m.d(),g&&g.d(),t[12](null),c=!1,o(d)}}}function Yn(t){let e,n;return{c(){e=A("span"),n=S(t[0])},m(t,r){v(t,e,r),_(e,n)},p(t,e){1&e&&B(n,t[0])},d(t){t&&k(e)}}}function Fn(t){let e,n,r=kn(t[0],t[2])+"";return{c(){e=A("span"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){5&e&&r!==(r=kn(t[0],t[2])+"")&&B(n,r)},d(t){t&&k(e)}}}function Wn(t){let e;return{c(){e=S("[2022]")},m(t,n){v(t,e,n)},d(t){t&&k(e)}}}function Hn(t){let e,n,r,i=t[4].symbol+"";return{c(){e=S("("),n=S(i),r=S(")")},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,e){16&e&&i!==(i=t[4].symbol+"")&&B(n,i)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Kn(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m;return{c(){e=A("a"),n=S("🔍"),i=I(),o=A("a"),s=S("📻"),u=I(),c=A("a"),d=S("🪣"),h=I(),f=A("span"),f.textContent="📎",P(e,"target","_blank"),P(e,"rel","noreferrer"),P(e,"href",r=t[7](t[0])),P(e,"class","svelte-1ugqnji"),P(o,"target","_blank"),P(o,"rel","noreferrer"),P(o,"href",a=t[8](t[0])),P(o,"class","svelte-1ugqnji"),P(c,"href",l="#/generic/"+t[0]),P(c,"class","svelte-1ugqnji")},m(r,a){v(r,e,a),_(e,n),v(r,i,a),v(r,o,a),_(o,s),v(r,u,a),v(r,c,a),_(c,d),v(r,h,a),v(r,f,a),t[11](f),p||(m=E(f,"click",t[9]),p=!0)},p(t,n){1&n&&r!==(r=t[7](t[0]))&&P(e,"href",r),1&n&&a!==(a=t[8](t[0]))&&P(o,"href",a),1&n&&l!==(l="#/generic/"+t[0])&&P(c,"href",l)},d(n){n&&k(e),n&&k(i),n&&k(o),n&&k(u),n&&k(c),n&&k(h),n&&k(f),t[11](null),p=!1,m()}}}function qn(e){let n;function r(t,e){return t[0]?jn:Un}let i=r(e),o=i(e);return{c(){o.c(),n=x()},m(t,e){o.m(t,e),v(t,n,e)},p(t,[e]){i===(i=r(t))&&o?o.p(t,e):(o.d(1),o=i(t),o&&(o.c(),o.m(n.parentNode,n)))},i:t,o:t,d(t){o.d(t),t&&k(n)}}}function Vn(t,e,n){let r,i,o,{address:s}=e,{short:a=!1}=e,{length:u=5}=e,{type:c="generic"}=e;Rn().then((t=>{n(4,r=t.getTokenInfoByMint(s))}));let d=`#/${c}/${s}`;return t.$$set=t=>{"address"in t&&n(0,s=t.address),"short"in t&&n(1,a=t.short),"length"in t&&n(2,u=t.length),"type"in t&&n(3,c=t.type)},[s,a,u,c,r,i,o,function(t){if(!t)return"";const e=Et();let n="";return"devnet"===e.network&&(n="?cluster=devnet"),"localnet"===e.network&&(n=`?cluster=custom&customUrl=${e.url}`),e.network,`https://solscan.io/account/${t.toString()}${n}`},function(t){if(!t)return"";const e=Et();let n="";return"devnet"===e.network&&(n="?cluster=devnet-solana"),e.network,e.network,`https://solana.fm/address/${t.toString()}${n}`},function(){navigator.clipboard.writeText(s.toString()),n(6,o.textContent="✅",o),setTimeout((()=>n(6,o.textContent="📎",o)),1e3)},d,function(t){j[t?"unshift":"push"]((()=>{o=t,n(6,o)}))},function(t){j[t?"unshift":"push"]((()=>{i=t,n(5,i)}))},()=>i.style.setProperty("visibility","visible"),()=>i.style.setProperty("visibility","hidden")]}const Gn=class extends gt{constructor(t){super(),mt(this,t,Vn,qn,a,{address:0,short:1,length:2,type:3})}};async function Zn(t,e){const n=await t.getAccountInfoAndContext(e);return{accountInfo:n.value,slotContext:n.context.slot}}function Xn(t,e,n){return Object.assign({slotContext:n,pubkey:t},e)}function Jn(t,e){return new fn(t.toFixed(e))}function Qn(t){return bn.DecimalUtil.toBN(new fn(t.toString()),0)}function tr(t,e){const n=e?{slotContext:t.slotContext}:{};return Object.assign({pubkey:t.pubkey.toBase58(),account:{executable:t.executable,lamports:t.lamports,owner:t.owner.toBase58(),rentEpoch:0,data:[t.data.toString("base64"),"base64"]}},n)}function er(t){return 3480*(128+t)*2}function nr(t){const e=JSON.stringify(t);return new Blob([e],{type:"application/json"})}function rr(t,e){const n=document.createElement("a");n.href=URL.createObjectURL(t),n.download=e,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}function ir(e){let n,r,i,o;return{c(){n=A("button"),r=S(e[2]),n.disabled=e[1],P(n,"style",e[3])},m(t,a){v(t,n,a),_(n,r),i||(o=E(n,"click",(function(){s(e[0])&&e[0].apply(this,arguments)})),i=!0)},p(t,[i]){e=t,4&i&&B(r,e[2]),2&i&&(n.disabled=e[1]),8&i&&P(n,"style",e[3])},i:t,o:t,d(t){t&&k(n),i=!1,o()}}}function or(t,e,n){let r,{download:i}=e,{disabled:o=!1}=e,{label:s="Download JSON!"}=e,{width:a}=e;return t.$$set=t=>{"download"in t&&n(0,i=t.download),"disabled"in t&&n(1,o=t.disabled),"label"in t&&n(2,s=t.label),"width"in t&&n(4,a=t.width)},t.$$.update=()=>{16&t.$$.dirty&&n(3,r=a?`width: ${a}px;`:"")},[i,o,s,r,a]}const sr=class extends gt{constructor(t){super(),mt(this,t,or,ir,a,{download:0,disabled:1,label:2,width:4})}};function ar(t){let e,n;return e=new Gn({props:{type:t[1],address:t[0].pubkey}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.type=t[1]),1&n&&(r.address=t[0].pubkey),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ur(t){let e,n;return e=new Gn({props:{address:t[0].owner}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};1&n&&(r.address=t[0].owner),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function cr(t){let e,n,r,i,o,s,a,u,c=t[0].lamports+"",d=vn(t[0].lamports)+"",l=er(t[0].data.length)+"",h=t[0].lamports-er(t[0].data.length)+"";return{c(){e=S(c),n=S(" ("),r=S(d),i=S(" SOL) (Rent: "),o=S(l),s=S(", NotRent: "),a=S(h),u=S(")")},m(t,c){v(t,e,c),v(t,n,c),v(t,r,c),v(t,i,c),v(t,o,c),v(t,s,c),v(t,a,c),v(t,u,c)},p(t,n){1&n&&c!==(c=t[0].lamports+"")&&B(e,c),1&n&&d!==(d=vn(t[0].lamports)+"")&&B(r,d),1&n&&l!==(l=er(t[0].data.length)+"")&&B(o,l),1&n&&h!==(h=t[0].lamports-er(t[0].data.length)+"")&&B(a,h)},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(i),t&&k(o),t&&k(s),t&&k(a),t&&k(u)}}}function dr(t){let e,n=t[0].data.length+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){1&r&&n!==(n=t[0].data.length+"")&&B(e,n)},d(t){t&&k(e)}}}function lr(t){let e,n=t[0].executable+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){1&r&&n!==(n=t[0].executable+"")&&B(e,n)},d(t){t&&k(e)}}}function hr(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M=t[0].slotContext+"";return u=new vt({props:{name:"pubkey",type:"PublicKey",$$slots:{default:[ar]},$$scope:{ctx:t}}}),c=new vt({props:{name:"owner program",type:"PublicKey",$$slots:{default:[ur]},$$scope:{ctx:t}}}),d=new vt({props:{name:"lamports",type:"u64",$$slots:{default:[cr]},$$scope:{ctx:t}}}),f=new vt({props:{name:"data size",$$slots:{default:[dr]},$$scope:{ctx:t}}}),g=new vt({props:{name:"executable",$$slots:{default:[lr]},$$scope:{ctx:t}}}),b=new sr({props:{download:t[2]}}),{c(){e=A("h3"),n=S("🔖 Meta "),r=A("span"),i=S("slot "),o=S(M),s=I(),a=A("dl"),ht(u.$$.fragment),ht(c.$$.fragment),ht(d.$$.fragment),l=A("div"),h=A("span"),ht(f.$$.fragment),p=I(),m=A("span"),ht(g.$$.fragment),y=I(),ht(b.$$.fragment),$(r,"color","#999"),$(r,"font-size","small"),$(r,"font-weight","normal"),P(l,"class","col svelte-gqivmw"),$(a,"font-size","smaller")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(r,i),_(r,o),v(t,s,k),v(t,a,k),ft(u,a,null),ft(c,a,null),ft(d,a,null),_(a,l),_(l,h),ft(f,h,null),_(l,p),_(l,m),ft(g,m,null),v(t,y,k),ft(b,t,k),w=!0},p(t,[e]){(!w||1&e)&&M!==(M=t[0].slotContext+"")&&B(o,M);const n={};11&e&&(n.$$scope={dirty:e,ctx:t}),u.$set(n);const r={};9&e&&(r.$$scope={dirty:e,ctx:t}),c.$set(r);const i={};9&e&&(i.$$scope={dirty:e,ctx:t}),d.$set(i);const s={};9&e&&(s.$$scope={dirty:e,ctx:t}),f.$set(s);const a={};9&e&&(a.$$scope={dirty:e,ctx:t}),g.$set(a)},i(t){w||(ot(u.$$.fragment,t),ot(c.$$.fragment,t),ot(d.$$.fragment,t),ot(f.$$.fragment,t),ot(g.$$.fragment,t),ot(b.$$.fragment,t),w=!0)},o(t){st(u.$$.fragment,t),st(c.$$.fragment,t),st(d.$$.fragment,t),st(f.$$.fragment,t),st(g.$$.fragment,t),st(b.$$.fragment,t),w=!1},d(t){t&&k(e),t&&k(s),t&&k(a),pt(u),pt(c),pt(d),pt(f),pt(g),t&&k(y),pt(b,t)}}}function fr(t,e,n){let{meta:r}=e,{accountType:i}=e;return t.$$set=t=>{"meta"in t&&n(0,r=t.meta),"accountType"in t&&n(1,i=t.accountType)},[r,i,function(){const t=tr(r,!0),e=`${r.pubkey}.json`;rr(nr(t),e)}]}const pr=class extends gt{constructor(t){super(),mt(this,t,fr,hr,a,{meta:0,accountType:1})}};function mr(t){let e,n,r,i,o;const s=t[1].default,a=d(s,t,t[0],null);return{c(){e=A("div"),n=A("h3"),n.textContent="📖 Parsed",r=I(),i=A("dl"),a&&a.c(),$(i,"font-size","smaller"),$(e,"margin-right","5em")},m(t,s){v(t,e,s),_(e,n),_(e,r),_(e,i),a&&a.m(i,null),o=!0},p(t,[e]){a&&a.p&&(!o||1&e)&&f(a,s,t,t[0],o?h(s,t[0],e,null):p(t[0]),null)},i(t){o||(ot(a,t),o=!0)},o(t){st(a,t),o=!1},d(t){t&&k(e),a&&a.d(t)}}}function gr(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=t=>{"$$scope"in t&&n(0,i=t.$$scope)},[i,r]}const yr=class extends gt{constructor(t){super(),mt(this,t,gr,mr,a,{})}};function br(t){let e,n,r,i,o;const s=t[1].default,a=d(s,t,t[0],null);return{c(){e=A("div"),n=A("h3"),n.textContent="🧰 Derived",r=I(),i=A("dl"),a&&a.c(),$(i,"font-size","smaller")},m(t,s){v(t,e,s),_(e,n),_(e,r),_(e,i),a&&a.m(i,null),o=!0},p(t,[e]){a&&a.p&&(!o||1&e)&&f(a,s,t,t[0],o?h(s,t[0],e,null):p(t[0]),null)},i(t){o||(ot(a,t),o=!0)},o(t){st(a,t),o=!1},d(t){t&&k(e),a&&a.d(t)}}}function wr(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=t=>{"$$scope"in t&&n(0,i=t.$$scope)},[i,r]}const _r=class extends gt{constructor(t){super(),mt(this,t,wr,br,a,{})}};function vr(t){let e,n;const r=t[1].default,i=d(r,t,t[0],null);return{c(){e=A("div"),i&&i.c(),$(e,"display","flex"),$(e,"flex-wrap","wrap")},m(t,r){v(t,e,r),i&&i.m(e,null),n=!0},p(t,[e]){i&&i.p&&(!n||1&e)&&f(i,r,t,t[0],n?h(r,t[0],e,null):p(t[0]),null)},i(t){n||(ot(i,t),n=!0)},o(t){st(i,t),n=!1},d(t){t&&k(e),i&&i.d(t)}}}function kr(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=t=>{"$$scope"in t&&n(0,i=t.$$scope)},[i,r]}const Mr=class extends gt{constructor(t){super(),mt(this,t,kr,vr,a,{})}};function Ar(e){let n,r;return{c(){n=A("a"),r=S("🔡"),P(n,"target","_blank"),P(n,"rel","noreferrer"),P(n,"href",e[0]),$(n,"font-size","small"),$(n,"font-weight","normal"),$(n,"text-decoration","none")},m(t,e){v(t,n,e),_(n,r)},p(t,[e]){1&e&&P(n,"href",t[0])},i:t,o:t,d(t){t&&k(n)}}}function Sr(t,e,n){let{href:r}=e;return t.$$set=t=>{"href"in t&&n(0,r=t.href)},[r]}const Ir=class extends gt{constructor(t){super(),mt(this,t,Sr,Ar,a,{href:0})}},xr=[];function Er(t,e){return{subscribe:Tr(t,e).subscribe}}function Tr(e,n=t){let r;const i=new Set;function o(t){if(a(e,t)&&(e=t,r)){const t=!xr.length;for(const t of i)t[1](),xr.push(t,e);if(t){for(let t=0;t{i.delete(u),0===i.size&&r&&(r(),r=null)}}}}function Pr(e,n,r){const i=!Array.isArray(e),a=i?[e]:e,u=n.length<2;return Er(r,(e=>{let r=!1;const d=[];let l=0,h=t;const f=()=>{if(l)return;h();const r=n(i?d[0]:d,e);u?e(r):h=s(r)?r:t},p=a.map(((t,e)=>c(t,(t=>{d[e]=t,l&=~(1<{l|=1<{pt(t,1)})),it()}s?(n=D(s,a()),n.$on("routeEvent",t[7]),ht(n.$$.fragment),ot(n.$$.fragment,1),ft(n,r.parentNode,r)):n=null}else s&&n.$set(i)},i(t){i||(n&&ot(n.$$.fragment,t),i=!0)},o(t){n&&st(n.$$.fragment,t),i=!1},d(t){t&&k(r),n&&pt(n,t)}}}function Lr(t){let n,r,i;const o=[{params:t[1]},t[2]];var s=t[0];function a(t){let n={};for(let t=0;t{pt(t,1)})),it()}s?(n=D(s,a()),n.$on("routeEvent",t[6]),ht(n.$$.fragment),ot(n.$$.fragment,1),ft(n,r.parentNode,r)):n=null}else s&&n.$set(i)},i(t){i||(n&&ot(n.$$.fragment,t),i=!0)},o(t){n&&st(n.$$.fragment,t),i=!1},d(t){t&&k(r),n&&pt(n,t)}}}function $r(t){let e,n,r,i;const o=[Lr,Br],s=[];function a(t,e){return t[1]?0:1}return e=a(t),n=s[e]=o[e](t),{c(){n.c(),r=x()},m(t,n){s[e].m(t,n),v(t,r,n),i=!0},p(t,[i]){let u=e;e=a(t),e===u?s[e].p(t,i):(rt(),st(s[u],1,1,(()=>{s[u]=null})),it(),n=s[e],n?n.p(t,i):(n=s[e]=o[e](t),n.c()),ot(n,1),n.m(r.parentNode,r))},i(t){i||(ot(n),i=!0)},o(t){st(n),i=!1},d(t){s[e].d(t),t&&k(r)}}}function Rr(){const t=window.location.href.indexOf("#/");let e=t>-1?window.location.href.substr(t+1):"/";const n=e.indexOf("?");let r="";return n>-1&&(r=e.substr(n+1),e=e.substr(0,n)),{location:e,querystring:r}}const Or=Er(null,(function(t){t(Rr());const e=()=>{t(Rr())};return window.addEventListener("hashchange",e,!1),function(){window.removeEventListener("hashchange",e,!1)}})),Dr=Pr(Or,(t=>t.location)),Cr=(Pr(Or,(t=>t.querystring)),Tr(void 0));async function Nr(t){if(!t||t.length<1||"/"!=t.charAt(0)&&0!==t.indexOf("#/"))throw Error("Invalid parameter location");await q(),history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0),window.location.hash=("#"==t.charAt(0)?"":"#")+t}function zr(t,e,n){let{routes:r={}}=e,{prefix:i=""}=e,{restoreScrollState:o=!1}=e;class s{constructor(t,e){if(!e||"function"!=typeof e&&("object"!=typeof e||!0!==e._sveltesparouter))throw Error("Invalid component object");if(!t||"string"==typeof t&&(t.length<1||"/"!=t.charAt(0)&&"*"!=t.charAt(0))||"object"==typeof t&&!(t instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:n,keys:r}=function(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var n,r,i,o,s=[],a="",u=t.split("/");for(u[0]||u.shift();i=u.shift();)"*"===(n=i[0])?(s.push("wild"),a+="/(.*)"):":"===n?(r=i.indexOf("?",1),o=i.indexOf(".",1),s.push(i.substring(1,~r?r:~o?o:i.length)),a+=~r&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(a+=(~r?"?":"")+"\\"+i.substring(o))):a+="/"+i;return{keys:s,pattern:new RegExp("^"+a+"/?$","i")}}(t);this.path=t,"object"==typeof e&&!0===e._sveltesparouter?(this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}):(this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}),this._pattern=n,this._keys=r}match(t){if(i)if("string"==typeof i){if(!t.startsWith(i))return null;t=t.substr(i.length)||"/"}else if(i instanceof RegExp){const e=t.match(i);if(!e||!e[0])return null;t=t.substr(e[0].length)||"/"}const e=this._pattern.exec(t);if(null===e)return null;if(!1===this._keys)return e;const n={};let r=0;for(;r{a.push(new s(e,t))})):Object.keys(r).forEach((t=>{a.push(new s(t,r[t]))}));let u=null,c=null,d={};const l=function(){const t=N();return(e,n,{cancelable:r=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=function(t,e,{bubbles:n=!1,cancelable:r=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n,r,e),i}(e,n,{cancelable:r});return i.slice().forEach((e=>{e.call(t,o)})),!o.defaultPrevented}return!0}}();async function h(t,e){await q(),l(t,e)}let f=null,p=null;var m;o&&(p=t=>{f=t.state&&(t.state.__svelte_spa_router_scrollY||t.state.__svelte_spa_router_scrollX)?t.state:null},window.addEventListener("popstate",p),m=()=>{var t;(t=f)?window.scrollTo(t.__svelte_spa_router_scrollX,t.__svelte_spa_router_scrollY):window.scrollTo(0,0)},N().$$.after_update.push(m));let g=null,y=null;const b=Or.subscribe((async t=>{g=t;let e=0;for(;e{Cr.set(c)}))}n(0,u=null),y=null,Cr.set(void 0)}));return N().$$.on_destroy.push((()=>{b(),p&&window.removeEventListener("popstate",p)})),t.$$set=t=>{"routes"in t&&n(3,r=t.routes),"prefix"in t&&n(4,i=t.prefix),"restoreScrollState"in t&&n(5,o=t.restoreScrollState)},t.$$.update=()=>{32&t.$$.dirty&&(history.scrollRestoration=o?"manual":"auto")},[u,c,d,r,i,o,function(e){z.call(this,t,e)},function(e){z.call(this,t,e)}]}const Ur=class extends gt{constructor(t){super(),mt(this,t,zr,$r,a,{routes:3,prefix:4,restoreScrollState:5})}};var jr=n(40273),Yr=n(79468),Fr=n(73936),Wr=n(93018);const Hr=new Mt.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new Mt.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),new Mt.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),new Mt.PublicKey("So11111111111111111111111111111111111111112"),new Mt.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const Kr=new Mt.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),qr=new Mt.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");new Mt.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),new Mt.PublicKey("So11111111111111111111111111111111111111112"),new Mt.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const Vr=9,Gr=[1,2,4,8,16,32,64,128,256,512];function Zr(t){if(t){if(t.equals(Hr))return"token";if(t.equals(qr))return"token-2022";throw new Error(`Unknown token program: ${t.toBase58()}`)}}var Xr;function Jr(t,e,n){const r=jr.TickUtil.getStartTickIndex(t,e);for(const i of n)if((null==i?void 0:i.startTickIndex)===r)return jr.TickArrayUtil.getTickFromArray(i,t,e)}!function(t){t.PriceIsInRange="Price is In Range",t.PriceIsAboveRange="Price is Above Range",t.PriceIsBelowRange="Price is Below Range"}(Xr||(Xr={}));const Qr=(t,e)=>{const n=t.parsed.tickLowerIndex-e.parsed.tickLowerIndex;return n||t.parsed.tickUpperIndex-e.parsed.tickUpperIndex},ti=(t,e)=>{const n=e.parsed.tickUpperIndex-t.parsed.tickUpperIndex;return n||e.parsed.tickLowerIndex-t.parsed.tickLowerIndex},ei=(t,e)=>{const n=e.derived.amountA.cmp(t.derived.amountA);return n||e.derived.amountB.cmp(t.derived.amountB)},ni=(t,e)=>{const n=e.derived.amountB.cmp(t.derived.amountB);return n||e.derived.amountA.cmp(t.derived.amountA)};function ri(t){let e,n,r,i,o;const s=t[1].default,a=d(s,t,t[0],null);return{c(){e=A("div"),n=A("h3"),n.textContent="🧑‍🔬 Laboratory",r=I(),i=A("dl"),a&&a.c(),$(i,"font-size","smaller")},m(t,s){v(t,e,s),_(e,n),_(e,r),_(e,i),a&&a.m(i,null),o=!0},p(t,[e]){a&&a.p&&(!o||1&e)&&f(a,s,t,t[0],o?h(s,t[0],e,null):p(t[0]),null)},i(t){o||(ot(a,t),o=!0)},o(t){st(a,t),o=!1},d(t){t&&k(e),a&&a.d(t)}}}function ii(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=t=>{"$$scope"in t&&n(0,i=t.$$scope)},[i,r]}const oi=class extends gt{constructor(t){super(),mt(this,t,ii,ri,a,{})}};var si=n(58147),ai=n.n(si),ui=n(42693),ci=n.n(ui),di=n(48764).Buffer;const li={slotContext:0,accounts:{}},hi=2e4,fi={retries:5,minTimeout:1e3,maxTimeout:1e3};async function pi(t,e,n,r="confirmed",i){const o=await t.getProgramAccounts(e,{commitment:r,encoding:"base64",withContext:!0,filters:n,minContextSlot:i});return{slotContext:o.context.slot,accounts:Object.fromEntries(o.value.map((({pubkey:t,account:e})=>[t.toBase58(),e])))}}function mi(t,e){const n=Object.keys(t.accounts).sort(),r=Object.keys(e.accounts).sort();if(n.length!==r.length)return!1;if(JSON.stringify(n)!==JSON.stringify(r))return!1;for(const r of n){const n=t.accounts[r],i=e.accounts[r];if(n.executable!==i.executable)return!1;if(n.lamports!==i.lamports)return!1;if(n.owner.toBase58()!==i.owner.toBase58())return!1;if(n.rentEpoch!==i.rentEpoch)return!1;if(0!==di.compare(n.data,i.data))return!1}return!0}function gi(t,e){const n={slotContext:t.slotContext,accounts:Object.assign({},t.accounts)};for(const t of Object.keys(e.accounts))void 0!==n.accounts[t]&&(n.accounts[t]=e.accounts[t]);return n}function yi(e){let n,r,i,o,s,a,u;return{c(){n=A("div"),r=A("input"),i=I(),o=A("span"),s=S(e[1]),P(r,"type","checkbox"),$(o,"margin-left","5px"),$(n,"display","flex"),$(n,"flex-direction","row")},m(t,c){v(t,n,c),_(n,r),r.checked=e[0],_(n,i),_(n,o),_(o,s),a||(u=E(r,"change",e[2]),a=!0)},p(t,[e]){1&e&&(r.checked=t[0]),2&e&&B(s,t[1])},i:t,o:t,d(t){t&&k(n),a=!1,u()}}}function bi(t,e,n){let{value:r}=e,{label:i}=e;return t.$$set=t=>{"value"in t&&n(0,r=t.value),"label"in t&&n(1,i=t.label)},[r,i,function(){r=this.checked,n(0,r)}]}const wi=class extends gt{constructor(t){super(),mt(this,t,bi,yi,a,{value:0,label:1})}};var _i=n(55733),vi=n.n(_i);function ki(t,e,n){const r=t.slice();return r[6]=e[n],r[8]=n,r}function Mi(t){let e,n,r,i,o,s,a,u,c,d=t[6]+"";return a=function(t){let e;return{p(...n){e=n,e.forEach((e=>t.push(e)))},r(){e.forEach((e=>t.splice(t.indexOf(e),1)))}}}(t[5][0]),{c(){e=A("label"),n=A("input"),i=I(),o=S(d),s=I(),P(n,"type","radio"),P(n,"name",t[1]),n.__value=r=t[8],n.value=n.__value,a.p(n)},m(r,a){v(r,e,a),_(e,n),n.checked=n.__value===t[0],_(e,i),_(e,o),_(e,s),u||(c=E(n,"change",t[4]),u=!0)},p(t,e){2&e&&P(n,"name",t[1]),5&e&&(n.checked=n.__value===t[0]),4&e&&d!==(d=t[6]+"")&&B(o,d)},d(t){t&&k(e),a.r(),u=!1,c()}}}function Ai(e){let n,r,i=e[2],o=[];for(let t=0;t{"group"in t&&n(1,r=t.group),"values"in t&&n(2,i=t.values),"selected"in t&&n(0,o=t.selected),"direction"in t&&n(3,s=t.direction)},[o,r,i,s,function(){o=this.__value,n(0,o)},[[]]]}const Ii=class extends gt{constructor(t){super(),mt(this,t,Si,Ai,a,{group:1,values:2,selected:0,direction:3})}};function xi(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,B,L,R,O,D,C,N,z,U,Y,F,W,H,K,q,V,Z,X,J,Q,tt,et;function nt(e){t[14](e)}let rt={label:"append filename prefix"};function it(e){t[15](e)}void 0!==t[3]&&(rt.value=t[3]),o=new wi({props:rt}),j.push((()=>lt(o,"value",nt)));let at={label:"with WhirlpoolsConfig"};function ut(e){t[16](e)}void 0!==t[4]&&(at.value=t[4]),d=new wi({props:at}),j.push((()=>lt(d,"value",it)));let ct={label:"with FeeTier"};function dt(e){t[17](e)}void 0!==t[5]&&(ct.value=t[5]),m=new wi({props:ct}),j.push((()=>lt(m,"value",ut)));let mt={label:"with TickArray"};function gt(e){t[18](e)}void 0!==t[0]&&(mt.value=t[0]),M=new wi({props:mt}),j.push((()=>lt(M,"value",dt)));let yt={group:"tickArraySelection",values:t[9]};function bt(e){t[19](e)}void 0!==t[2]&&(yt.selected=t[2]),T=new Ii({props:yt}),j.push((()=>lt(T,"selected",gt)));let wt={label:"with VaultTokenAccount"};function _t(e){t[20](e)}void 0!==t[6]&&(wt.value=t[6]),C=new wi({props:wt}),j.push((()=>lt(C,"value",bt)));let vt={label:"with MintAccount"};function kt(e){t[21](e)}void 0!==t[7]&&(vt.value=t[7]),F=new wi({props:vt}),j.push((()=>lt(F,"value",_t)));let Mt={label:"with Position"};return void 0!==t[1]&&(Mt.value=t[1]),V=new wi({props:Mt}),j.push((()=>lt(V,"value",kt))),tt=new sr({props:{download:t[10],disabled:t[8][0],label:t[8][1],width:320}}),{c(){e=A("div"),n=A("table"),r=A("tr"),i=A("td"),ht(o.$$.fragment),a=I(),u=A("tr"),c=A("td"),ht(d.$$.fragment),h=I(),f=A("tr"),p=A("td"),ht(m.$$.fragment),y=I(),b=A("tr"),w=A("td"),ht(M.$$.fragment),E=S("\n  (\n "),ht(T.$$.fragment),L=S("\n  )"),R=I(),O=A("tr"),D=A("td"),ht(C.$$.fragment),z=I(),U=A("tr"),Y=A("td"),ht(F.$$.fragment),H=I(),K=A("tr"),q=A("td"),ht(V.$$.fragment),X=I(),J=A("tr"),Q=A("td"),ht(tt.$$.fragment),P(i,"class","svelte-hnlsv"),P(c,"class","svelte-hnlsv"),P(p,"class","svelte-hnlsv"),$(w,"display","flex"),$(w,"flex-direction","row"),P(w,"class","svelte-hnlsv"),P(D,"class","svelte-hnlsv"),P(Y,"class","svelte-hnlsv"),P(q,"class","svelte-hnlsv"),P(Q,"class","svelte-hnlsv"),$(n,"border-spacing","0")},m(t,s){v(t,e,s),_(e,n),_(n,r),_(r,i),ft(o,i,null),_(n,a),_(n,u),_(u,c),ft(d,c,null),_(n,h),_(n,f),_(f,p),ft(m,p,null),_(n,y),_(n,b),_(b,w),ft(M,w,null),_(w,E),ft(T,w,null),_(w,L),_(n,R),_(n,O),_(O,D),ft(C,D,null),_(n,z),_(n,U),_(U,Y),ft(F,Y,null),_(n,H),_(n,K),_(K,q),ft(V,q,null),_(n,X),_(n,J),_(J,Q),ft(tt,Q,null),et=!0},p(t,[e]){const n={};!s&&8&e&&(s=!0,n.value=t[3],G((()=>s=!1))),o.$set(n);const r={};!l&&16&e&&(l=!0,r.value=t[4],G((()=>l=!1))),d.$set(r);const i={};!g&&32&e&&(g=!0,i.value=t[5],G((()=>g=!1))),m.$set(i);const a={};!x&&1&e&&(x=!0,a.value=t[0],G((()=>x=!1))),M.$set(a);const u={};!B&&4&e&&(B=!0,u.selected=t[2],G((()=>B=!1))),T.$set(u);const c={};!N&&64&e&&(N=!0,c.value=t[6],G((()=>N=!1))),C.$set(c);const h={};!W&&128&e&&(W=!0,h.value=t[7],G((()=>W=!1))),F.$set(h);const f={};!Z&&2&e&&(Z=!0,f.value=t[1],G((()=>Z=!1))),V.$set(f);const p={};256&e&&(p.disabled=t[8][0]),256&e&&(p.label=t[8][1]),tt.$set(p)},i(t){et||(ot(o.$$.fragment,t),ot(d.$$.fragment,t),ot(m.$$.fragment,t),ot(M.$$.fragment,t),ot(T.$$.fragment,t),ot(C.$$.fragment,t),ot(F.$$.fragment,t),ot(V.$$.fragment,t),ot(tt.$$.fragment,t),et=!0)},o(t){st(o.$$.fragment,t),st(d.$$.fragment,t),st(m.$$.fragment,t),st(M.$$.fragment,t),st(T.$$.fragment,t),st(C.$$.fragment,t),st(F.$$.fragment,t),st(V.$$.fragment,t),st(tt.$$.fragment,t),et=!1},d(t){t&&k(e),pt(o),pt(d),pt(m),pt(M),pt(T),pt(C),pt(F),pt(V),pt(tt)}}}function Ei(t,e,n){let r,i,{whirlpoolInfo:o}=e,s=!1,a=!0,u=!0,c=!0,d=!0,l=!0,h=!1,f=0;var p;!function(t){t.NOT_PROCESSING="not processing",t.NOT_PROCESSING_RETRY="not processing (retry)",t.FETCHING="fetching",t.PACKING="packing",t.DOWNLOADING="downloading"}(p||(p={}));let m=p.NOT_PROCESSING;return t.$$set=t=>{"whirlpoolInfo"in t&&n(11,o=t.whirlpoolInfo)},t.$$.update=()=>{4&t.$$.dirty&&n(13,r=1===f),12291&t.$$.dirty&&n(8,i=function(t,e){switch(t){case p.NOT_PROCESSING:return[!1,e?"Download JSON! ( takes up to 1 minute ⌛ )":"Download JSON!"];case p.NOT_PROCESSING_RETRY:return[!1,"Download JSON! ( retry )"];case p.FETCHING:case p.PACKING:case p.DOWNLOADING:return[!0,"Processing..."]}}(m,c&&r||h))},[c,h,f,s,a,u,d,l,i,["only neighborhood","all"],async function(){var t,e,i,f;const g={withWhirlpoolsConfig:a,withFeeTier:u,withTickArray:c,withVaultTokenAccount:d,withMintAccount:l,withPosition:h,tickArraySelection:r?"all":"neighborhood"};try{n(12,m=p.FETCHING);const y=await async function(t,e,n=fi){return await ci()((async()=>ai()(async function(t,e){const{meta:n,parsed:r}=t,i=It(),o=n.owner,s=e.withTickArray&&"all"===e.tickArraySelection,a=n.pubkey,u=r.whirlpoolsConfig,c=jr.PDAUtil.getFeeTier(o,u,r.tickSpacing).publicKey,d=r.tokenMintA,l=r.tokenMintB,h=r.tokenVaultA,f=r.tokenVaultB,p=r.rewardInfos.filter((t=>jr.PoolUtil.isRewardInitialized(t))),m=p.map((t=>t.mint)),g=p.map((t=>t.vault)),y=function(t){const e=new Set(t.map((t=>t.toBase58())));return Array.from(e).map((t=>new Mt.PublicKey(t)))}([d,l,...m]),b=[h,f,...g],w=[-3,-2,-1,0,1,2,3].map((t=>{const e=jr.TickUtil.getStartTickIndex(r.tickCurrentIndex,r.tickSpacing,t);return jr.PDAUtil.getTickArray(o,n.pubkey,e).publicKey})),_=[a,u,c,...w,...y,...b],v="confirmed",k=[{dataSize:(0,jr.getAccountSize)(jr.AccountName.TickArray)},{memcmp:{offset:9956,bytes:a.toBase58()}}],M=[{dataSize:(0,jr.getAccountSize)(jr.AccountName.Position)},{memcmp:{offset:8,bytes:a.toBase58()}}],A=s?pi(i,o,k,v):Promise.resolve(li),S=e.withPosition?pi(i,o,M,v):Promise.resolve(li),[I,x]=await Promise.all([A,S]),E=Math.max(I.slotContext,x.slotContext),T=await async function(t,e,n="confirmed",r){const i=await t.getMultipleAccountsInfoAndContext(e,{commitment:n,minContextSlot:r});return{slotContext:i.context.slot,accounts:Object.fromEntries(e.map(((t,e)=>[t.toBase58(),i.value[e]])).filter((([,t])=>null!==t)))}}(i,_,v,E),P=s?pi(i,o,k,v,T.slotContext):Promise.resolve(li),B=e.withPosition?pi(i,o,M,v,T.slotContext):Promise.resolve(li),[L,$]=await Promise.all([P,B]),R=T.slotContext,O=gi(I,T),D=gi(L,T);if(!mi(O,D))throw new Error("cannot fetch TickArray accounts consistently");if(!mi(x,$))throw new Error("cannot fetch Position accounts consistently");function C(t,e){return tr(Xn(t,e.accounts[t.toBase58()],R),!0)}const N=Object.keys(D.accounts).map((t=>new Mt.PublicKey(t))),z=Object.keys($.accounts).map((t=>new Mt.PublicKey(t)));return{slotContext:R,whirlpool:C(a,T),whirlpoolsConfig:e.withWhirlpoolsConfig?C(u,T):void 0,feeTier:e.withFeeTier?C(c,T):void 0,tickArrays:e.withTickArray?"all"===e.tickArraySelection?N.map((t=>C(t,D))):w.filter((t=>!!T.accounts[t.toBase58()])).map((t=>C(t,T))):void 0,mintAccounts:e.withMintAccount?y.map((t=>C(t,T))):void 0,vaultTokenAccounts:e.withVaultTokenAccount?b.map((t=>C(t,T))):void 0,positions:e.withPosition?z.map((t=>C(t,$))):void 0}}(t,e),hi)),n)}(o,g);n(12,m=p.PACKING);const b=new(vi());function w(t,e){if(!t)return;const n=s?`${e}.${t.pubkey}.json`:`${t.pubkey}.json`;b.file(n,nr(t))}w(y.whirlpool,"whirlpool"),w(y.whirlpoolsConfig,"config"),w(y.feeTier,"feetier"),null===(t=y.tickArrays)||void 0===t||t.forEach((t=>w(t,"tickarray"))),null===(e=y.vaultTokenAccounts)||void 0===e||e.forEach((t=>w(t,"vault"))),null===(i=y.mintAccounts)||void 0===i||i.forEach((t=>w(t,"mint"))),null===(f=y.positions)||void 0===f||f.forEach((t=>w(t,"position")));const _=`${o.meta.pubkey.toBase58()}.${y.slotContext}.zip`,v=await b.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:5}});n(12,m=p.DOWNLOADING),rr(v,_),n(12,m=p.NOT_PROCESSING)}catch(k){console.error(k),n(12,m=p.NOT_PROCESSING_RETRY)}},o,m,r,function(t){s=t,n(3,s)},function(t){a=t,n(4,a)},function(t){u=t,n(5,u)},function(t){c=t,n(0,c)},function(t){f=t,n(2,f)},function(t){d=t,n(6,d)},function(t){l=t,n(7,l)},function(t){h=t,n(1,h)}]}const Ti=class extends gt{constructor(t){super(),mt(this,t,Ei,xi,a,{whirlpoolInfo:11})}};function Pi(t){let e,n;return e=new Gn({props:{address:t[0],short:t[1],length:t[2],type:t[3]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,[n]){const r={};1&n&&(r.address=t[0]),2&n&&(r.short=t[1]),4&n&&(r.length=t[2]),8&n&&(r.type=t[3]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Bi(t,e,n){let{address:r}=e,{type:i}=e,{program:o}=e,{short:s=!1}=e,{length:a=5}=e,u=i;if("token-2022"===o)switch(u){case"token/mint":u="token2022/mint";break;case"token/account":u="token2022/account"}return t.$$set=t=>{"address"in t&&n(0,r=t.address),"type"in t&&n(4,i=t.type),"program"in t&&n(5,o=t.program),"short"in t&&n(1,s=t.short),"length"in t&&n(2,a=t.length)},[r,s,a,u,i,o]}const Li=class extends gt{constructor(t){super(),mt(this,t,Bi,Pi,a,{address:0,type:4,program:5,short:1,length:2})}};function $i(t,e,n){const r=t.slice();return r[4]=e[n],r}function Ri(t,e,n){const r=t.slice();return r[7]=e[n],r}function Oi(t,e,n){const r=t.slice();return r[7]=e[n],r}function Di(t,e,n){const r=t.slice();return r[7]=e[n],r}function Ci(t,e,n){const r=t.slice();return r[7]=e[n],r}function Ni(t,e,n){const r=t.slice();return r[16]=e[n],r}function zi(t,e,n){const r=t.slice();return r[16]=e[n],r}function Ui(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function ji(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/whirlpool",meta:t[3].meta}}),r=new Mr({props:{$$slots:{default:[ts]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[3].meta),e.$set(i);const o={};2097154&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Yi(t){let e,n;return e=new Gn({props:{type:"whirlpool/config",address:t[3].parsed.whirlpoolsConfig}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.whirlpoolsConfig),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Fi(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.tokenMintA,program:t[3].derived.tokenProgramA}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.tokenMintA),2&n&&(r.program=t[3].derived.tokenProgramA),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Wi(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.tokenMintB,program:t[3].derived.tokenProgramB}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.tokenMintB),2&n&&(r.program=t[3].derived.tokenProgramB),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Hi(t){let e,n=t[3].parsed.tickSpacing+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.tickSpacing+"")&&B(e,n)},d(t){t&&k(e)}}}function Ki(t){let e,n=t[3].parsed.liquidity+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.liquidity+"")&&B(e,n)},d(t){t&&k(e)}}}function qi(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.tokenVaultA,program:t[3].derived.tokenProgramA}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.tokenVaultA),2&n&&(r.program=t[3].derived.tokenProgramA),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Vi(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.tokenVaultB,program:t[3].derived.tokenProgramB}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.tokenVaultB),2&n&&(r.program=t[3].derived.tokenProgramB),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Gi(t){let e,n=t[3].parsed.sqrtPrice+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.sqrtPrice+"")&&B(e,n)},d(t){t&&k(e)}}}function Zi(t){let e,n=t[3].parsed.tickCurrentIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.tickCurrentIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function Xi(t){let e,n=t[3].parsed.feeGrowthGlobalA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.feeGrowthGlobalA+"")&&B(e,n)},d(t){t&&k(e)}}}function Ji(t){let e,n=t[3].parsed.feeGrowthGlobalB+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.feeGrowthGlobalB+"")&&B(e,n)},d(t){t&&k(e)}}}function Qi(t){let e,n=t[3].parsed.feeRate+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.feeRate+"")&&B(e,n)},d(t){t&&k(e)}}}function to(t){let e,n=t[3].parsed.protocolFeeRate+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.protocolFeeRate+"")&&B(e,n)},d(t){t&&k(e)}}}function eo(t){let e,n=t[3].parsed.protocolFeeOwedA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.protocolFeeOwedA+"")&&B(e,n)},d(t){t&&k(e)}}}function no(t){let e,n=t[3].parsed.protocolFeeOwedB+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.protocolFeeOwedB+"")&&B(e,n)},d(t){t&&k(e)}}}function ro(t){let e,n,r,i=t[3].parsed.whirlpoolBump[0]+"";return{c(){e=S("["),n=S(i),r=S("]")},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,e){2&e&&i!==(i=t[3].parsed.whirlpoolBump[0]+"")&&B(n,i)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function io(t){let e,n=t[3].parsed.rewardLastUpdatedTimestamp+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardLastUpdatedTimestamp+"")&&B(e,n)},d(t){t&&k(e)}}}function oo(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.rewardInfos[0].mint,program:t[3].derived.tokenProgramR0}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[0].mint),2&n&&(r.program=t[3].derived.tokenProgramR0),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function so(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.rewardInfos[0].vault,program:t[3].derived.tokenProgramR0}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[0].vault),2&n&&(r.program=t[3].derived.tokenProgramR0),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ao(t){let e,n=t[3].parsed.rewardInfos[0].emissionsPerSecondX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[0].emissionsPerSecondX64+"")&&B(e,n)},d(t){t&&k(e)}}}function uo(t){let e,n;return e=new Gn({props:{address:t[3].parsed.rewardInfos[0].authority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[0].authority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function co(t){let e,n=t[3].parsed.rewardInfos[0].growthGlobalX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[0].growthGlobalX64+"")&&B(e,n)},d(t){t&&k(e)}}}function lo(t){let e,n,r,i,o,s,a,u,c,d;return e=new vt({props:{name:"mint",type:"PublicKey",offset:"269",$$slots:{default:[oo]},$$scope:{ctx:t}}}),r=new vt({props:{name:"vault",type:"PublicKey",offset:"301",$$slots:{default:[so]},$$scope:{ctx:t}}}),o=new vt({props:{name:"emissionsPerSecondX64",type:"u128",offset:"365",$$slots:{default:[ao]},$$scope:{ctx:t}}}),a=new vt({props:{name:"authority",type:"PublicKey",offset:"333",$$slots:{default:[uo]},$$scope:{ctx:t}}}),c=new vt({props:{name:"growthGlobalX64",type:"u128",offset:"381",$$slots:{default:[co]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment)},m(t,l){ft(e,t,l),v(t,n,l),ft(r,t,l),v(t,i,l),ft(o,t,l),v(t,s,l),ft(a,t,l),v(t,u,l),ft(c,t,l),d=!0},p(t,n){const i={};2097154&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};2097154&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};2097154&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};2097154&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const l={};2097154&n&&(l.$$scope={dirty:n,ctx:t}),c.$set(l)},i(t){d||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),d=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),d=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t)}}}function ho(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.rewardInfos[1].mint,program:t[3].derived.tokenProgramR1}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[1].mint),2&n&&(r.program=t[3].derived.tokenProgramR1),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function fo(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.rewardInfos[1].vault,program:t[3].derived.tokenProgramR1}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[1].vault),2&n&&(r.program=t[3].derived.tokenProgramR1),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function po(t){let e,n=t[3].parsed.rewardInfos[1].emissionsPerSecondX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[1].emissionsPerSecondX64+"")&&B(e,n)},d(t){t&&k(e)}}}function mo(t){let e,n;return e=new Gn({props:{address:t[3].parsed.rewardInfos[1].authority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[1].authority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function go(t){let e,n=t[3].parsed.rewardInfos[1].growthGlobalX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[1].growthGlobalX64+"")&&B(e,n)},d(t){t&&k(e)}}}function yo(t){let e,n,r,i,o,s,a,u,c,d;return e=new vt({props:{name:"mint",type:"PublicKey",offset:"397",$$slots:{default:[ho]},$$scope:{ctx:t}}}),r=new vt({props:{name:"vault",type:"PublicKey",offset:"429",$$slots:{default:[fo]},$$scope:{ctx:t}}}),o=new vt({props:{name:"emissionsPerSecondX64",type:"u128",offset:"493",$$slots:{default:[po]},$$scope:{ctx:t}}}),a=new vt({props:{name:"authority",type:"PublicKey",offset:"461",$$slots:{default:[mo]},$$scope:{ctx:t}}}),c=new vt({props:{name:"growthGlobalX64",type:"u128",offset:"509",$$slots:{default:[go]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment)},m(t,l){ft(e,t,l),v(t,n,l),ft(r,t,l),v(t,i,l),ft(o,t,l),v(t,s,l),ft(a,t,l),v(t,u,l),ft(c,t,l),d=!0},p(t,n){const i={};2097154&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};2097154&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};2097154&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};2097154&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const l={};2097154&n&&(l.$$scope={dirty:n,ctx:t}),c.$set(l)},i(t){d||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),d=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),d=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t)}}}function bo(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[3].parsed.rewardInfos[2].mint,program:t[3].derived.tokenProgramR2}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[2].mint),2&n&&(r.program=t[3].derived.tokenProgramR2),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function wo(t){let e,n;return e=new Li({props:{type:"token/account",address:t[3].parsed.rewardInfos[2].vault,program:t[3].derived.tokenProgramR2}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[2].vault),2&n&&(r.program=t[3].derived.tokenProgramR2),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function _o(t){let e,n=t[3].parsed.rewardInfos[2].emissionsPerSecondX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[2].emissionsPerSecondX64+"")&&B(e,n)},d(t){t&&k(e)}}}function vo(t){let e,n;return e=new Gn({props:{address:t[3].parsed.rewardInfos[2].authority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.rewardInfos[2].authority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ko(t){let e,n=t[3].parsed.rewardInfos[2].growthGlobalX64+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].parsed.rewardInfos[2].growthGlobalX64+"")&&B(e,n)},d(t){t&&k(e)}}}function Mo(t){let e,n,r,i,o,s,a,u,c,d;return e=new vt({props:{name:"mint",type:"PublicKey",offset:"525",$$slots:{default:[bo]},$$scope:{ctx:t}}}),r=new vt({props:{name:"vault",type:"PublicKey",offset:"557",$$slots:{default:[wo]},$$scope:{ctx:t}}}),o=new vt({props:{name:"emissionsPerSecondX64",type:"u128",offset:"621",$$slots:{default:[_o]},$$scope:{ctx:t}}}),a=new vt({props:{name:"authority",type:"PublicKey",offset:"589",$$slots:{default:[vo]},$$scope:{ctx:t}}}),c=new vt({props:{name:"growthGlobalX64",type:"u128",offset:"637",$$slots:{default:[ko]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment)},m(t,l){ft(e,t,l),v(t,n,l),ft(r,t,l),v(t,i,l),ft(o,t,l),v(t,s,l),ft(a,t,l),v(t,u,l),ft(c,t,l),d=!0},p(t,n){const i={};2097154&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};2097154&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};2097154&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};2097154&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const l={};2097154&n&&(l.$$scope={dirty:n,ctx:t}),c.$set(l)},i(t){d||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),d=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),d=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t)}}}function Ao(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,x,E,T,P,B,L,$,R,O,D,C,N,z,U,j,Y,F;return e=new vt({props:{name:"whirlpoolsConfig",type:"PublicKey",offset:"8",$$slots:{default:[Yi]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tokenMintA",type:"PublicKey",offset:"101",$$slots:{default:[Fi]},$$scope:{ctx:t}}}),o=new vt({props:{name:"tokenMintB",type:"PublicKey",offset:"181",$$slots:{default:[Wi]},$$scope:{ctx:t}}}),a=new vt({props:{name:"tickSpacing",type:"u16",offset:"41",$$slots:{default:[Hi]},$$scope:{ctx:t}}}),c=new vt({props:{name:"liquidity",type:"u128",offset:"49",$$slots:{default:[Ki]},$$scope:{ctx:t}}}),l=new vt({props:{name:"tokenVaultA",type:"PublicKey",offset:"133",$$slots:{default:[qi]},$$scope:{ctx:t}}}),f=new vt({props:{name:"tokenVaultB",type:"PublicKey",offset:"213",$$slots:{default:[Vi]},$$scope:{ctx:t}}}),m=new vt({props:{name:"sqrtPrice",type:"u128",offset:"65",$$slots:{default:[Gi]},$$scope:{ctx:t}}}),y=new vt({props:{name:"tickCurrentIndex",type:"i32",offset:"81",$$slots:{default:[Zi]},$$scope:{ctx:t}}}),w=new vt({props:{name:"feeGrowthGlobalA",type:"u128",offset:"165",$$slots:{default:[Xi]},$$scope:{ctx:t}}}),M=new vt({props:{name:"feeGrowthGlobalB",type:"u128",offset:"245",$$slots:{default:[Ji]},$$scope:{ctx:t}}}),S=new vt({props:{name:"feeRate",type:"u16",offset:"45",$$slots:{default:[Qi]},$$scope:{ctx:t}}}),E=new vt({props:{name:"protocolFeeRate",type:"u16",offset:"47",$$slots:{default:[to]},$$scope:{ctx:t}}}),P=new vt({props:{name:"protocolFeeOwedA",type:"u64",offset:"85",$$slots:{default:[eo]},$$scope:{ctx:t}}}),L=new vt({props:{name:"protocolFeeOwedB",type:"u64",offset:"93",$$slots:{default:[no]},$$scope:{ctx:t}}}),R=new vt({props:{name:"whirlpoolBump",type:"[u8; 1]",offset:"40",$$slots:{default:[ro]},$$scope:{ctx:t}}}),D=new vt({props:{name:"rewardLastUpdatedTimestamp",type:"u64",offset:"261",$$slots:{default:[io]},$$scope:{ctx:t}}}),N=new vt({props:{name:"rewardInfos[0]",$$slots:{default:[lo]},$$scope:{ctx:t}}}),U=new vt({props:{name:"rewardInfos[1]",$$slots:{default:[yo]},$$scope:{ctx:t}}}),Y=new vt({props:{name:"rewardInfos[2]",$$slots:{default:[Mo]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment),A=I(),ht(S.$$.fragment),x=I(),ht(E.$$.fragment),T=I(),ht(P.$$.fragment),B=I(),ht(L.$$.fragment),$=I(),ht(R.$$.fragment),O=I(),ht(D.$$.fragment),C=I(),ht(N.$$.fragment),z=I(),ht(U.$$.fragment),j=I(),ht(Y.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),v(t,A,k),ft(S,t,k),v(t,x,k),ft(E,t,k),v(t,T,k),ft(P,t,k),v(t,B,k),ft(L,t,k),v(t,$,k),ft(R,t,k),v(t,O,k),ft(D,t,k),v(t,C,k),ft(N,t,k),v(t,z,k),ft(U,t,k),v(t,j,k),ft(Y,t,k),F=!0},p(t,n){const i={};2097154&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};2097154&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};2097154&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};2097154&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};2097154&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};2097154&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};2097154&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};2097154&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};2097154&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};2097154&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};2097154&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k);const A={};2097154&n&&(A.$$scope={dirty:n,ctx:t}),S.$set(A);const I={};2097154&n&&(I.$$scope={dirty:n,ctx:t}),E.$set(I);const x={};2097154&n&&(x.$$scope={dirty:n,ctx:t}),P.$set(x);const T={};2097154&n&&(T.$$scope={dirty:n,ctx:t}),L.$set(T);const B={};2097154&n&&(B.$$scope={dirty:n,ctx:t}),R.$set(B);const $={};2097154&n&&($.$$scope={dirty:n,ctx:t}),D.$set($);const O={};2097154&n&&(O.$$scope={dirty:n,ctx:t}),N.$set(O);const C={};2097154&n&&(C.$$scope={dirty:n,ctx:t}),U.$set(C);const z={};2097154&n&&(z.$$scope={dirty:n,ctx:t}),Y.$set(z)},i(t){F||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),ot(S.$$.fragment,t),ot(E.$$.fragment,t),ot(P.$$.fragment,t),ot(L.$$.fragment,t),ot(R.$$.fragment,t),ot(D.$$.fragment,t),ot(N.$$.fragment,t),ot(U.$$.fragment,t),ot(Y.$$.fragment,t),F=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),st(S.$$.fragment,t),st(E.$$.fragment,t),st(P.$$.fragment,t),st(L.$$.fragment,t),st(R.$$.fragment,t),st(D.$$.fragment,t),st(N.$$.fragment,t),st(U.$$.fragment,t),st(Y.$$.fragment,t),F=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t),t&&k(A),pt(S,t),t&&k(x),pt(E,t),t&&k(T),pt(P,t),t&&k(B),pt(L,t),t&&k($),pt(R,t),t&&k(O),pt(D,t),t&&k(C),pt(N,t),t&&k(z),pt(U,t),t&&k(j),pt(Y,t)}}}function So(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,L,R,O,D,C,N,z,U,j,Y,F,W,H,K,q,V,G,Z,X,J,Q,tt,et,nt,rt,it=rs(t[3].derived.tokenInfoA)+"",ot=t[3].derived.tokenProgramA+"",st=t[3].derived.decimalsA+"",at=rs(t[3].derived.tokenInfoB)+"",ut=t[3].derived.tokenProgramB+"",ct=t[3].derived.decimalsB+"",dt=rs(t[3].derived.tokenInfoR0)+"",lt=t[3].derived.tokenProgramR0+"",ht=t[3].derived.decimalsR0+"",ft=rs(t[3].derived.tokenInfoR1)+"",pt=t[3].derived.tokenProgramR1+"",mt=t[3].derived.decimalsR1+"",gt=rs(t[3].derived.tokenInfoR2)+"",yt=t[3].derived.tokenProgramR2+"",bt=t[3].derived.decimalsR2+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokenprogramdecimals',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("A"),u=S(it),c=A("td"),d=S(ot),l=A("td"),h=S(st),f=I(),p=A("tr"),m=A("td"),g=S("B"),y=S(at),b=A("td"),w=S(ut),M=A("td"),x=S(ct),E=I(),T=A("tr"),L=A("td"),R=S("reward0"),O=S(dt),D=A("td"),C=S(lt),N=A("td"),z=S(ht),U=I(),j=A("tr"),Y=A("td"),F=S("reward1"),W=S(ft),H=A("td"),K=S(pt),q=A("td"),V=S(mt),G=I(),Z=A("tr"),X=A("td"),J=S("reward2"),Q=S(gt),tt=A("td"),et=S(yt),nt=A("td"),rt=S(bt),P(s,"class","svelte-1jz58vl"),P(c,"class","svelte-1jz58vl"),P(l,"class","svelte-1jz58vl"),P(m,"class","svelte-1jz58vl"),P(b,"class","svelte-1jz58vl"),P(M,"class","svelte-1jz58vl"),P(L,"class","svelte-1jz58vl"),P(D,"class","svelte-1jz58vl"),P(N,"class","svelte-1jz58vl"),P(Y,"class","svelte-1jz58vl"),P(H,"class","svelte-1jz58vl"),P(q,"class","svelte-1jz58vl"),P(X,"class","svelte-1jz58vl"),P(tt,"class","svelte-1jz58vl"),P(nt,"class","svelte-1jz58vl"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(o,l),_(l,h),_(i,f),_(i,p),_(p,m),_(m,g),_(m,y),_(p,b),_(b,w),_(p,M),_(M,x),_(i,E),_(i,T),_(T,L),_(L,R),_(L,O),_(T,D),_(D,C),_(T,N),_(N,z),_(i,U),_(i,j),_(j,Y),_(Y,F),_(Y,W),_(j,H),_(H,K),_(j,q),_(q,V),_(i,G),_(i,Z),_(Z,X),_(X,J),_(X,Q),_(Z,tt),_(tt,et),_(Z,nt),_(nt,rt)},p(t,e){2&e&&it!==(it=rs(t[3].derived.tokenInfoA)+"")&&B(u,it),2&e&&ot!==(ot=t[3].derived.tokenProgramA+"")&&B(d,ot),2&e&&st!==(st=t[3].derived.decimalsA+"")&&B(h,st),2&e&&at!==(at=rs(t[3].derived.tokenInfoB)+"")&&B(y,at),2&e&&ut!==(ut=t[3].derived.tokenProgramB+"")&&B(w,ut),2&e&&ct!==(ct=t[3].derived.decimalsB+"")&&B(x,ct),2&e&&dt!==(dt=rs(t[3].derived.tokenInfoR0)+"")&&B(O,dt),2&e&<!==(lt=t[3].derived.tokenProgramR0+"")&&B(C,lt),2&e&&ht!==(ht=t[3].derived.decimalsR0+"")&&B(z,ht),2&e&&ft!==(ft=rs(t[3].derived.tokenInfoR1)+"")&&B(W,ft),2&e&&pt!==(pt=t[3].derived.tokenProgramR1+"")&&B(K,pt),2&e&&mt!==(mt=t[3].derived.decimalsR1+"")&&B(V,mt),2&e&>!==(gt=rs(t[3].derived.tokenInfoR2)+"")&&B(Q,gt),2&e&&yt!==(yt=t[3].derived.tokenProgramR2+"")&&B(et,yt),2&e&&bt!==(bt=t[3].derived.decimalsR2+"")&&B(rt,bt)},d(t){t&&k(e)}}}function Io(t){let e,n,r,i=t[3].derived.price+"",o=is(t[3].derived.tokenInfoA,t[3].derived.tokenInfoB)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[3].derived.price+"")&&B(e,i),2&n&&o!==(o=is(t[3].derived.tokenInfoA,t[3].derived.tokenInfoB)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function xo(t){let e,n,r,i=t[3].derived.invertedPrice+"",o=is(t[3].derived.tokenInfoB,t[3].derived.tokenInfoA)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[3].derived.invertedPrice+"")&&B(e,i),2&n&&o!==(o=is(t[3].derived.tokenInfoB,t[3].derived.tokenInfoA)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Eo(t){let e,n,r=t[3].derived.feeRate+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[3].derived.feeRate+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function To(t){let e,n,r,i,o=t[3].derived.protocolFeeRate+"",s=t[3].derived.feeRate.mul(t[3].derived.protocolFeeRate.div(100))+"";return{c(){e=S(o),n=S(" % of fee ("),r=S(s),i=S(" %)")},m(t,o){v(t,e,o),v(t,n,o),v(t,r,o),v(t,i,o)},p(t,n){2&n&&o!==(o=t[3].derived.protocolFeeRate+"")&&B(e,o),2&n&&s!==(s=t[3].derived.feeRate.mul(t[3].derived.protocolFeeRate.div(100))+"")&&B(r,s)},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(i)}}}function Po(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,L,R,O,D,C,N,z,U,j,Y,F,W,H,K,q,V=rs(t[3].derived.tokenInfoA)+"",G=t[3].derived.tokenVaultAAmount+"",Z=rs(t[3].derived.tokenInfoB)+"",X=t[3].derived.tokenVaultBAmount+"",J=rs(t[3].derived.tokenInfoR0)+"",Q=t[3].derived.tokenVaultR0Amount+"",tt=rs(t[3].derived.tokenInfoR1)+"",et=t[3].derived.tokenVaultR1Amount+"",nt=rs(t[3].derived.tokenInfoR2)+"",rt=t[3].derived.tokenVaultR2Amount+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokenamount',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("A"),u=S(V),c=A("td"),d=S(G),l=I(),h=A("tr"),f=A("td"),p=S("B"),m=S(Z),g=A("td"),y=S(X),b=I(),w=A("tr"),M=A("td"),x=S("reward0"),E=S(J),T=A("td"),L=S(Q),R=I(),O=A("tr"),D=A("td"),C=S("reward1"),N=S(tt),z=A("td"),U=S(et),j=I(),Y=A("tr"),F=A("td"),W=S("reward2"),H=S(nt),K=A("td"),q=S(rt),P(s,"class","svelte-1jz58vl"),P(c,"class","svelte-1jz58vl"),P(f,"class","svelte-1jz58vl"),P(g,"class","svelte-1jz58vl"),P(M,"class","svelte-1jz58vl"),P(T,"class","svelte-1jz58vl"),P(D,"class","svelte-1jz58vl"),P(z,"class","svelte-1jz58vl"),P(F,"class","svelte-1jz58vl"),P(K,"class","svelte-1jz58vl"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y),_(i,b),_(i,w),_(w,M),_(M,x),_(M,E),_(w,T),_(T,L),_(i,R),_(i,O),_(O,D),_(D,C),_(D,N),_(O,z),_(z,U),_(i,j),_(i,Y),_(Y,F),_(F,W),_(F,H),_(Y,K),_(K,q)},p(t,e){2&e&&V!==(V=rs(t[3].derived.tokenInfoA)+"")&&B(u,V),2&e&&G!==(G=t[3].derived.tokenVaultAAmount+"")&&B(d,G),2&e&&Z!==(Z=rs(t[3].derived.tokenInfoB)+"")&&B(m,Z),2&e&&X!==(X=t[3].derived.tokenVaultBAmount+"")&&B(y,X),2&e&&J!==(J=rs(t[3].derived.tokenInfoR0)+"")&&B(E,J),2&e&&Q!==(Q=t[3].derived.tokenVaultR0Amount+"")&&B(L,Q),2&e&&tt!==(tt=rs(t[3].derived.tokenInfoR1)+"")&&B(N,tt),2&e&&et!==(et=t[3].derived.tokenVaultR1Amount+"")&&B(U,et),2&e&&nt!==(nt=rs(t[3].derived.tokenInfoR2)+"")&&B(H,nt),2&e&&rt!==(rt=t[3].derived.tokenVaultR2Amount+"")&&B(q,rt)},d(t){t&&k(e)}}}function Bo(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,L,R=rs(t[3].derived.tokenInfoR0)+"",O=t[3].derived.reward0WeeklyEmission+"",D=rs(t[3].derived.tokenInfoR1)+"",C=t[3].derived.reward1WeeklyEmission+"",N=rs(t[3].derived.tokenInfoR2)+"",z=t[3].derived.reward2WeeklyEmission+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='rewardemission',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("reward0"),u=S(R),c=A("td"),d=S(O),l=I(),h=A("tr"),f=A("td"),p=S("reward1"),m=S(D),g=A("td"),y=S(C),b=I(),w=A("tr"),M=A("td"),x=S("reward2"),E=S(N),T=A("td"),L=S(z),P(s,"class","svelte-1jz58vl"),P(c,"class","svelte-1jz58vl"),P(f,"class","svelte-1jz58vl"),P(g,"class","svelte-1jz58vl"),P(M,"class","svelte-1jz58vl"),P(T,"class","svelte-1jz58vl"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y),_(i,b),_(i,w),_(w,M),_(M,x),_(M,E),_(w,T),_(T,L)},p(t,e){2&e&&R!==(R=rs(t[3].derived.tokenInfoR0)+"")&&B(u,R),2&e&&O!==(O=t[3].derived.reward0WeeklyEmission+"")&&B(d,O),2&e&&D!==(D=rs(t[3].derived.tokenInfoR1)+"")&&B(m,D),2&e&&C!==(C=t[3].derived.reward1WeeklyEmission+"")&&B(y,C),2&e&&N!==(N=rs(t[3].derived.tokenInfoR2)+"")&&B(E,N),2&e&&z!==(z=t[3].derived.reward2WeeklyEmission+"")&&B(L,z)},d(t){t&&k(e)}}}function Lo(t){let e,n=t[3].derived.rewardLastUpdatedTimestamp.format("YYYY/MM/DD HH:mm:ss UTCZZ")+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[3].derived.rewardLastUpdatedTimestamp.format("YYYY/MM/DD HH:mm:ss UTCZZ")+"")&&B(e,n)},d(t){t&&k(e)}}}function $o(t){let e,n;return e=new Gn({props:{address:t[3].derived.oracle}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].derived.oracle),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ro(t){let e,n,r,i,o,s,a,u,c,d,l,h,f=t[16].isInitialized+"",p=t[16].startTickIndex+"";return c=new Gn({props:{type:"whirlpool/tickarray",address:t[16].pubkey,short:!0}}),{c(){e=A("tr"),n=A("td"),r=S(f),i=I(),o=A("td"),s=S(p),a=I(),u=A("td"),ht(c.$$.fragment),d=I(),P(n,"class","svelte-1jz58vl"),P(o,"class","svelte-1jz58vl"),P(u,"class","svelte-1jz58vl"),P(e,"class",l=m(t[16].isInitialized?"initialized":"uninitialized")+" svelte-1jz58vl")},m(t,l){v(t,e,l),_(e,n),_(n,r),_(e,i),_(e,o),_(o,s),_(e,a),_(e,u),ft(c,u,null),_(e,d),h=!0},p(t,n){(!h||2&n)&&f!==(f=t[16].isInitialized+"")&&B(r,f),(!h||2&n)&&p!==(p=t[16].startTickIndex+"")&&B(s,p);const i={};2&n&&(i.address=t[16].pubkey),c.$set(i),(!h||2&n&&l!==(l=m(t[16].isInitialized?"initialized":"uninitialized")+" svelte-1jz58vl"))&&P(e,"class",l)},i(t){h||(ot(c.$$.fragment,t),h=!0)},o(t){st(c.$$.fragment,t),h=!1},d(t){t&&k(e),pt(c)}}}function Oo(t){let e,n,r,i,o,s=t[3].derived.fullRangeTickArrays,a=[];for(let e=0;est(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='initializedstart tickpubkey',r=I(),i=A("tbody");for(let t=0;tst(C[t],1,1,(()=>{C[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='currentinitializedstart tickstart pricepubkey',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("B"),u=S(T),c=S(" to A"),d=S(L),l=S(" direction (price up)"),h=I();for(let t=0;tst(V[t],1,1,(()=>{V[t]=null}));let Z=t[3].derived.tickArrayTradableAmounts.downward,X=[];for(let e=0;est(X[t],1,1,(()=>{X[t]=null}));return{c(){e=A("table"),n=A("thead"),r=A("th"),r.textContent="start price",i=A("th"),o=S("tokenA"),s=S(j),a=A("th"),u=S("tokenB"),c=S(Y),d=A("th"),d.textContent="pubkey",l=I(),h=A("tbody"),f=A("tr"),p=A("td"),m=S("B"),g=S(F),y=S(" to A"),b=S(W),w=S(" direction (price up)"),x=I();for(let t=0;t{s[u]=null})),it(),n=s[e],n?n.p(t,i):(n=s[e]=o[e](t),n.c()),ot(n,1),n.m(r.parentNode,r))},i(t){i||(ot(n),i=!0)},o(t){st(n),i=!1},d(t){s[e].d(t),t&&k(r)}}}function Fo(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,x,E,T,L,R,O,D,C,N,z,U=rs(t[3].derived.tokenInfoA)+"",j=rs(t[3].derived.tokenInfoB)+"",Y=rs(t[3].derived.tokenInfoB)+"",F=rs(t[3].derived.tokenInfoA)+"",W=rs(t[3].derived.tokenInfoA)+"",H=rs(t[3].derived.tokenInfoB)+"",K=t[3].derived.tradableAmounts.upward.reverse(),q=[];for(let e=0;est(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='tsfeeliquiditytickpricepubkey',r=I(),i=A("tbody");for(let t=0;to.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function rs(t,e=!1){return void 0===t?"":e?t.symbol:`(${t.symbol})`}function is(t,e){return void 0===t||void 0===e?"":`${e.symbol}/${t.symbol}`}function os(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){var e,n,r,i,o,s;const a=bn.AddressUtil.toPubKey(t),u=It(),c=(0,jr.buildDefaultAccountFetcher)(u),{accountInfo:d,slotContext:l}=await Zn(u,a),h=jr.ParsableWhirlpool.parse(a,d),f=[];f.push(h.tokenMintA),f.push(h.tokenMintB),f.push(h.rewardInfos[0].mint),f.push(h.rewardInfos[1].mint),f.push(h.rewardInfos[2].mint);const p=await c.getMintInfos(f,jr.IGNORE_CACHE),m=p.get(f[0].toBase58()).decimals,g=p.get(f[1].toBase58()).decimals,y=null===(e=p.get(f[2].toBase58()))||void 0===e?void 0:e.decimals,b=null===(n=p.get(f[3].toBase58()))||void 0===n?void 0:n.decimals,w=null===(r=p.get(f[4].toBase58()))||void 0===r?void 0:r.decimals,_=Zr(p.get(f[0].toBase58()).tokenProgram),v=Zr(p.get(f[1].toBase58()).tokenProgram),k=Zr(null===(i=p.get(f[2].toBase58()))||void 0===i?void 0:i.tokenProgram),M=Zr(null===(o=p.get(f[3].toBase58()))||void 0===o?void 0:o.tokenProgram),A=Zr(null===(s=p.get(f[4].toBase58()))||void 0===s?void 0:s.tokenProgram),S=[];S.push(h.tokenVaultA),S.push(h.tokenVaultB),S.push(h.rewardInfos[0].vault),S.push(h.rewardInfos[1].vault),S.push(h.rewardInfos[2].vault);const I=await c.getTokenInfos(S,jr.IGNORE_CACHE),x=[I.get(S[0].toBase58()),I.get(S[1].toBase58()),I.get(S[2].toBase58()),I.get(S[3].toBase58()),I.get(S[4].toBase58())],E=await Rn(),T=E.getTokenInfoByMint(f[0]),P=E.getTokenInfoByMint(f[1]),B=E.getTokenInfoByMint(f[2]),L=E.getTokenInfoByMint(f[3]),$=E.getTokenInfoByMint(f[4]),R=h.tickSpacing*jr.TICK_ARRAY_SIZE,O=jr.TickUtil.getStartTickIndex(h.tickCurrentIndex,h.tickSpacing),D=[],C=[];for(let t=-Vr;t<=Vr;t++){const e=jr.TickUtil.getStartTickIndex(h.tickCurrentIndex,h.tickSpacing,t);e+R<=jr.MIN_TICK_INDEX||e>jr.MAX_TICK_INDEX||(D.push(e),C.push(jr.PDAUtil.getTickArray(d.owner,a,e).publicKey))}const N=await c.getTickArrays(C,jr.IGNORE_CACHE),z=[];D.forEach(((t,e)=>{z.push({pubkey:C[e],startTickIndex:t,startPrice:Jn(jr.PriceMath.tickIndexToPrice(t,m,g),g),isInitialized:!!N[e],hasTickCurrentIndex:t===O})}));const U=Math.ceil(jr.MIN_TICK_INDEX/h.tickSpacing)*h.tickSpacing,j=Math.floor(jr.MAX_TICK_INDEX/h.tickSpacing)*h.tickSpacing,Y=jr.TickUtil.getStartTickIndex(U,h.tickSpacing),F=jr.TickUtil.getStartTickIndex(j,h.tickSpacing),W=jr.PDAUtil.getTickArray(d.owner,a,Y).publicKey,H=jr.PDAUtil.getTickArray(d.owner,a,F).publicKey,K=await c.getTickArrays([W,H],jr.IGNORE_CACHE),q=[{pubkey:W,startTickIndex:Y,isInitialized:!!K[0]},{pubkey:H,startTickIndex:F,isInitialized:!!K[1]}],V=[];Gr.forEach((t=>{V.push(jr.PDAUtil.getWhirlpool(d.owner,h.whirlpoolsConfig,h.tokenMintA,h.tokenMintB,t).publicKey)}));const G=await c.getPools(V,jr.IGNORE_CACHE),Z=[];Gr.forEach(((t,e)=>{const n=G.get(V[e].toBase58());n&&Z.push({tickSpacing:t,feeRate:jr.PoolUtil.getFeeRate(n.feeRate).toDecimal().mul(100),pubkey:V[e],tickCurrentIndex:n.tickCurrentIndex,price:Jn(jr.PriceMath.sqrtPriceX64ToPrice(n.sqrtPrice,m,g),g),liquidity:n.liquidity})}));const X=jr.PDAUtil.getOracle(d.owner,a).publicKey;let J={downward:[],upward:[],error:!0};try{const t=function(t,e,n,r){let i,o,s,a,u,c,d;const l=t.tickCurrentIndex,h=t.tickSpacing,f=Math.floor(l/h)*h,p=f+h;i=t.tickCurrentIndex,s=t.sqrtPrice,u=t.liquidity;const m=[];for(let t=0;t<10&&(o=p+t*h,d=Jr(o,h,e),void 0===d&&o--,!(o<=i));t++){a=jr.PriceMath.tickIndexToSqrtPriceX64(o),c=Jn(jr.PriceMath.tickIndexToPrice(o,n,r),r);const t=(0,Fr.getAmountDeltaA)(s,a,u,!1),e=(0,Fr.getAmountDeltaB)(s,a,u,!0);if(m.push({tickIndex:o,price:c,amountA:bn.DecimalUtil.fromBN(new kt.BN(t),n),amountB:bn.DecimalUtil.fromBN(new kt.BN(e),r)}),void 0===d)break;i=o,s=a,u=u.add(d.liquidityNet)}i=t.tickCurrentIndex,s=t.sqrtPrice,u=t.liquidity;const g=[];for(let t=0;t<10&&(o=f-t*h,d=Jr(o,h,e),void 0!==d);t++){a=jr.PriceMath.tickIndexToSqrtPriceX64(o),c=Jn(jr.PriceMath.tickIndexToPrice(o,n,r),r);const t=(0,Fr.getAmountDeltaA)(s,a,u,!0),e=(0,Fr.getAmountDeltaB)(s,a,u,!1);g.push({tickIndex:o,price:c,amountA:bn.DecimalUtil.fromBN(new kt.BN(t),n),amountB:bn.DecimalUtil.fromBN(new kt.BN(e),r)}),i=o,s=a,u=u.sub(d.liquidityNet)}return{upward:m,downward:g,error:!1}}(h,N.slice(),m,g);J=t}catch(t){console.log(t)}let Q={downward:[],upward:[],error:!0};try{const t=function(t,e,n,r,i,o){let s,a,u,c,d,l,h;const f=t.tickCurrentIndex,p=t.tickSpacing,m=p*jr.TICK_ARRAY_SIZE,g=Math.floor(f/p)*p,y=g+p,b=Math.floor(f/m)*m,w=(b-e[0])/m,_=[],v=[],k=[],M=[],A=[];for(let t=0;w+tS);t++){c=jr.PriceMath.tickIndexToSqrtPriceX64(a),l=Jn(jr.PriceMath.tickIndexToPrice(a,i,o),o);const t=(0,Fr.getAmountDeltaA)(u,c,d,!1),e=(0,Fr.getAmountDeltaB)(u,c,d,!0),n=bn.DecimalUtil.fromBN(new kt.BN(t),i),f=bn.DecimalUtil.fromBN(new kt.BN(e),o);M[I]=M[I].add(n),A[I]=A[I].add(f),h=Jr(a,p,r),void 0!==h&&(d=d.add(h.liquidityNet)),s=a,u=c,a%m==0&&I++}const x=[],E=[],T=[],P=[],B=[];for(let t=0;w-t>=0;t++)x.push(n[w-t]),E.push(e[w-t]),T.push(r[w-t]),P.push(new fn(0)),B.push(new fn(0));const L=Math.max(jr.MIN_TICK_INDEX,b-(T.length-1)*m);let $=0;s=t.tickCurrentIndex,u=t.sqrtPrice,d=t.liquidity;for(let t=0;a=g-t*p,!(aMath.min(Math.max(t,p),m),k=v(fn.log(g.pow(2),1.0001).toDecimalPlaces(3).toNumber()),M=m-p;let A=k;function S(t,e){const r="inc"===t?1:-1,i="TA"===e?f*jr.TICK_ARRAY_SIZE:"TS"===e?f:1;n(10,A=v(A+r*i))}return t.$$set=t=>{"positionInfo"in t&&n(9,d=t.positionInfo)},t.$$.update=()=>{1024&t.$$.dirty[0]&&n(2,r=A),1024&t.$$.dirty[0]&&n(0,i=(A-p)/M*1e3),1024&t.$$.dirty[0]&&n(1,o=function(t){const e=d.derived.decimalsA,n=d.derived.decimalsB,r=new fn(10).pow(e-n),i=new fn("1.0001").pow(t).mul(r),o=new fn(1).div(i),s=new fn(1.0001).pow(t).sqrt(),a=bn.MathUtil.toX64(s),u=jr.PoolUtil.getTokenAmountsFromLiquidity(d.parsed.liquidity,a,w,_,!1),c=new fn(1).sub(s.div(b)),l=new fn(1).sub(y.div(s)),h=c.div(c.add(l)).mul(100).toFixed(2),f=l.div(c.add(l)).mul(100).toFixed(2);return{price:i.toFixed(n),invertedPrice:o.toFixed(e),withdrawableA:bn.DecimalUtil.fromBN(u.tokenA,e).toString(),withdrawableB:bn.DecimalUtil.fromBN(u.tokenB,n).toString(),ratioA:h,ratioB:f}}(A))},[i,o,r,l,h,S,function(){n(10,A=Math.round(A))},function(){n(10,A=k)},function(){var t;n(10,A=v((t=p+M*i/1e3,Math.round(1e3*t)/1e3)))},d,A,()=>S("dec","TA"),()=>S("dec","TS"),()=>S("dec","tick"),function(){r=this.value,n(2,r),n(10,A)},()=>S("inc","tick"),()=>S("inc","TS"),()=>S("inc","TA"),function(){var t;t=this.value,i=""===t?null:+t,n(0,i),n(10,A)}]}const ls=class extends gt{constructor(t){super(),mt(this,t,ds,us,a,{positionInfo:9},null,[-1,-1])}};function hs(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function fs(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/position",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[ea]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function ps(t){let e,n;return e=new Gn({props:{type:"whirlpool/whirlpool",address:t[2].parsed.whirlpool}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpool),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ms(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.positionMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.positionMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function gs(t){let e,n=t[2].parsed.liquidity+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.liquidity+"")&&B(e,n)},d(t){t&&k(e)}}}function ys(t){let e,n=t[2].parsed.tickLowerIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.tickLowerIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function bs(t){let e,n=t[2].parsed.tickUpperIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.tickUpperIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function ws(t){let e,n=t[2].parsed.feeGrowthCheckpointA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.feeGrowthCheckpointA+"")&&B(e,n)},d(t){t&&k(e)}}}function _s(t){let e,n=t[2].parsed.feeGrowthCheckpointB+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.feeGrowthCheckpointB+"")&&B(e,n)},d(t){t&&k(e)}}}function vs(t){let e,n=t[2].parsed.feeOwedA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.feeOwedA+"")&&B(e,n)},d(t){t&&k(e)}}}function ks(t){let e,n=t[2].parsed.feeOwedB+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.feeOwedB+"")&&B(e,n)},d(t){t&&k(e)}}}function Ms(t){let e,n=t[2].parsed.rewardInfos[0].amountOwed+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[0].amountOwed+"")&&B(e,n)},d(t){t&&k(e)}}}function As(t){let e,n=t[2].parsed.rewardInfos[0].growthInsideCheckpoint+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[0].growthInsideCheckpoint+"")&&B(e,n)},d(t){t&&k(e)}}}function Ss(t){let e,n,r,i;return e=new vt({props:{name:"amountOwed",type:"u64",offset:"160",$$slots:{default:[Ms]},$$scope:{ctx:t}}}),r=new vt({props:{name:"growthInsideCheckpoint",type:"u128",offset:"144",$$slots:{default:[As]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Is(t){let e,n=t[2].parsed.rewardInfos[1].amountOwed+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[1].amountOwed+"")&&B(e,n)},d(t){t&&k(e)}}}function xs(t){let e,n=t[2].parsed.rewardInfos[1].growthInsideCheckpoint+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[1].growthInsideCheckpoint+"")&&B(e,n)},d(t){t&&k(e)}}}function Es(t){let e,n,r,i;return e=new vt({props:{name:"amountOwed",type:"u64",offset:"184",$$slots:{default:[Is]},$$scope:{ctx:t}}}),r=new vt({props:{name:"growthInsideCheckpoint",type:"u128",offset:"168",$$slots:{default:[xs]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ts(t){let e,n=t[2].parsed.rewardInfos[2].amountOwed+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[2].amountOwed+"")&&B(e,n)},d(t){t&&k(e)}}}function Ps(t){let e,n=t[2].parsed.rewardInfos[2].growthInsideCheckpoint+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.rewardInfos[2].growthInsideCheckpoint+"")&&B(e,n)},d(t){t&&k(e)}}}function Bs(t){let e,n,r,i;return e=new vt({props:{name:"amountOwed",type:"u64",offset:"208",$$slots:{default:[Ts]},$$scope:{ctx:t}}}),r=new vt({props:{name:"growthInsideCheckpoint",type:"u128",offset:"192",$$slots:{default:[Ps]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ls(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,x;return e=new vt({props:{name:"whirlpool",type:"PublicKey",offset:"8",$$slots:{default:[ps]},$$scope:{ctx:t}}}),r=new vt({props:{name:"positionMint",type:"PublicKey",offset:"40",$$slots:{default:[ms]},$$scope:{ctx:t}}}),o=new vt({props:{name:"liquidity",type:"u128",offset:"72",$$slots:{default:[gs]},$$scope:{ctx:t}}}),a=new vt({props:{name:"tickLowerIndex",type:"i32",offset:"88",$$slots:{default:[ys]},$$scope:{ctx:t}}}),c=new vt({props:{name:"tickUpperIndex",type:"i32",offset:"92",$$slots:{default:[bs]},$$scope:{ctx:t}}}),l=new vt({props:{name:"feeGrowthCheckpointA",type:"u128",offset:"96",$$slots:{default:[ws]},$$scope:{ctx:t}}}),f=new vt({props:{name:"feeGrowthCheckpointB",type:"u128",offset:"120",$$slots:{default:[_s]},$$scope:{ctx:t}}}),m=new vt({props:{name:"feeOwedA",type:"u64",offset:"112",$$slots:{default:[vs]},$$scope:{ctx:t}}}),y=new vt({props:{name:"feeOwedB",type:"u64",offset:"136",$$slots:{default:[ks]},$$scope:{ctx:t}}}),w=new vt({props:{name:"rewardInfos[0]",$$slots:{default:[Ss]},$$scope:{ctx:t}}}),M=new vt({props:{name:"rewardInfos[1]",$$slots:{default:[Es]},$$scope:{ctx:t}}}),S=new vt({props:{name:"rewardInfos[2]",$$slots:{default:[Bs]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment),A=I(),ht(S.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),v(t,A,k),ft(S,t,k),x=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};10&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k);const A={};10&n&&(A.$$scope={dirty:n,ctx:t}),S.$set(A)},i(t){x||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),ot(S.$$.fragment,t),x=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),st(S.$$.fragment,t),x=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t),t&&k(A),pt(S,t)}}}function $s(t){let e,n=t[2].derived.isBundledPosition+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isBundledPosition+"")&&B(e,n)},d(t){t&&k(e)}}}function Rs(t){let e,n;return e=new vt({props:{name:"position bundle",$$slots:{default:[Os]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Os(t){let e,n;return e=new Gn({props:{type:"whirlpool/positionbundle",address:t[2].derived.positionBundle}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.positionBundle),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ds(t){let e,n=t[2].derived.isFullRange+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isFullRange+"")&&B(e,n)},d(t){t&&k(e)}}}function Cs(t){let e,n,r,i=t[2].derived.priceLower+"",o=oa(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.priceLower+"")&&B(e,i),2&n&&o!==(o=oa(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Ns(t){let e,n,r,i=t[2].derived.priceUpper+"",o=oa(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.priceUpper+"")&&B(e,i),2&n&&o!==(o=oa(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function zs(t){let e,n,r,i=t[2].derived.invertedPriceLower+"",o=oa(t[2].derived.tokenInfoB,t[2].derived.tokenInfoA)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.invertedPriceLower+"")&&B(e,i),2&n&&o!==(o=oa(t[2].derived.tokenInfoB,t[2].derived.tokenInfoA)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Us(t){let e,n,r,i=t[2].derived.invertedPriceUpper+"",o=oa(t[2].derived.tokenInfoB,t[2].derived.tokenInfoA)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.invertedPriceUpper+"")&&B(e,i),2&n&&o!==(o=oa(t[2].derived.tokenInfoB,t[2].derived.tokenInfoA)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function js(t){let e,n,r,i=t[2].derived.amountA+"",o=ia(t[2].derived.tokenInfoA,!0)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.amountA+"")&&B(e,i),2&n&&o!==(o=ia(t[2].derived.tokenInfoA,!0)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Ys(t){let e,n,r,i=t[2].derived.amountB+"",o=ia(t[2].derived.tokenInfoB,!0)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.amountB+"")&&B(e,i),2&n&&o!==(o=ia(t[2].derived.tokenInfoB,!0)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Fs(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T,L,R,O,D,C,N,z,U,j,Y,F,W,H,K,q,V=ia(t[2].derived.tokenInfoA)+"",G=t[2].derived.feeAmountA+"",Z=ia(t[2].derived.tokenInfoB)+"",X=t[2].derived.feeAmountB+"",J=ia(t[2].derived.tokenInfoR0)+"",Q=t[2].derived.rewardAmount0+"",tt=ia(t[2].derived.tokenInfoR1)+"",et=t[2].derived.rewardAmount1+"",nt=ia(t[2].derived.tokenInfoR2)+"",rt=t[2].derived.rewardAmount2+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokenamount',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("fee A"),u=S(V),c=A("td"),d=S(G),l=I(),h=A("tr"),f=A("td"),p=S("fee B"),m=S(Z),g=A("td"),y=S(X),b=I(),w=A("tr"),M=A("td"),x=S("reward0"),E=S(J),T=A("td"),L=S(Q),R=I(),O=A("tr"),D=A("td"),C=S("reward1"),N=S(tt),z=A("td"),U=S(et),j=I(),Y=A("tr"),F=A("td"),W=S("reward2"),H=S(nt),K=A("td"),q=S(rt),P(s,"class","svelte-6eiq7d"),P(c,"class","svelte-6eiq7d"),P(f,"class","svelte-6eiq7d"),P(g,"class","svelte-6eiq7d"),P(M,"class","svelte-6eiq7d"),P(T,"class","svelte-6eiq7d"),P(D,"class","svelte-6eiq7d"),P(z,"class","svelte-6eiq7d"),P(F,"class","svelte-6eiq7d"),P(K,"class","svelte-6eiq7d"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y),_(i,b),_(i,w),_(w,M),_(M,x),_(M,E),_(w,T),_(T,L),_(i,R),_(i,O),_(O,D),_(D,C),_(D,N),_(O,z),_(z,U),_(i,j),_(i,Y),_(Y,F),_(F,W),_(F,H),_(Y,K),_(K,q)},p(t,e){2&e&&V!==(V=ia(t[2].derived.tokenInfoA)+"")&&B(u,V),2&e&&G!==(G=t[2].derived.feeAmountA+"")&&B(d,G),2&e&&Z!==(Z=ia(t[2].derived.tokenInfoB)+"")&&B(m,Z),2&e&&X!==(X=t[2].derived.feeAmountB+"")&&B(y,X),2&e&&J!==(J=ia(t[2].derived.tokenInfoR0)+"")&&B(E,J),2&e&&Q!==(Q=t[2].derived.rewardAmount0+"")&&B(L,Q),2&e&&tt!==(tt=ia(t[2].derived.tokenInfoR1)+"")&&B(N,tt),2&e&&et!==(et=t[2].derived.rewardAmount1+"")&&B(U,et),2&e&&nt!==(nt=ia(t[2].derived.tokenInfoR2)+"")&&B(H,nt),2&e&&rt!==(rt=t[2].derived.rewardAmount2+"")&&B(q,rt)},d(t){t&&k(e)}}}function Ws(t){let e,n=t[2].derived.poolLiquidity+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.poolLiquidity+"")&&B(e,n)},d(t){t&&k(e)}}}function Hs(t){let e,n=t[2].derived.tickCurrentIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.tickCurrentIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function Ks(t){let e,n=t[2].derived.currentPrice+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.currentPrice+"")&&B(e,n)},d(t){t&&k(e)}}}function qs(t){let e,n,r=t[2].derived.positionMintSupply+"",i=0===t[2].derived.positionMintSupply?" (burnt)":"";return{c(){e=S(r),n=S(i)},m(t,r){v(t,e,r),v(t,n,r)},p(t,o){2&o&&r!==(r=t[2].derived.positionMintSupply+"")&&B(e,r),2&o&&i!==(i=0===t[2].derived.positionMintSupply?" (burnt)":"")&&B(n,i)},d(t){t&&k(e),t&&k(n)}}}function Vs(t){let e,n=t[2].derived.status+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.status+"")&&B(e,n)},d(t){t&&k(e)}}}function Gs(t){let e,n,r=t[2].derived.sharePercentOfLiquidity+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.sharePercentOfLiquidity+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function Zs(t){let e,n;return e=new Gn({props:{type:"whirlpool/tickarray",address:t[2].derived.lowerTickArray}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.lowerTickArray),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Xs(t){let e,n;return e=new Gn({props:{type:"whirlpool/tickarray",address:t[2].derived.upperTickArray}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.upperTickArray),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Js(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,x,E,T,P,B,L,$,R,O,D,C,N;e=new vt({props:{name:"is bundled position",$$slots:{default:[$s]},$$scope:{ctx:t}}});let z=t[2].derived.isBundledPosition&&Rs(t);return i=new vt({props:{name:"is full range",$$slots:{default:[Ds]},$$scope:{ctx:t}}}),s=new vt({props:{name:"lower price",$$slots:{default:[Cs]},$$scope:{ctx:t}}}),u=new vt({props:{name:"upper price",$$slots:{default:[Ns]},$$scope:{ctx:t}}}),d=new vt({props:{name:"inverted lower price",$$slots:{default:[zs]},$$scope:{ctx:t}}}),h=new vt({props:{name:"inverted upper price",$$slots:{default:[Us]},$$scope:{ctx:t}}}),p=new vt({props:{name:"token A amount",$$slots:{default:[js]},$$scope:{ctx:t}}}),g=new vt({props:{name:"token B amount",$$slots:{default:[Ys]},$$scope:{ctx:t}}}),b=new vt({props:{name:"harvestable amount",$$slots:{default:[Fs]},$$scope:{ctx:t}}}),_=new vt({props:{name:"pool liquidity",$$slots:{default:[Ws]},$$scope:{ctx:t}}}),A=new vt({props:{name:"current tick index",$$slots:{default:[Hs]},$$scope:{ctx:t}}}),x=new vt({props:{name:"current price",$$slots:{default:[Ks]},$$scope:{ctx:t}}}),T=new vt({props:{name:"position mint supply",$$slots:{default:[qs]},$$scope:{ctx:t}}}),B=new vt({props:{name:"position status",$$slots:{default:[Vs]},$$scope:{ctx:t}}}),$=new vt({props:{name:"share of liquidity",$$slots:{default:[Gs]},$$scope:{ctx:t}}}),O=new vt({props:{name:"lower tick array",$$slots:{default:[Zs]},$$scope:{ctx:t}}}),C=new vt({props:{name:"upper tick array",$$slots:{default:[Xs]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),z&&z.c(),r=I(),ht(i.$$.fragment),o=I(),ht(s.$$.fragment),a=I(),ht(u.$$.fragment),c=I(),ht(d.$$.fragment),l=I(),ht(h.$$.fragment),f=I(),ht(p.$$.fragment),m=I(),ht(g.$$.fragment),y=I(),ht(b.$$.fragment),w=I(),ht(_.$$.fragment),M=I(),ht(A.$$.fragment),S=I(),ht(x.$$.fragment),E=I(),ht(T.$$.fragment),P=I(),ht(B.$$.fragment),L=I(),ht($.$$.fragment),R=I(),ht(O.$$.fragment),D=I(),ht(C.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),z&&z.m(t,k),v(t,r,k),ft(i,t,k),v(t,o,k),ft(s,t,k),v(t,a,k),ft(u,t,k),v(t,c,k),ft(d,t,k),v(t,l,k),ft(h,t,k),v(t,f,k),ft(p,t,k),v(t,m,k),ft(g,t,k),v(t,y,k),ft(b,t,k),v(t,w,k),ft(_,t,k),v(t,M,k),ft(A,t,k),v(t,S,k),ft(x,t,k),v(t,E,k),ft(T,t,k),v(t,P,k),ft(B,t,k),v(t,L,k),ft($,t,k),v(t,R,k),ft(O,t,k),v(t,D,k),ft(C,t,k),N=!0},p(t,n){const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),e.$set(o),t[2].derived.isBundledPosition?z?(z.p(t,n),2&n&&ot(z,1)):(z=Rs(t),z.c(),ot(z,1),z.m(r.parentNode,r)):z&&(rt(),st(z,1,1,(()=>{z=null})),it());const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),i.$set(a);const c={};10&n&&(c.$$scope={dirty:n,ctx:t}),s.$set(c);const l={};10&n&&(l.$$scope={dirty:n,ctx:t}),u.$set(l);const f={};10&n&&(f.$$scope={dirty:n,ctx:t}),d.$set(f);const m={};10&n&&(m.$$scope={dirty:n,ctx:t}),h.$set(m);const y={};10&n&&(y.$$scope={dirty:n,ctx:t}),p.$set(y);const w={};10&n&&(w.$$scope={dirty:n,ctx:t}),g.$set(w);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),b.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),_.$set(k);const M={};10&n&&(M.$$scope={dirty:n,ctx:t}),A.$set(M);const S={};10&n&&(S.$$scope={dirty:n,ctx:t}),x.$set(S);const I={};10&n&&(I.$$scope={dirty:n,ctx:t}),T.$set(I);const E={};10&n&&(E.$$scope={dirty:n,ctx:t}),B.$set(E);const P={};10&n&&(P.$$scope={dirty:n,ctx:t}),$.$set(P);const L={};10&n&&(L.$$scope={dirty:n,ctx:t}),O.$set(L);const R={};10&n&&(R.$$scope={dirty:n,ctx:t}),C.$set(R)},i(t){N||(ot(e.$$.fragment,t),ot(z),ot(i.$$.fragment,t),ot(s.$$.fragment,t),ot(u.$$.fragment,t),ot(d.$$.fragment,t),ot(h.$$.fragment,t),ot(p.$$.fragment,t),ot(g.$$.fragment,t),ot(b.$$.fragment,t),ot(_.$$.fragment,t),ot(A.$$.fragment,t),ot(x.$$.fragment,t),ot(T.$$.fragment,t),ot(B.$$.fragment,t),ot($.$$.fragment,t),ot(O.$$.fragment,t),ot(C.$$.fragment,t),N=!0)},o(t){st(e.$$.fragment,t),st(z),st(i.$$.fragment,t),st(s.$$.fragment,t),st(u.$$.fragment,t),st(d.$$.fragment,t),st(h.$$.fragment,t),st(p.$$.fragment,t),st(g.$$.fragment,t),st(b.$$.fragment,t),st(_.$$.fragment,t),st(A.$$.fragment,t),st(x.$$.fragment,t),st(T.$$.fragment,t),st(B.$$.fragment,t),st($.$$.fragment,t),st(O.$$.fragment,t),st(C.$$.fragment,t),N=!1},d(t){pt(e,t),t&&k(n),z&&z.d(t),t&&k(r),pt(i,t),t&&k(o),pt(s,t),t&&k(a),pt(u,t),t&&k(c),pt(d,t),t&&k(l),pt(h,t),t&&k(f),pt(p,t),t&&k(m),pt(g,t),t&&k(y),pt(b,t),t&&k(w),pt(_,t),t&&k(M),pt(A,t),t&&k(S),pt(x,t),t&&k(E),pt(T,t),t&&k(P),pt(B,t),t&&k(L),pt($,t),t&&k(R),pt(O,t),t&&k(D),pt(C,t)}}}function Qs(t){let e,n;return e=new ls({props:{positionInfo:t[2]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.positionInfo=t[2]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ta(t){let e,n;return e=new vt({props:{name:"simulation",$$slots:{default:[Qs]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ea(t){let e,n,r,i,o,s;return e=new yr({props:{$$slots:{default:[Ls]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Js]},$$scope:{ctx:t}}}),o=new oi({props:{$$slots:{default:[ta]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function na(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function ra(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/src/state/position.rs#L20"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:na,then:fs,catch:hs,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🌀Whirlpool::Position "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function ia(t,e=!1){return void 0===t?"":e?t.symbol:`(${t.symbol})`}function oa(t,e){return void 0===t||void 0===e?"":`${e.symbol}/${t.symbol}`}function sa(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){var e,n,r,i,o,s;const a=bn.AddressUtil.toPubKey(t),u=It(),c=(0,jr.buildDefaultAccountFetcher)(u),{accountInfo:d,slotContext:l}=await Zn(u,a),h=jr.ParsablePosition.parse(a,d),f=await c.getPool(h.whirlpool,jr.IGNORE_CACHE),p=Yr.PositionUtil.getPositionStatus(f.tickCurrentIndex,h.tickLowerIndex,h.tickUpperIndex);let m=new fn(0);p!==Yr.PositionStatus.InRange||h.liquidity.isZero()||(m=Jn(new fn(h.liquidity.toString()).div(f.liquidity.toString()).mul(100),9));const g=[];g.push(f.tokenMintA),g.push(f.tokenMintB),g.push(f.rewardInfos[0].mint),g.push(f.rewardInfos[1].mint),g.push(f.rewardInfos[2].mint),g.push(h.positionMint);const y=await c.getMintInfos(g,jr.IGNORE_CACHE),b=y.get(g[0].toBase58()).decimals,w=y.get(g[1].toBase58()).decimals,_=null===(e=y.get(g[2].toBase58()))||void 0===e?void 0:e.decimals,v=null===(n=y.get(g[3].toBase58()))||void 0===n?void 0:n.decimals,k=null===(r=y.get(g[4].toBase58()))||void 0===r?void 0:r.decimals,M=Zr(y.get(g[0].toBase58()).tokenProgram),A=Zr(y.get(g[1].toBase58()).tokenProgram),S=Zr(null===(i=y.get(g[2].toBase58()))||void 0===i?void 0:i.tokenProgram),I=Zr(null===(o=y.get(g[3].toBase58()))||void 0===o?void 0:o.tokenProgram),x=Zr(null===(s=y.get(g[4].toBase58()))||void 0===s?void 0:s.tokenProgram),E=Number(y.get(g[5].toBase58()).supply.toString()),T=Jn(jr.PriceMath.tickIndexToPrice(h.tickLowerIndex,b,w),w),P=Jn(jr.PriceMath.tickIndexToPrice(h.tickUpperIndex,b,w),w),B=Jn(new fn(1).div(jr.PriceMath.tickIndexToPrice(h.tickUpperIndex,b,w)),b),L=Jn(new fn(1).div(jr.PriceMath.tickIndexToPrice(h.tickLowerIndex,b,w)),b),$=jr.PoolUtil.getTokenAmountsFromLiquidity(h.liquidity,f.sqrtPrice,jr.PriceMath.tickIndexToSqrtPriceX64(h.tickLowerIndex),jr.PriceMath.tickIndexToSqrtPriceX64(h.tickUpperIndex),!1),R=[];R.push(jr.PDAUtil.getTickArray(d.owner,h.whirlpool,jr.TickUtil.getStartTickIndex(h.tickLowerIndex,f.tickSpacing)).publicKey),R.push(jr.PDAUtil.getTickArray(d.owner,h.whirlpool,jr.TickUtil.getStartTickIndex(h.tickUpperIndex,f.tickSpacing)).publicKey);const O=await c.getTickArrays(R,jr.IGNORE_CACHE),D=jr.TickArrayUtil.getTickFromArray(O[0],h.tickLowerIndex,f.tickSpacing),C=jr.TickArrayUtil.getTickFromArray(O[1],h.tickUpperIndex,f.tickSpacing),N=await Wr.TokenExtensionUtil.buildTokenExtensionContext(c,f,jr.IGNORE_CACHE),z=(0,jr.collectFeesQuote)({position:h,tickLower:D,tickUpper:C,whirlpool:f,tokenExtensionCtx:N}),U=(0,jr.collectRewardsQuote)({position:h,tickLower:D,tickUpper:C,whirlpool:f,tokenExtensionCtx:N}),j=await Rn(),Y=j.getTokenInfoByMint(g[0]),F=j.getTokenInfoByMint(g[1]),W=j.getTokenInfoByMint(g[2]),H=j.getTokenInfoByMint(g[3]),K=j.getTokenInfoByMint(g[4]),q=jr.PDAUtil.getPosition(d.owner,h.positionMint).publicKey,V=jr.PDAUtil.getPositionBundle(d.owner,h.positionMint).publicKey,G=!q.equals(a),Z=Math.ceil(jr.MIN_TICK_INDEX/f.tickSpacing)*f.tickSpacing,X=Math.floor(jr.MAX_TICK_INDEX/f.tickSpacing)*f.tickSpacing,J=h.tickLowerIndex===Z&&h.tickUpperIndex===X;return{meta:Xn(a,d,l),parsed:h,derived:{priceLower:T,priceUpper:P,invertedPriceLower:B,invertedPriceUpper:L,amounts:$,amountA:bn.DecimalUtil.fromBN($.tokenA,b),amountB:bn.DecimalUtil.fromBN($.tokenB,w),decimalsA:b,decimalsB:w,decimalsR0:_,decimalsR1:v,decimalsR2:k,tokenProgramA:M,tokenProgramB:A,tokenProgramR0:S,tokenProgramR1:I,tokenProgramR2:x,tokenMintA:f.tokenMintA,tokenMintB:f.tokenMintB,tokenMintR0:f.rewardInfos[0].mint,tokenMintR1:f.rewardInfos[1].mint,tokenMintR2:f.rewardInfos[2].mint,tokenInfoA:Y,tokenInfoB:F,tokenInfoR0:W,tokenInfoR1:H,tokenInfoR2:K,feeQuote:z,feeAmountA:bn.DecimalUtil.fromBN(z.feeOwedA,b),feeAmountB:bn.DecimalUtil.fromBN(z.feeOwedB,w),rewardsQuote:U,rewardAmount0:void 0===U[0]?void 0:bn.DecimalUtil.fromBN(U[0],_),rewardAmount1:void 0===U[1]?void 0:bn.DecimalUtil.fromBN(U[1],v),rewardAmount2:void 0===U[2]?void 0:bn.DecimalUtil.fromBN(U[2],k),status:p===Yr.PositionStatus.InRange?Xr.PriceIsInRange:p===Yr.PositionStatus.AboveRange?Xr.PriceIsAboveRange:Xr.PriceIsBelowRange,sharePercentOfLiquidity:m,tickCurrentIndex:f.tickCurrentIndex,currentSqrtPrice:f.sqrtPrice,currentPrice:Jn(jr.PriceMath.sqrtPriceX64ToPrice(f.sqrtPrice,b,w),w),poolLiquidity:f.liquidity,poolTickSpacing:f.tickSpacing,lowerTickArray:R[0],upperTickArray:R[1],isBundledPosition:G,isFullRange:J,positionBundle:G?V:void 0,positionMintSupply:E}}}(i.pubkey))},[i,r]}function aa(t,e,n){const r=t.slice();return r[3]=e[n],r}function ua(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function ca(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/config",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[_a]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};66&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function da(t){let e,n;return e=new Gn({props:{address:t[2].parsed.feeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.feeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function la(t){let e,n;return e=new Gn({props:{address:t[2].parsed.collectProtocolFeesAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.collectProtocolFeesAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ha(t){let e,n;return e=new Gn({props:{address:t[2].parsed.rewardEmissionsSuperAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.rewardEmissionsSuperAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function fa(t){let e,n=t[2].parsed.defaultProtocolFeeRate+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.defaultProtocolFeeRate+"")&&B(e,n)},d(t){t&&k(e)}}}function pa(t){let e,n,r,i,o,s,a,u;return e=new vt({props:{name:"feeAuthority",type:"PublicKey",offset:"8",$$slots:{default:[da]},$$scope:{ctx:t}}}),r=new vt({props:{name:"collectProtocolFeesAuthority",type:"PublicKey",offset:"40",$$slots:{default:[la]},$$scope:{ctx:t}}}),o=new vt({props:{name:"rewardEmissionsSuperAuthority",type:"PublicKey",offset:"72",$$slots:{default:[ha]},$$scope:{ctx:t}}}),a=new vt({props:{name:"defaultProtocolFeeRate",type:"u16",offset:"104",$$slots:{default:[fa]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment)},m(t,c){ft(e,t,c),v(t,n,c),ft(r,t,c),v(t,i,c),ft(o,t,c),v(t,s,c),ft(a,t,c),u=!0},p(t,n){const i={};66&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};66&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};66&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const c={};66&n&&(c.$$scope={dirty:n,ctx:t}),a.$set(c)},i(t){u||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),u=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),u=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t)}}}function ma(t){let e,n,r=t[2].derived.defaultProtocolFeeRate+"";return{c(){e=S(r),n=S(" % of fee")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.defaultProtocolFeeRate+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function ga(t){let e,n;return e=new Gn({props:{type:"whirlpool/configextension",address:t[2].derived.configExtension}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.configExtension),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ya(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,g,y=t[3].tickSpacing+"",b=t[3].isInitialized+"",w=(void 0===t[3].defaultFeeRate?void 0:t[3].defaultFeeRate+" %")+"";return h=new Gn({props:{type:"whirlpool/feetier",address:t[3].pubkey,short:!0}}),{c(){e=A("tr"),n=A("td"),r=S(y),i=I(),o=A("td"),s=S(b),a=I(),u=A("td"),c=S(w),d=I(),l=A("td"),ht(h.$$.fragment),f=I(),P(n,"class","svelte-v6w8v6"),P(o,"class","svelte-v6w8v6"),P(u,"class","svelte-v6w8v6"),P(l,"class","svelte-v6w8v6"),P(e,"class",p=m(t[3].isInitialized?"initialized":"uninitialized")+" svelte-v6w8v6")},m(t,p){v(t,e,p),_(e,n),_(n,r),_(e,i),_(e,o),_(o,s),_(e,a),_(e,u),_(u,c),_(e,d),_(e,l),ft(h,l,null),_(e,f),g=!0},p(t,n){(!g||2&n)&&y!==(y=t[3].tickSpacing+"")&&B(r,y),(!g||2&n)&&b!==(b=t[3].isInitialized+"")&&B(s,b),(!g||2&n)&&w!==(w=(void 0===t[3].defaultFeeRate?void 0:t[3].defaultFeeRate+" %")+"")&&B(c,w);const i={};2&n&&(i.address=t[3].pubkey),h.$set(i),(!g||2&n&&p!==(p=m(t[3].isInitialized?"initialized":"uninitialized")+" svelte-v6w8v6"))&&P(e,"class",p)},i(t){g||(ot(h.$$.fragment,t),g=!0)},o(t){st(h.$$.fragment,t),g=!1},d(t){t&&k(e),pt(h)}}}function ba(t){let e,n,r,i,o,s=t[2].derived.feeTiers,a=[];for(let e=0;est(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='tick spacinginitializeddefault fee ratepubkey',r=I(),i=A("tbody");for(let t=0;to.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Ma(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=jr.ParsableWhirlpoolsConfig.parse(e,r),s=[];for(let t=1;t<65536;t*=2)s.push(jr.PDAUtil.getFeeTier(r.owner,e,t).publicKey);const a=await n.getMultipleAccountsInfo(s),u=[];a.forEach(((t,e)=>{const n=jr.ParsableFeeTier.parse(s[e],t);u.push({pubkey:s[e],tickSpacing:2**e,isInitialized:null!==n,defaultFeeRate:null===n?void 0:jr.PoolUtil.getFeeRate(n.defaultFeeRate).toDecimal().mul(100)})}));const c=jr.PDAUtil.getConfigExtension(r.owner,e).publicKey;return{meta:Xn(e,r,i),parsed:o,derived:{defaultProtocolFeeRate:jr.PoolUtil.getProtocolFeeRate(o.defaultProtocolFeeRate).toDecimal().mul(100),configExtension:c,feeTiers:u}}}(i.pubkey))},[i,r]}function Aa(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Sa(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/configextension",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Pa]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ia(t){let e,n;return e=new Gn({props:{type:"whirlpool/config",address:t[2].parsed.whirlpoolsConfig}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpoolsConfig),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function xa(t){let e,n;return e=new Gn({props:{address:t[2].parsed.configExtensionAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.configExtensionAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ea(t){let e,n;return e=new Gn({props:{address:t[2].parsed.tokenBadgeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.tokenBadgeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ta(t){let e,n,r,i,o,s;return e=new vt({props:{name:"whirlpoolsConfig",type:"PublicKey",offset:"8",$$slots:{default:[Ia]},$$scope:{ctx:t}}}),r=new vt({props:{name:"configExtensionAuthority",type:"PublicKey",offset:"40",$$slots:{default:[xa]},$$scope:{ctx:t}}}),o=new vt({props:{name:"tokenBadgeAuthority",type:"PublicKey",offset:"72",$$slots:{default:[Ea]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function Pa(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Ta]},$$scope:{ctx:t}}}),r=new _r({}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ba(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function La(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/src/state/config_extension.rs#L11"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Ba,then:Sa,catch:Aa,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🌀Whirlpool::WhirlpoolsConfigExtension "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function $a(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=jr.ParsableWhirlpoolsConfigExtension.parse(e,r);return{meta:Xn(e,r,i),parsed:o,derived:{}}}(i.pubkey))},[i,r]}function Ra(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Oa(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/tokenbadge",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[za]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Da(t){let e,n;return e=new Gn({props:{type:"whirlpool/config",address:t[2].parsed.whirlpoolsConfig}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpoolsConfig),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ca(t){let e,n;return e=new Li({props:{type:"token/mint",address:t[2].parsed.tokenMint,program:t[2].derived.tokenProgram}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.tokenMint),2&n&&(r.program=t[2].derived.tokenProgram),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Na(t){let e,n,r,i;return e=new vt({props:{name:"whirlpoolsConfig",type:"PublicKey",offset:"8",$$slots:{default:[Da]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tokenMint",type:"PublicKey",offset:"40",$$slots:{default:[Ca]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function za(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Na]},$$scope:{ctx:t}}}),r=new _r({}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ua(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function ja(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/src/state/token_badge.rs#L5"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Ua,then:Oa,catch:Ra,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🌀Whirlpool::TokenBadge "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Ya(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=jr.ParsableTokenBadge.parse(e,i),a=await r.getMintInfo(s.tokenMint,jr.IGNORE_CACHE);return{meta:Xn(e,i,o),parsed:s,derived:{tokenProgram:Zr(a.tokenProgram)}}}(i.pubkey))},[i,r]}function Fa(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Wa(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/feetier",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Xa]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ha(t){let e,n;return e=new Gn({props:{type:"whirlpool/config",address:t[2].parsed.whirlpoolsConfig}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpoolsConfig),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ka(t){let e,n=t[2].parsed.tickSpacing+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.tickSpacing+"")&&B(e,n)},d(t){t&&k(e)}}}function qa(t){let e,n=t[2].parsed.defaultFeeRate+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.defaultFeeRate+"")&&B(e,n)},d(t){t&&k(e)}}}function Va(t){let e,n,r,i,o,s;return e=new vt({props:{name:"whirlpoolsConfig",type:"PublicKey",offset:"8",$$slots:{default:[Ha]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tickSpacing",type:"u16",offset:"40",$$slots:{default:[Ka]},$$scope:{ctx:t}}}),o=new vt({props:{name:"defaultFeeRate",type:"u16",offset:"42",$$slots:{default:[qa]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function Ga(t){let e,n,r=t[2].derived.defaultFeeRate+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.defaultFeeRate+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function Za(t){let e,n;return e=new vt({props:{name:"default fee rate",$$slots:{default:[Ga]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Xa(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Va]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Za]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ja(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Qa(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/src/state/fee_tier.rs#L12"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Ja,then:Wa,catch:Fa,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🌀Whirlpool::FeeTier "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function tu(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=jr.ParsableFeeTier.parse(e,r);return{meta:Xn(e,r,i),parsed:o,derived:{defaultFeeRate:jr.PoolUtil.getFeeRate(o.defaultFeeRate).toDecimal().mul(100)}}}(i.pubkey))},[i,r]}function eu(t,e,n){const r=t.slice();return r[3]=e[n],r[5]=n,r}function nu(t,e,n){const r=t.slice();return r[3]=e[n],r[5]=n,r}function ru(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function iu(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/tickarray",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[_u]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};130&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function ou(t){let e,n;return e=new Gn({props:{type:"whirlpool/whirlpool",address:t[2].parsed.whirlpool}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.whirlpool),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function su(t){let e,n=t[2].parsed.startTickIndex+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.startTickIndex+"")&&B(e,n)},d(t){t&&k(e)}}}function au(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p=t[2].parsed.startTickIndex+t[5]*t[2].derived.tickSpacing+"",g=t[3].initialized+"",y=t[3].liquidityNet+"";return{c(){e=A("tr"),n=A("td"),r=S(t[5]),i=I(),o=A("td"),s=S(p),a=I(),u=A("td"),c=S(g),d=I(),l=A("td"),h=S(y),P(n,"class","svelte-v6w8v6"),P(o,"class","svelte-v6w8v6"),P(u,"class","svelte-v6w8v6"),P(l,"class","svelte-v6w8v6"),P(e,"class",f=m(t[3].initialized?"initialized":"uninitialized")+" svelte-v6w8v6")},m(t,f){v(t,e,f),_(e,n),_(n,r),_(e,i),_(e,o),_(o,s),_(e,a),_(e,u),_(u,c),_(e,d),_(e,l),_(l,h)},p(t,n){2&n&&p!==(p=t[2].parsed.startTickIndex+t[5]*t[2].derived.tickSpacing+"")&&B(s,p),2&n&&g!==(g=t[3].initialized+"")&&B(c,g),2&n&&y!==(y=t[3].liquidityNet+"")&&B(h,y),2&n&&f!==(f=m(t[3].initialized?"initialized":"uninitialized")+" svelte-v6w8v6")&&P(e,"class",f)},d(t){t&&k(e)}}}function uu(t){let e,n,r,i,o,s,a,u,c=t[2].parsed.ticks,d=[];for(let e=0;eoffsettick indexinitializedliquidity net',r=I(),i=A("tbody"),o=A("tr"),o.innerHTML='A to B direction (price down)',s=I();for(let t=0;tB to A direction (price up)',$(e,"border-spacing","0")},m(t,c){v(t,e,c),_(e,n),_(e,r),_(e,i),_(i,o),_(i,s);for(let t=0;t{r=null})),it())},i(t){n||(ot(r),n=!0)},o(t){st(r),n=!1},d(t){r&&r.d(t),t&&k(e)}}}function hu(t){let e,n,r=t[2].parsed.ticks,i=[];for(let e=0;est(i[t],1,1,(()=>{i[t]=null}));return{c(){for(let t=0;to.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Mu(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=jr.ParsableTickArray.parse(e,i),a=await r.getPool(s.whirlpool,jr.IGNORE_CACHE),u=a.tickSpacing*jr.TICK_ARRAY_SIZE,c=jr.PDAUtil.getTickArray(i.owner,s.whirlpool,s.startTickIndex-u).publicKey,d=jr.PDAUtil.getTickArray(i.owner,s.whirlpool,s.startTickIndex+u).publicKey;return{meta:Xn(e,i,o),parsed:s,derived:{prevTickArray:c,nextTickArray:d,tickCurrentIndex:a.tickCurrentIndex,tickSpacing:a.tickSpacing,ticksInArray:u}}}(i.pubkey))},[i,r]}function Au(t,e,n){const r=t.slice();return r[4]=e[n],r}function Su(t,e,n){const r=t.slice();return r[7]=e[n],r[9]=n,r}function Iu(t,e,n){const r=t.slice();return r[10]=e[n],r}function xu(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Eu(t){let e,n,r,i;return e=new pr({props:{accountType:"whirlpool/tickarray",meta:t[3].meta}}),r=new Mr({props:{$$slots:{default:[zu]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[3].meta),e.$set(i);const o={};8194&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Tu(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[3].parsed.positionBundleMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[3].parsed.positionBundleMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Pu(t){let e,n,r=(t[10]?1:0)+"";return{c(){e=A("td"),n=S(r),P(e,"class","svelte-1i4wn2p")},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=(t[10]?1:0)+"")&&B(n,r)},d(t){t&&k(e)}}}function Bu(t){let e,n,r,i,o;function s(...e){return t[2](t[7],...e)}let a=[0,1,2,3,4,5,6,7].map(s),u=[];for(let e=0;eindex01234567',r=I(),i=A("tbody");for(let t=0;tst(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='indexpositionwhirlpooltickLowerIndextickUpperIndexliquidity',r=I(),i=A("tbody");for(let t=0;to.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Yu(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=jr.ParsablePositionBundle.parse(e,i),a=await r.getMintInfo(s.positionBundleMint,jr.IGNORE_CACHE),u=Number(a.supply.toString()),c=jr.PositionBundleUtil.getOccupiedBundleIndexes(s),d=c.map((t=>jr.PDAUtil.getBundledPosition(i.owner,s.positionBundleMint,t).publicKey)),l=await r.getPositions(d,jr.IGNORE_CACHE),h=d.map((t=>l.get(t.toBase58()))),f=[];for(let t=0;t(t&1<0]}function Fu(t,e,n){const r=t.slice();return r[12]=e[n],r}function Wu(e){return{c:t,m:t,p:t,d:t}}function Hu(t){let e,n,r,i,o=t[11],s=[];for(let e=0;enamemintAmintBtickSpacingprice$TVLday $volume',r=I(),i=A("tbody");for(let t=0;tlt(f,"selected",S)));let R={ctx:t,current:null,token:null,hasCatch:!1,pending:qu,then:Hu,catch:Wu,value:11};return at(y=t[2],R),{c(){e=A("h2"),e.textContent="🌀Whirlpool::list",n=I(),r=A("form"),i=A("input"),s=I(),a=A("input"),u=I(),c=A("div"),d=A("div"),d.textContent="order by",l=I(),h=A("div"),ht(f.$$.fragment),m=I(),g=x(),R.block.c(),$(i,"margin","0.5em 0em"),P(i,"type","text"),P(i,"size","64"),P(i,"placeholder","SOL/USDC or orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE"),P(a,"type","submit"),a.value="Set Filter!",$(r,"margin-bottom","0em"),$(c,"margin-top","0.5em"),$(c,"margin-left","0em"),$(c,"margin-bottom","1.0em"),$(c,"font-size","smaller"),$(c,"display","flex"),$(c,"flex-direction","row")},m(o,p){v(o,e,p),v(o,n,p),v(o,r,p),_(r,i),L(i,t[1]),_(r,s),_(r,a),v(o,u,p),v(o,c,p),_(c,d),_(c,l),_(c,h),ft(f,h,null),v(o,m,p),v(o,g,p),R.block.m(o,R.anchor=p),R.mount=()=>g.parentNode,R.anchor=g,b=!0,w||(M=[E(i,"input",t[6]),E(r,"submit",T(t[4]))],w=!0)},p(e,[n]){t=e,2&n&&i.value!==t[1]&&L(i,t[1]);const r={};!p&&1&n&&(p=!0,r.selected=t[0],G((()=>p=!1))),f.$set(r),R.ctx=t,4&n&&y!==(y=t[2])&&at(y,R)||ut(R,t,n)},i(t){b||(ot(f.$$.fragment,t),b=!0)},o(t){st(f.$$.fragment,t),b=!1},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(u),t&&k(c),pt(f),t&&k(m),t&&k(g),R.block.d(t),R.token=null,R=null,w=!1,o(M)}}}function Gu(t,e,n){let r,i;var o;!function(t){t.volumeDesc="day $volume (desc)",t.volumeAsc="day $volume (asc)",t.tvlDesc="$TVL (desc)",t.tvlAsc="$TVL (asc)",t.nameAsc="name (asc)"}(o||(o={}));const s=Object.values(o);let a,u=s.indexOf(o.volumeDesc);return t.$$.update=()=>{33&t.$$.dirty&&n(2,i=async function(t,e){return(await async function(){const t=yn()();if(null!==Tn&&Pn.isAfter(t))return Tn;const e=await(await mn()("https://api.mainnet.orca.so/v1/whirlpool/list")).json(),n=[];return e.whirlpools.forEach((t=>{var e,r,i;const o=zn(t.tokenA.symbol,t.tokenA.mint),s=zn(t.tokenB.symbol,t.tokenB.mint);n.push({address:new Mt.PublicKey(t.address),name:`${o}/${s}(${t.tickSpacing})`,invertedName:`${s}/${o}(${t.tickSpacing})`,symbolA:o,symbolB:s,mintA:new Mt.PublicKey(t.tokenA.mint),mintB:new Mt.PublicKey(t.tokenB.mint),tickSpacing:t.tickSpacing,price:new fn(t.price),usdTVL:new fn(null!==(e=t.tvl)&&void 0!==e?e:0),usdVolumeDay:new fn(null!==(i=null===(r=t.volume)||void 0===r?void 0:r.day)&&void 0!==i?i:0)})})),Pn=t.add("15","m"),Tn=n,Tn}()).filter((e=>0==t.length||e.name.toUpperCase().indexOf(t.toUpperCase())>=0||e.invertedName.toUpperCase().indexOf(t.toUpperCase())>=0||e.mintA.toBase58().indexOf(t)>=0||e.mintB.toBase58().indexOf(t)>=0)).sort(e)}(r,function(t){switch(s[t]){case o.volumeDesc:return(t,e)=>e.usdVolumeDay.cmp(t.usdVolumeDay);case o.volumeAsc:return(t,e)=>t.usdVolumeDay.cmp(e.usdVolumeDay);case o.tvlDesc:return(t,e)=>e.usdTVL.cmp(t.usdTVL);case o.tvlAsc:return(t,e)=>t.usdTVL.cmp(e.usdTVL);case o.nameAsc:return En;default:return(t,e)=>0}}(u)))},n(5,r=""),[u,a,i,s,function(){n(5,r=a)},r,function(){a=this.value,n(1,a)},function(t){u=t,n(0,u)}]}function Zu(t,e,n){const r=t.slice();return r[20]=e[n],r}function Xu(e){let n,r=e[23].message+"";return{c(){n=S(r)},m(t,e){v(t,n,e)},p(t,e){32&e&&r!==(r=t[23].message+"")&&B(n,r)},i:t,o:t,d(t){t&&k(n)}}}function Ju(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,x,E,T,L,R,O,D,C,N,z,U,j,Y,F,W,H,K,q,V,G,Z,X,J,Q,tt,et,nt,at,ut,ct,dt,lt,mt,gt,yt,bt,wt,_t,vt,kt,Mt,At,St,It,xt,Et,Tt,Pt,Bt,Lt,$t,Rt,Ot,Dt,Ct,Nt,zt=t[19].positionSummary.numPositions+"",Ut=t[19].positionSummary.numZeroLiquidityPositions+"",jt=t[9](t[19].positionSummary.numZeroLiquidityPositions,t[19].positionSummary.numPositions)+"",Yt=t[19].positionSummary.numFullRangePositions+"",Ft=t[9](t[19].positionSummary.numFullRangePositions,t[19].positionSummary.numPositions)+"",Wt=t[19].positionSummary.numStatusPriceIsInRangePositions+"",Ht=t[9](t[19].positionSummary.numStatusPriceIsInRangePositions,t[19].positionSummary.numPositions)+"",Kt=t[19].positionSummary.numStatusPriceIsAboveRangePositions+"",qt=t[9](t[19].positionSummary.numStatusPriceIsAboveRangePositions,t[19].positionSummary.numPositions)+"",Vt=t[19].positionSummary.numStatusPriceIsBelowRangePositions+"",Gt=t[9](t[19].positionSummary.numStatusPriceIsBelowRangePositions,t[19].positionSummary.numPositions)+"",Zt=t[7][t[4]]===t[3].TickIndex?"tickLowerIndex":"lowerPrice",Xt=t[7][t[4]]===t[3].TickIndex?"tickUpperIndex":"upperPrice",Jt=nc(t[19].whirlpool.derived.tokenInfoA)+"",Qt=nc(t[19].whirlpool.derived.tokenInfoB)+"";i=new Gn({props:{type:"whirlpool/whirlpool",address:t[19].whirlpool.meta.pubkey}});let te=t[19].positions,ee=[];for(let e=0;est(ee[t],1,1,(()=>{ee[t]=null}));return{c(){e=A("h4"),e.textContent="whirlpool",n=I(),r=A("div"),ht(i.$$.fragment),o=I(),s=A("h4"),s.textContent="summary",a=I(),u=A("table"),c=A("tr"),d=A("td"),d.textContent="all positions",l=A("td"),h=S(zt),f=A("td"),p=I(),m=A("tr"),g=A("td"),g.textContent="0 liquidity",y=A("td"),b=S(Ut),w=A("td"),x=S(jt),E=I(),T=A("tr"),L=A("td"),L.textContent="full range",R=A("td"),O=S(Yt),D=A("td"),C=S(Ft),N=I(),z=A("tr"),U=A("td"),U.textContent="status: In Range",j=A("td"),Y=S(Wt),F=A("td"),W=S(Ht),H=I(),K=A("tr"),q=A("td"),q.textContent="status: Price is Above",V=A("td"),G=S(Kt),Z=A("td"),X=S(qt),J=I(),Q=A("tr"),tt=A("td"),tt.textContent="status: Price is Below",et=A("td"),nt=S(Vt),at=A("td"),ut=S(Gt),ct=I(),dt=A("h4"),dt.textContent="positions",lt=I(),mt=A("table"),gt=A("thead"),yt=A("th"),yt.textContent="position",bt=I(),wt=A("th"),wt.textContent="status",_t=I(),vt=A("th"),vt.textContent="liquidity",kt=I(),Mt=A("th"),At=S(Zt),St=I(),It=A("th"),xt=S(Xt),Et=I(),Tt=A("th"),Pt=S("tokenA"),Bt=S(Jt),Lt=I(),$t=A("th"),Rt=S("tokenB"),Ot=S(Qt),Dt=I(),Ct=A("tbody");for(let t=0;tlt(y,"selected",F)));let K={group:"orderBy",values:t[6]};void 0!==t[2]&&(K.selected=t[2]),R=new Ii({props:K}),j.push((()=>lt(R,"selected",H)));let q={ctx:t,current:null,token:null,hasCatch:!0,pending:tc,then:Ju,catch:Xu,value:19,error:23,blocks:[,,,]};return at(N=t[5],q),{c(){e=A("h2"),e.textContent="🌀Whirlpool::listPositions",n=I(),r=A("div"),i=A("div"),s=A("input"),a=S(" hide 0 liquidity positions"),u=I(),c=A("div"),d=A("input"),l=S(" hide Out of Range positions"),h=I(),f=A("div"),p=A("div"),p.textContent="display with",m=I(),g=A("div"),ht(y.$$.fragment),w=I(),M=A("div"),T=A("div"),T.textContent="order by",B=I(),L=A("div"),ht(R.$$.fragment),D=I(),C=x(),q.block.c(),P(s,"type","checkbox"),P(d,"type","checkbox"),$(f,"margin-top","0.5em"),$(f,"margin-left","0.2em"),$(f,"display","flex"),$(f,"flex-direction","row"),$(M,"margin-top","0.5em"),$(M,"margin-left","0.2em"),$(M,"display","flex"),$(M,"flex-direction","row"),$(r,"margin-bottom","1em"),$(r,"font-size","smaller")},m(o,b){v(o,e,b),v(o,n,b),v(o,r,b),_(r,i),_(i,s),s.checked=t[0],_(i,a),_(r,u),_(r,c),_(c,d),d.checked=t[1],_(c,l),_(r,h),_(r,f),_(f,p),_(f,m),_(f,g),ft(y,g,null),_(r,w),_(r,M),_(M,T),_(M,B),_(M,L),ft(R,L,null),v(o,D,b),v(o,C,b),q.block.m(o,q.anchor=b),q.mount=()=>C.parentNode,q.anchor=C,z=!0,U||(Y=[E(s,"change",t[12]),E(d,"change",t[13])],U=!0)},p(e,[n]){t=e,1&n&&(s.checked=t[0]),2&n&&(d.checked=t[1]);const r={};!b&&16&n&&(b=!0,r.selected=t[4],G((()=>b=!1))),y.$set(r);const i={};!O&&4&n&&(O=!0,i.selected=t[2],G((()=>O=!1))),R.$set(i),q.ctx=t,32&n&&N!==(N=t[5])&&at(N,q)||ut(q,t,n)},i(t){z||(ot(y.$$.fragment,t),ot(R.$$.fragment,t),ot(q.block),z=!0)},o(t){st(y.$$.fragment,t),st(R.$$.fragment,t);for(let t=0;t<3;t+=1)st(q.blocks[t]);z=!1},d(t){t&&k(e),t&&k(n),t&&k(r),pt(y),pt(R),t&&k(D),t&&k(C),q.block.d(t),q.token=null,q=null,U=!1,o(Y)}}}function nc(t,e=!1){return void 0===t?"":e?t.symbol:`(${t.symbol})`}function rc(t,e,n){let r,i,{params:o}=e,s=!1,a=!1;var u;!function(t){t.LiquidityDesc="liquidity (desc)",t.TickLowerIndexAsc="tickLowerIndex (asc)",t.TickUpperIndexDesc="tickUpperIndex (desc)",t.TokenADesc="tokenA (desc)",t.TokenBDesc="tokenB (desc)"}(u||(u={}));const c=Object.values(u);let d=c.indexOf(u.TickLowerIndexAsc);var l;!function(t){t.TickIndex="tickIndex",t.Price="price"}(l||(l={}));const h=Object.values(l);let f=h.indexOf(l.TickIndex);return t.$$set=t=>{"params"in t&&n(10,o=t.params)},t.$$.update=()=>{1024&t.$$.dirty&&n(11,r=async function(t){var e,n,r,i,o,s;const a=bn.AddressUtil.toPubKey(t),u=It(),c=(0,jr.buildDefaultAccountFetcher)(u),{accountInfo:d,slotContext:l}=await Zn(u,a),h=jr.ParsableWhirlpool.parse(a,d),f=d.owner,p=[];p.push(h.tokenMintA),p.push(h.tokenMintB),p.push(h.rewardInfos[0].mint),p.push(h.rewardInfos[1].mint),p.push(h.rewardInfos[2].mint);const m=await c.getMintInfos(p,jr.IGNORE_CACHE),g=m.get(p[0].toBase58()).decimals,y=m.get(p[1].toBase58()).decimals,b=null===(e=m.get(p[2].toBase58()))||void 0===e?void 0:e.decimals,w=null===(n=m.get(p[3].toBase58()))||void 0===n?void 0:n.decimals,_=null===(r=m.get(p[4].toBase58()))||void 0===r?void 0:r.decimals,v=Zr(m.get(p[0].toBase58()).tokenProgram),k=Zr(m.get(p[1].toBase58()).tokenProgram),M=Zr(null===(i=m.get(p[2].toBase58()))||void 0===i?void 0:i.tokenProgram),A=Zr(null===(o=m.get(p[3].toBase58()))||void 0===o?void 0:o.tokenProgram),S=Zr(null===(s=m.get(p[4].toBase58()))||void 0===s?void 0:s.tokenProgram),I=await Rn(),x=I.getTokenInfoByMint(p[0]),E=I.getTokenInfoByMint(p[1]),T=I.getTokenInfoByMint(p[2]),P=I.getTokenInfoByMint(p[3]),B=I.getTokenInfoByMint(p[4]),L={meta:Xn(a,d,l),parsed:h,derived:{decimalsA:g,decimalsB:y,decimalsR0:b,decimalsR1:w,decimalsR2:_,tokenProgramA:v,tokenProgramB:k,tokenProgramR0:M,tokenProgramR1:A,tokenProgramR2:S,tokenInfoA:x,tokenInfoB:E,tokenInfoR0:T,tokenInfoR1:P,tokenInfoR2:B}},$=[{dataSize:(0,jr.getAccountSize)(jr.AccountName.Position)},{memcmp:{offset:8,bytes:a.toBase58()}}],R=await u.getProgramAccounts(f,{commitment:"confirmed",encoding:"base64",withContext:!0,filters:$}),O=R.context.slot,D=R.value.map((t=>{const e=jr.ParsablePosition.parse(t.pubkey,t.account),n=Yr.PositionUtil.getPositionStatus(h.tickCurrentIndex,e.tickLowerIndex,e.tickUpperIndex),r=Jn(jr.PriceMath.tickIndexToPrice(e.tickLowerIndex,g,y),y),i=Jn(jr.PriceMath.tickIndexToPrice(e.tickUpperIndex,g,y),y),o=Jn(new fn(1).div(jr.PriceMath.tickIndexToPrice(e.tickUpperIndex,g,y)),g),s=Jn(new fn(1).div(jr.PriceMath.tickIndexToPrice(e.tickLowerIndex,g,y)),g),u=jr.PoolUtil.getTokenAmountsFromLiquidity(e.liquidity,h.sqrtPrice,jr.PriceMath.tickIndexToSqrtPriceX64(e.tickLowerIndex),jr.PriceMath.tickIndexToSqrtPriceX64(e.tickUpperIndex),!1),c=!jr.PDAUtil.getPosition(d.owner,e.positionMint).publicKey.equals(a),l=Math.ceil(jr.MIN_TICK_INDEX/h.tickSpacing)*h.tickSpacing,f=Math.floor(jr.MAX_TICK_INDEX/h.tickSpacing)*h.tickSpacing,p=e.tickLowerIndex===l&&e.tickUpperIndex===f;return{meta:Xn(t.pubkey,t.account,O),parsed:e,derived:{priceLower:r,priceUpper:i,invertedPriceLower:o,invertedPriceUpper:s,amounts:u,amountA:bn.DecimalUtil.fromBN(u.tokenA,g),amountB:bn.DecimalUtil.fromBN(u.tokenB,y),status:n===Yr.PositionStatus.InRange?Xr.PriceIsInRange:n===Yr.PositionStatus.AboveRange?Xr.PriceIsAboveRange:Xr.PriceIsBelowRange,isBundledPosition:c,isFullRange:p}}}));D.sort(Qr);const C=D.length,N=D.filter((t=>t.parsed.liquidity.isZero())).length,z=D.filter((t=>t.derived.isFullRange)).length,U=D.filter((t=>t.derived.status===Xr.PriceIsInRange)).length,j=D.filter((t=>t.derived.status===Xr.PriceIsAboveRange)).length,Y=D.filter((t=>t.derived.status===Xr.PriceIsBelowRange)).length;return{whirlpool:L,positions:D,positionSummary:{numPositions:C,numZeroLiquidityPositions:N,numFullRangePositions:z,numStatusPriceIsInRangePositions:U,numStatusPriceIsAboveRangePositions:j,numStatusPriceIsBelowRangePositions:Y}}}(o.pubkey)),2055&t.$$.dirty&&n(5,i=async function(t,e,n,r){const i=await t,o=i.positions.filter((t=>!e||!t.parsed.liquidity.isZero())).filter((t=>!n||t.derived.status===Xr.PriceIsInRange)).sort(r);return Object.assign(Object.assign({},i),{positions:o})}(r,s,a,function(t){switch(c[t]){case u.LiquidityDesc:return(t,e)=>e.parsed.liquidity.cmp(t.parsed.liquidity);case u.TickLowerIndexAsc:return Qr;case u.TickUpperIndexDesc:return ti;case u.TokenADesc:return ei;case u.TokenBDesc:return ni;default:return(t,e)=>0}}(d)))},[s,a,d,l,f,i,c,h,function(t){switch(t){case Xr.PriceIsAboveRange:return"🔺 Price is Above";case Xr.PriceIsBelowRange:return"🔻 Price is Below";default:return"🟢 In Range"}},function(t,e){return 0===e?"":`${new fn(Math.round(t/e*100*100)).div(100).toFixed(2)} %`},o,r,function(){s=this.checked,n(0,s)},function(){a=this.checked,n(1,a)},function(t){f=t,n(4,f)},function(t){d=t,n(2,d)}]}const ic="https://public-api.solscan.io/token/holders?limit=10&offset=0&tokenAddress=";async function oc(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(await n.getParsedTokenAccountsByOwner(e,{programId:Hr},"confirmed")).value,i=[];for(const t of r)try{const n=t.pubkey,r=t.account.data.parsed.info,o=new Mt.PublicKey(r.mint),s=r.tokenAmount.decimals,a=new(_n())(r.tokenAmount.amount),u=bn.DecimalUtil.fromBN(a,s),c=(await kt.utils.token.associatedAddress({mint:o,owner:e})).equals(t.pubkey);i.push({address:n,amount:a,decimals:s,isATA:c,mint:o,uiAmount:u,extension:{}})}catch(t){}return await async function(t){const e=It(),n=(0,jr.buildDefaultAccountFetcher)(e),r=[];if(t.forEach(((t,e)=>{t.decimals>0||t.amount.eqn(1)&&r.push({index:e,position:jr.PDAUtil.getPosition(jr.ORCA_WHIRLPOOL_PROGRAM_ID,t.mint).publicKey,bundle:jr.PDAUtil.getPositionBundle(jr.ORCA_WHIRLPOOL_PROGRAM_ID,t.mint).publicKey})})),0===r.length)return;const i=await n.getPositions(r.map((t=>t.position)),jr.IGNORE_CACHE),o=await n.getPositionBundles(r.map((t=>t.bundle)),jr.IGNORE_CACHE);r.forEach((e=>{if(i.get(e.position.toBase58())){const n=t[e.index].extension;t[e.index].extension=Object.assign(Object.assign({},n),{whirlpool:{position:e.position}})}if(o.get(e.bundle.toBase58())){const n=t[e.index].extension;t[e.index].extension=Object.assign(Object.assign({},n),{whirlpool:{positionBundle:e.bundle}})}}))}(i),i}function sc(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function ac(t){let e,n,r,i;return e=new pr({props:{accountType:"token/account",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[vc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function uc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.owner}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.owner),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function cc(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.mint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.mint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function dc(t){let e,n=t[2].parsed.amount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.amount+"")&&B(e,n)},d(t){t&&k(e)}}}function lc(t){let e,n=t[2].parsed.isNative+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.isNative+"")&&B(e,n)},d(t){t&&k(e)}}}function hc(t){let e,n=t[2].parsed.isFrozen+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.isFrozen+"")&&B(e,n)},d(t){t&&k(e)}}}function fc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.delegate}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.delegate),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function pc(t){let e,n=t[2].parsed.delegatedAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.delegatedAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function mc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.closeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.closeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function gc(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g;return e=new vt({props:{name:"owner",type:"PublicKey",offset:"32",$$slots:{default:[uc]},$$scope:{ctx:t}}}),r=new vt({props:{name:"mint",type:"PublicKey",offset:"0",$$slots:{default:[cc]},$$scope:{ctx:t}}}),o=new vt({props:{name:"amount",type:"u64",offset:"64",$$slots:{default:[dc]},$$scope:{ctx:t}}}),a=new vt({props:{name:"isNative",type:"bool",$$slots:{default:[lc]},$$scope:{ctx:t}}}),c=new vt({props:{name:"isFrozen",type:"bool",$$slots:{default:[hc]},$$scope:{ctx:t}}}),l=new vt({props:{name:"delegate",type:"COption",offset:"COption(72)+PublicKey(76)",$$slots:{default:[fc]},$$scope:{ctx:t}}}),f=new vt({props:{name:"delegatedAmount",type:"u64",offset:"121",$$slots:{default:[pc]},$$scope:{ctx:t}}}),m=new vt({props:{name:"closeAuthority",type:"COption",offset:"COption(129)+PublicKey(133)",$$slots:{default:[mc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment)},m(t,y){ft(e,t,y),v(t,n,y),ft(r,t,y),v(t,i,y),ft(o,t,y),v(t,s,y),ft(a,t,y),v(t,u,y),ft(c,t,y),v(t,d,y),ft(l,t,y),v(t,h,y),ft(f,t,y),v(t,p,y),ft(m,t,y),g=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const y={};10&n&&(y.$$scope={dirty:n,ctx:t}),m.$set(y)},i(t){g||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),g=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),g=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t)}}}function yc(t){let e,n=t[2].derived.decimals+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.decimals+"")&&B(e,n)},d(t){t&&k(e)}}}function bc(t){let e,n=t[2].derived.amount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.amount+"")&&B(e,n)},d(t){t&&k(e)}}}function wc(t){let e,n=t[2].derived.isATA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isATA+"")&&B(e,n)},d(t){t&&k(e)}}}function _c(t){let e,n,r,i,o,s;return e=new vt({props:{name:"decimals",$$slots:{default:[yc]},$$scope:{ctx:t}}}),r=new vt({props:{name:"amount",$$slots:{default:[bc]},$$scope:{ctx:t}}}),o=new vt({props:{name:"isATA",$$slots:{default:[wc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function vc(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[gc]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[_c]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function kc(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Mc(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/state.rs#L86"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:kc,then:ac,catch:sc,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🪙Token::Account "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Ac(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=bn.ParsableTokenAccountInfo.parse(e,i),a=await r.getMintInfo(s.mint,jr.IGNORE_CACHE),u=(await kt.utils.token.associatedAddress({mint:s.mint,owner:s.owner})).equals(e);return{meta:Xn(e,i,o),parsed:s,derived:{decimals:a.decimals,amount:bn.DecimalUtil.fromBN(s.amount,a.decimals),isATA:u}}}(i.pubkey))},[i,r]}function Sc(e){let n,r,i,o,s,a,u,c;return{c(){n=A("div"),r=A("input"),i=I(),o=A("span"),s=S("🙆"),P(r,"type","text"),P(r,"placeholder",e[1]),P(r,"size",e[2]),r.value=e[3],P(o,"style",a=`margin-left: 5px; visibility: ${e[0]?"visible":"hidden"};`),$(n,"display","flex"),$(n,"flex-direction","row")},m(t,a){v(t,n,a),_(n,r),_(n,i),_(n,o),_(o,s),u||(c=E(r,"input",T(e[4])),u=!0)},p(t,[e]){2&e&&P(r,"placeholder",t[1]),4&e&&P(r,"size",t[2]),8&e&&r.value!==t[3]&&(r.value=t[3]),1&e&&a!==(a=`margin-left: 5px; visibility: ${t[0]?"visible":"hidden"};`)&&P(o,"style",a)},i:t,o:t,d(t){t&&k(n),u=!1,c()}}}function Ic(t,e,n){let{value:r}=e,{decimals:i}=e,{placeholder:o="token amount"}=e,{size:s=32}=e,a="";return t.$$set=t=>{"value"in t&&n(0,r=t.value),"decimals"in t&&n(5,i=t.decimals),"placeholder"in t&&n(1,o=t.placeholder),"size"in t&&n(2,s=t.size)},[r,o,s,a,function(t){const e=t.target;!function(t,e){return!(t.length>An)&&!((-1===(n=t).indexOf(".")?0:n&&n.split(".")[1].length||0)>e||!function(t){return Sn.test(t)}(t))&&In(t,e).lte(bn.U64_MAX);var n}(e.value,i)?e.value=a:(n(3,a=e.value),n(0,r=["","."].includes(a)?void 0:function(t,e){return In(t,e)}(a,i)))},i]}const xc=class extends gt{constructor(t){super(),mt(this,t,Ic,Sc,a,{value:0,decimals:5,placeholder:1,size:2})}};function Ec(e){let n,r,i,o,s,a,u,c;return{c(){n=A("div"),r=A("input"),i=I(),o=A("span"),s=S("🙆"),P(r,"type","text"),P(r,"placeholder",e[1]),P(r,"size",e[2]),r.value=e[3],P(o,"style",a=`margin-left: 5px; visibility: ${e[0]?"visible":"hidden"};`),$(n,"display","flex"),$(n,"flex-direction","row")},m(t,a){v(t,n,a),_(n,r),_(n,i),_(n,o),_(o,s),u||(c=E(r,"input",T(e[4])),u=!0)},p(t,[e]){2&e&&P(r,"placeholder",t[1]),4&e&&P(r,"size",t[2]),8&e&&r.value!==t[3]&&(r.value=t[3]),1&e&&a!==(a=`margin-left: 5px; visibility: ${t[0]?"visible":"hidden"};`)&&P(o,"style",a)},i:t,o:t,d(t){t&&k(n),u=!1,c()}}}function Tc(t,e,n){let{value:r}=e,{placeholder:i="address"}=e,{size:o=32}=e,s="";return t.$$set=t=>{"value"in t&&n(0,r=t.value),"placeholder"in t&&n(1,i=t.placeholder),"size"in t&&n(2,o=t.size)},[r,i,o,s,function(t){const e=t.target;n(3,s=e.value),n(0,r=function(t){if(Mn.test(t))try{return new Mt.PublicKey(t)}catch(t){return}}(e.value))}]}const Pc=class extends gt{constructor(t){super(),mt(this,t,Tc,Ec,a,{value:0,placeholder:1,size:2})}};var Bc=n(48764).Buffer;function Lc(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b;function w(e){t[5](e)}let M={};function S(e){t[6](e)}void 0!==t[1]&&(M.value=t[1]),s=new Pc({props:M}),j.push((()=>lt(s,"value",w)));let x={decimals:t[0].parsed.decimals};return void 0!==t[2]&&(x.value=t[2]),h=new xc({props:x}),j.push((()=>lt(h,"value",S))),y=new sr({props:{disabled:t[3],download:t[4]}}),{c(){e=A("div"),n=A("table"),r=A("tr"),i=A("th"),i.textContent="owner",o=A("td"),ht(s.$$.fragment),u=I(),c=A("tr"),d=A("th"),d.textContent="amount",l=A("td"),ht(h.$$.fragment),p=I(),m=A("tr"),g=A("td"),ht(y.$$.fragment),P(i,"class","svelte-1psl6r7"),P(o,"class","svelte-1psl6r7"),P(d,"class","svelte-1psl6r7"),P(l,"class","svelte-1psl6r7"),P(g,"colspan","2"),P(g,"class","svelte-1psl6r7"),$(n,"border-spacing","0")},m(t,a){v(t,e,a),_(e,n),_(n,r),_(r,i),_(r,o),ft(s,o,null),_(n,u),_(n,c),_(c,d),_(c,l),ft(h,l,null),_(n,p),_(n,m),_(m,g),ft(y,g,null),b=!0},p(t,[e]){const n={};!a&&2&e&&(a=!0,n.value=t[1],G((()=>a=!1))),s.$set(n);const r={};1&e&&(r.decimals=t[0].parsed.decimals),!f&&4&e&&(f=!0,r.value=t[2],G((()=>f=!1))),h.$set(r);const i={};8&e&&(i.disabled=t[3]),y.$set(i)},i(t){b||(ot(s.$$.fragment,t),ot(h.$$.fragment,t),ot(y.$$.fragment,t),b=!0)},o(t){st(s.$$.fragment,t),st(h.$$.fragment,t),st(y.$$.fragment,t),b=!1},d(t){t&&k(e),pt(s),pt(h),pt(y)}}}function $c(t,e,n){let r,i,o,{mintInfo:s}=e;return t.$$set=t=>{"mintInfo"in t&&n(0,s=t.mintInfo)},t.$$.update=()=>{6&t.$$.dirty&&n(3,r=!i||!o)},[s,i,o,r,async function(){const t=await async function(t,e,n){const r=await kt.utils.token.associatedAddress({mint:t,owner:e}),i=JSON.parse('{"account":{"data":["bSzl7WjOignQep8J48sLWXRN+yidilz09ipUuZGo1wAMjph4T4MwT0YUgNeGtHvaBFkU0iG0rHd0ApevtnFTNQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","base64"],"executable":false,"lamports":2039280,"owner":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","rentEpoch":0},"pubkey":"GbMB98t6YfVxn3Pbu54EyUkuLqdaERLANvyghtrzSf6e"}'),o=Bc.from(i.account.data[0],"base64");return o.set(t.toBuffer(),0),o.set(e.toBuffer(),32),o.set(n.toArrayLike(Bc,"le",8),64),{pubkey:r.toBase58(),account:{owner:i.account.owner,executable:i.account.executable,lamports:i.account.lamports,rentEpoch:i.account.rentEpoch,data:[o.toString("base64"),"base64"]}}}(s.meta.pubkey,i,o),e=`${t.pubkey}.json`;rr(nr(t),e)},function(t){i=t,n(1,i)},function(t){o=t,n(2,o)}]}const Rc=class extends gt{constructor(t){super(),mt(this,t,$c,Lc,a,{mintInfo:0})}};function Oc(t){let e,n,r,i,o,s,a,u,c,d,l,h;function f(e){t[4](e)}let p={};return void 0!==t[0]&&(p.value=t[0]),s=new Pc({props:p}),j.push((()=>lt(s,"value",f))),l=new sr({props:{disabled:t[1],download:t[2]}}),{c(){e=A("div"),n=A("table"),r=A("tr"),i=A("th"),i.textContent="newMintAuthority",o=A("td"),ht(s.$$.fragment),u=I(),c=A("tr"),d=A("td"),ht(l.$$.fragment),P(i,"class","svelte-1psl6r7"),P(o,"class","svelte-1psl6r7"),P(d,"colspan","2"),P(d,"class","svelte-1psl6r7"),$(n,"border-spacing","0")},m(t,a){v(t,e,a),_(e,n),_(n,r),_(r,i),_(r,o),ft(s,o,null),_(n,u),_(n,c),_(c,d),ft(l,d,null),h=!0},p(t,[e]){const n={};!a&&1&e&&(a=!0,n.value=t[0],G((()=>a=!1))),s.$set(n);const r={};2&e&&(r.disabled=t[1]),l.$set(r)},i(t){h||(ot(s.$$.fragment,t),ot(l.$$.fragment,t),h=!0)},o(t){st(s.$$.fragment,t),st(l.$$.fragment,t),h=!1},d(t){t&&k(e),pt(s),pt(l)}}}function Dc(t,e,n){let r,i,{mintInfo:o}=e;return t.$$set=t=>{"mintInfo"in t&&n(3,o=t.mintInfo)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=!i)},[i,r,async function(){const t=function(t,e){var n;const r=Bc.from(t.meta.data);return r.set(new(_n())(1).toArrayLike(Bc,"le",4),0),r.set(e.toBuffer(),4),{pubkey:t.meta.pubkey.toBase58(),account:{owner:t.meta.owner.toBase58(),executable:t.meta.executable,lamports:t.meta.lamports,rentEpoch:null!==(n=t.meta.rentEpoch)&&void 0!==n?n:0,data:[r.toString("base64"),"base64"]}}}(o,i),e=`${t.pubkey}.json`;rr(nr(t),e)},o,function(t){i=t,n(0,i)}]}const Cc=class extends gt{constructor(t){super(),mt(this,t,Dc,Oc,a,{mintInfo:3})}};function Nc(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function zc(t){let e,n,r,i;return e=new pr({props:{accountType:"token/mint",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[rd]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Uc(t){let e,n=t[2].parsed.decimals+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.decimals+"")&&B(e,n)},d(t){t&&k(e)}}}function jc(t){let e,n=t[2].parsed.supply+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.supply+"")&&B(e,n)},d(t){t&&k(e)}}}function Yc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.mintAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.mintAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Fc(t){let e,n;return e=new Gn({props:{address:t[2].parsed.freezeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.freezeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Wc(t){let e,n,r,i,o,s,a,u;return e=new vt({props:{name:"decimals",type:"u8",offset:"44",$$slots:{default:[Uc]},$$scope:{ctx:t}}}),r=new vt({props:{name:"supply",type:"u64",offset:"36",$$slots:{default:[jc]},$$scope:{ctx:t}}}),o=new vt({props:{name:"mintAuthority",type:"COption",offset:"COption(0)+PublicKey(4)",$$slots:{default:[Yc]},$$scope:{ctx:t}}}),a=new vt({props:{name:"freezeAuthority",type:"COption",offset:"COption(46)+PublicKey(50)",$$slots:{default:[Fc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment)},m(t,c){ft(e,t,c),v(t,n,c),ft(r,t,c),v(t,i,c),ft(o,t,c),v(t,s,c),ft(a,t,c),u=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const c={};10&n&&(c.$$scope={dirty:n,ctx:t}),a.$set(c)},i(t){u||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),u=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),u=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t)}}}function Hc(t){let e,n=t[2].derived.supply+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supply+"")&&B(e,n)},d(t){t&&k(e)}}}function Kc(t){let e,n;return e=new Gn({props:{address:t[2].derived.metadata}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.metadata),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function qc(t){let e,n=(void 0!==t[2].derived.whirlpoolPosition)+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=(void 0!==t[2].derived.whirlpoolPosition)+"")&&B(e,n)},d(t){t&&k(e)}}}function Vc(t){let e,n;return e=new vt({props:{name:"whirlpool position",$$slots:{default:[Gc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Gc(t){let e,n;return e=new Gn({props:{type:"whirlpool/position",address:t[2].derived.whirlpoolPosition}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.whirlpoolPosition),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Zc(t){let e,n=(void 0!==t[2].derived.whirlpoolPositionBundle)+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=(void 0!==t[2].derived.whirlpoolPositionBundle)+"")&&B(e,n)},d(t){t&&k(e)}}}function Xc(t){let e,n;return e=new vt({props:{name:"whirlpool position bundle",$$slots:{default:[Jc]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Jc(t){let e,n;return e=new Gn({props:{type:"whirlpool/positionbundle",address:t[2].derived.whirlpoolPositionBundle}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.whirlpoolPositionBundle),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Qc(t){let e,n,r,i,o,s,a,u,c,d,l;e=new vt({props:{name:"supply",$$slots:{default:[Hc]},$$scope:{ctx:t}}}),r=new vt({props:{name:"metadata",$$slots:{default:[Kc]},$$scope:{ctx:t}}}),o=new vt({props:{name:"is whirlpool position mint",$$slots:{default:[qc]},$$scope:{ctx:t}}});let h=void 0!==t[2].derived.whirlpoolPosition&&Vc(t);u=new vt({props:{name:"is whirlpool position bundle mint",$$slots:{default:[Zc]},$$scope:{ctx:t}}});let f=void 0!==t[2].derived.whirlpoolPositionBundle&&Xc(t);return{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),h&&h.c(),a=I(),ht(u.$$.fragment),c=I(),f&&f.c(),d=x()},m(t,p){ft(e,t,p),v(t,n,p),ft(r,t,p),v(t,i,p),ft(o,t,p),v(t,s,p),h&&h.m(t,p),v(t,a,p),ft(u,t,p),v(t,c,p),f&&f.m(t,p),v(t,d,p),l=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const c={};10&n&&(c.$$scope={dirty:n,ctx:t}),o.$set(c),void 0!==t[2].derived.whirlpoolPosition?h?(h.p(t,n),2&n&&ot(h,1)):(h=Vc(t),h.c(),ot(h,1),h.m(a.parentNode,a)):h&&(rt(),st(h,1,1,(()=>{h=null})),it());const l={};10&n&&(l.$$scope={dirty:n,ctx:t}),u.$set(l),void 0!==t[2].derived.whirlpoolPositionBundle?f?(f.p(t,n),2&n&&ot(f,1)):(f=Xc(t),f.c(),ot(f,1),f.m(d.parentNode,d)):f&&(rt(),st(f,1,1,(()=>{f=null})),it())},i(t){l||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(h),ot(u.$$.fragment,t),ot(f),l=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(h),st(u.$$.fragment,t),st(f),l=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),h&&h.d(t),t&&k(a),pt(u,t),t&&k(c),f&&f.d(t),t&&k(d)}}}function td(t){let e,n;return e=new Rc({props:{mintInfo:t[2]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.mintInfo=t[2]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function ed(t){let e,n;return e=new Cc({props:{mintInfo:t[2]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.mintInfo=t[2]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function nd(t){let e,n,r,i;return e=new vt({props:{name:"create ATA account",$$slots:{default:[td]},$$scope:{ctx:t}}}),r=new vt({props:{name:"rewrite mintAuthority",$$slots:{default:[ed]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function rd(t){let e,n,r,i,o,s;return e=new yr({props:{$$slots:{default:[Wc]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Qc]},$$scope:{ctx:t}}}),o=new oi({props:{$$slots:{default:[nd]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function id(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function od(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/state.rs#L16"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:id,then:zc,catch:Nc,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🪙Token::Mint "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function sd(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=(0,jr.buildDefaultAccountFetcher)(n),{accountInfo:i,slotContext:o}=await Zn(n,e),s=bn.ParsableMintInfo.parse(e,i),a=jr.PDAUtil.getPositionMetadata(e).publicKey,u=jr.PDAUtil.getPosition(jr.ORCA_WHIRLPOOL_PROGRAM_ID,e).publicKey,c=await r.getPosition(u,jr.IGNORE_CACHE),d=jr.PDAUtil.getPositionBundle(jr.ORCA_WHIRLPOOL_PROGRAM_ID,e).publicKey,l=await r.getPositionBundle(d,jr.IGNORE_CACHE),h=await async function(t){try{const e=ic+t.toBase58(),n=await(await mn()(e)).json(),r=[];return n.data.forEach((t=>{const e=new(_n())(t.amount),n=Number.parseInt(t.decimals),i=bn.DecimalUtil.fromBN(e,n);r.push({rank:Number.parseInt(t.rank),address:new Mt.PublicKey(t.address),amount:e,decimalAmount:i,decimals:n,owner:new Mt.PublicKey(t.owner)})})),r}catch(t){return[]}}(e);return{meta:Xn(e,i,o),parsed:s,derived:{supply:bn.DecimalUtil.fromBN(s.supply,s.decimals),metadata:a,largestHolders:h,whirlpoolPosition:null===c?void 0:u,whirlpoolPositionBundle:null===l?void 0:d}}}(i.pubkey))},[i,r]}function ad(t,e,n){const r=t.slice();return r[12]=e[n],r}function ud(t,e,n){const r=t.slice();return r[12]=e[n],r}function cd(e){let n,r=e[17].message+"";return{c(){n=S(r)},m(t,e){v(t,n,e)},p(t,e){4&e&&r!==(r=t[17].message+"")&&B(n,r)},i:t,o:t,d(t){t&&k(n)}}}function dd(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m=t[11].filter(t[7]),g=[];for(let e=0;est(g[t],1,1,(()=>{g[t]=null}));let b=t[11].filter(t[8]),w=[];for(let e=0;est(w[t],1,1,(()=>{w[t]=null}));return{c(){e=A("h4"),e.textContent="decimals > 0",n=I(),r=A("table"),i=A("thead"),i.innerHTML='address \n isATA \n mint \n amount',o=I(),s=A("tbody");for(let t=0;taddress \n isATA \n mint \n amount \n whirlpool position \n whirlpool position bundle',h=I(),f=A("tbody");for(let t=0;t{$=null})),it()),t[12].extension.whirlpool?.positionBundle?R?(R.p(t,e),6&e&&ot(R,1)):(R=gd(t),R.c(),ot(R,1),R.m(b,null)):R&&(rt(),st(R,1,1,(()=>{R=null})),it())},i(t){M||(ot(r.$$.fragment,t),ot(d.$$.fragment,t),ot($),ot(R),M=!0)},o(t){st(r.$$.fragment,t),st(d.$$.fragment,t),st($),st(R),M=!1},d(t){t&&k(e),pt(r),P&&P.d(),pt(d),L&&L.d(),$&&$.d(),R&&R.d()}}}function bd(e){let n;return{c(){n=S("loading...")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&k(n)}}}function wd(t){let e,n,r,i,s,a,u,c,d,l,h,f,p,m,g,y,b={ctx:t,current:null,token:null,hasCatch:!0,pending:bd,then:dd,catch:cd,value:11,error:17,blocks:[,,,]};return at(p=t[2],b),{c(){e=A("h2"),e.textContent="🪙Token::listTokenAccounts",n=I(),r=A("form"),i=A("input"),s=I(),a=A("input"),u=I(),c=A("div"),d=A("input"),l=S(" hide 0 amount accounts"),h=I(),f=x(),b.block.c(),$(i,"margin","0.5em 0em"),P(i,"type","text"),P(i,"size","64"),P(i,"placeholder","wallet address"),P(a,"type","submit"),a.value="List!",P(d,"type","checkbox"),$(c,"margin-top","0.5em"),$(c,"font-size","smaller"),$(r,"margin-bottom","1em")},m(o,p){v(o,e,p),v(o,n,p),v(o,r,p),_(r,i),L(i,t[0]),_(r,s),_(r,a),_(r,u),_(r,c),_(c,d),d.checked=t[1],_(c,l),v(o,h,p),v(o,f,p),b.block.m(o,b.anchor=p),b.mount=()=>f.parentNode,b.anchor=f,m=!0,g||(y=[E(i,"input",t[5]),E(d,"change",t[6]),E(r,"submit",T(t[3]))],g=!0)},p(e,[n]){t=e,1&n&&i.value!==t[0]&&L(i,t[0]),2&n&&(d.checked=t[1]),b.ctx=t,4&n&&p!==(p=t[2])&&at(p,b)||ut(b,t,n)},i(t){m||(ot(b.block),m=!0)},o(t){for(let t=0;t<3;t+=1)st(b.blocks[t]);m=!1},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(h),t&&k(f),b.block.d(t),b.token=null,b=null,g=!1,o(y)}}}function _d(t,e,n){var r;let{params:i}=e,o=null!==(r=i.pubkey)&&void 0!==r?r:"",s=!0,a=u()?oc((0,kt.translateAddress)(o)):new Promise((t=>t([])));function u(){try{return(0,kt.translateAddress)(o),!0}catch(t){return!1}}return t.$$set=t=>{"params"in t&&n(4,i=t.params)},[o,s,a,async function(){if(!u())return;const t=(0,kt.translateAddress)(o);n(2,a=oc(t))},i,function(){o=this.value,n(0,o)},function(){s=this.checked,n(1,s)},t=>t.decimals>0&&(!s||!t.amount.isZero()),t=>!(0!==t.decimals||s&&t.amount.isZero())]}function vd(t,e,n){const r=t.slice();return r[9]=e[n],r[10]=e,r[11]=n,r}function kd(t,e,n){const r=t.slice();return r[12]=e[n],r}function Md(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Ad(t){let e,n,r,i,s,a,u,c,d=t[2],l=[];for(let e=0;est(l[t],1,1,(()=>{l[t]=null}));return{c(){e=A("form"),n=A("input"),r=I(),i=A("input"),s=I();for(let t=0;t{h=null})),it())},i(t){s||(ot(h),s=!0)},o(t){st(h),s=!1},d(t){t&&k(e),M(d,t),h&&h.d(),a=!1,u()}}}function Ed(e){let n;return{c(){n=S("loading...")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&k(n)}}}function Td(t){let e,n,r,i,o,s={ctx:t,current:null,token:null,hasCatch:!1,pending:Ed,then:Ad,catch:Md,value:8,blocks:[,,,]};return at(i=t[3],s),{c(){e=A("h2"),e.textContent="🪙Token::deriveATA",n=I(),r=x(),s.block.c()},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i),s.block.m(t,s.anchor=i),s.mount=()=>r.parentNode,s.anchor=r,o=!0},p(e,[n]){t=e,s.ctx=t,8&n&&i!==(i=t[3])&&at(i,s)||ut(s,t,n)},i(t){o||(ot(s.block),o=!0)},o(t){for(let t=0;t<3;t+=1)st(s.blocks[t]);o=!1},d(t){t&&k(e),t&&k(n),t&&k(r),s.block.d(t),s.token=null,s=null}}}const Pd=t=>!t.poolToken;function Bd(t,e,n){let r,i;const o=["So11111111111111111111111111111111111111112","EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE","mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey","7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj","SLNDpmoWTVADgEdndyvWzroNL7zSi1dF9PC3xHGtPwp","7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU","DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX","SHDWyBxihqiCj6YekG2GUr7wqKLeLAMK1gHZck9pL6y","DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ"];let s,a=[...o.slice(0,8),...new Array(10).fill(void 0)].slice(0,10);return n(2,r=new Array(10).fill(void 0)),n(3,i=(async()=>{const t=(await Rn()).tokenList.slice(),e=[...o,...t.map((t=>t.mint.toBase58()))];return t.sort(((t,n)=>e.indexOf(t.mint.toBase58())-e.indexOf(n.mint.toBase58()))),t})()),[s,a,r,i,async function(){n(2,r=new Array(10).fill(void 0));for(let t=0;t<10;t++)try{n(2,r[t]=await kt.utils.token.associatedAddress({mint:(0,kt.translateAddress)(a[t]),owner:(0,kt.translateAddress)(s)}),r)}catch(t){}},function(){s=this.value,n(0,s)},function(t){a[t]=O(this),n(1,a),n(3,i)}]}var Ld=n(39386),$d=n(40475);const Rd=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var Od=n(48764).Buffer;const Dd=t=>e=>{const n=(0,Ld.blob)(t,e),{encode:r,decode:i}=Rd(n),o=n;return o.decode=(t,e)=>{const n=i(t,e);return(0,$d.toBigIntLE)(Od.from(n))},o.encode=(e,n,i)=>{const o=(0,$d.toBufferLE)(e,t);return r(o,n,i)},o},Cd=t=>e=>{const n=(0,Ld.blob)(t,e),{encode:r,decode:i}=Rd(n),o=n;return o.decode=(t,e)=>{const n=i(t,e);return(0,$d.toBigIntBE)(Od.from(n))},o.encode=(e,n,i)=>{const o=(0,$d.toBufferBE)(e,t);return r(o,n,i)},o},Nd=Dd(8);Cd(8),Dd(16),Cd(16),Dd(24),Cd(24),Dd(32),Cd(32);var zd=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ud=Math.ceil,jd=Math.floor,Yd="[BigNumber Error] ",Fd=Yd+"Number primitive has more than 15 significant digits: ",Wd=1e14,Hd=14,Kd=9007199254740991,qd=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Vd=1e7,Gd=1e9;function Zd(t){var e=0|t;return t>0||t===e?e:e-1}function Xd(t){for(var e,n,r=1,i=t.length,o=t[0]+"";rc^n?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;so[s]^n?1:-1;return u==c?0:u>c^n?1:-1}function Qd(t,e,n,r){if(tn||t!==jd(t))throw Error(Yd+(r||"Argument")+("number"==typeof t?tn?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function tl(t){var e=t.c.length-1;return Zd(t.e/Hd)==e&&t.c[e]%2!=0}function el(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function nl(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else ew?h.c=h.e=null:t.e=10;u/=10,a++);return void(a>w?h.c=h.e=null:(h.e=a,h.c=[t]))}l=String(t)}else{if(!zd.test(l=String(t)))return i(h,l,c);h.s=45==l.charCodeAt(0)?(l=l.slice(1),-1):1}(a=l.indexOf("."))>-1&&(l=l.replace(".","")),(u=l.search(/e/i))>0?(a<0&&(a=u),a+=+l.slice(u+1),l=l.substring(0,u)):a<0&&(a=l.length)}else{if(Qd(e,2,A.length,"Base"),10==e&&S)return P(h=new I(t),p+h.e+1,m);if(l=String(t),c="number"==typeof t){if(0*t!=0)return i(h,l,c,e);if(h.s=1/t<0?(l=l.slice(1),-1):1,I.DEBUG&&l.replace(/^0\.0*|\./,"").length>15)throw Error(Fd+t)}else h.s=45===l.charCodeAt(0)?(l=l.slice(1),-1):1;for(n=A.slice(0,e),a=u=0,d=l.length;ua){a=d;continue}}else if(!s&&(l==l.toUpperCase()&&(l=l.toLowerCase())||l==l.toLowerCase()&&(l=l.toUpperCase()))){s=!0,u=-1,a=0;continue}return i(h,String(t),c,e)}c=!1,(a=(l=r(l,e,10,h.s)).indexOf("."))>-1?l=l.replace(".",""):a=l.length}for(u=0;48===l.charCodeAt(u);u++);for(d=l.length;48===l.charCodeAt(--d););if(l=l.slice(u,++d)){if(d-=u,c&&I.DEBUG&&d>15&&(t>Kd||t!==jd(t)))throw Error(Fd+h.s*t);if((a=a-u-1)>w)h.c=h.e=null;else if(a=y)?el(u,s):nl(u,s,"0");else if(o=(t=P(new I(t),e,n)).e,a=(u=Xd(t.c)).length,1==r||2==r&&(e<=o||o<=g)){for(;aa){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-a)>0)for(o+1==a&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function E(t,e){for(var n,r,i=1,o=new I(t[0]);i=10;i/=10,r++);return(n=r+n*Hd-1)>w?t.c=t.e=null:n=10;a/=10,i++);if((o=e-i)<0)o+=Hd,s=e,u=l[c=0],d=jd(u/h[i-s-1]%10);else if((c=Ud((o+1)/Hd))>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));u=d=0,i=1,s=(o%=Hd)-Hd+1}else{for(u=a=l[c],i=1;a>=10;a/=10,i++);d=(s=(o%=Hd)-Hd+i)<0?0:jd(u/h[i-s-1]%10)}if(r=r||e<0||null!=l[c+1]||(s<0?u:u%h[i-s-1]),r=n<4?(d||r)&&(0==n||n==(t.s<0?3:2)):d>5||5==d&&(4==n||r||6==n&&(o>0?s>0?u/h[i-s]:0:l[c-1])%10&1||n==(t.s<0?8:7)),e<1||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=h[(Hd-e%Hd)%Hd],t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=c,a=1,c--):(l.length=c+1,a=h[Hd-o],l[c]=s>0?jd(u/h[i-s]%h[s])*a:0),r)for(;;){if(0==c){for(o=1,s=l[0];s>=10;s/=10,o++);for(s=l[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(t.e++,l[0]==Wd&&(l[0]=1));break}if(l[c]+=a,l[c]!=Wd)break;l[c--]=0,a=1}for(o=l.length;0===l[--o];l.pop());}t.e>w?t.c=t.e=null:t.e=y?el(e,n):nl(e,n,"0"),t.s<0?"-"+e:e)}return I.clone=t,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(Yd+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(Qd(n=t[e],0,Gd,e),p=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(Qd(n=t[e],0,8,e),m=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(Qd(n[0],-Gd,0,e),Qd(n[1],0,Gd,e),g=n[0],y=n[1]):(Qd(n,-Gd,Gd,e),g=-(y=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)Qd(n[0],-Gd,-1,e),Qd(n[1],1,Gd,e),b=n[0],w=n[1];else{if(Qd(n,-Gd,Gd,e),!n)throw Error(Yd+e+" cannot be zero: "+n);b=-(w=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(Yd+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw _=!n,Error(Yd+"crypto unavailable");_=n}else _=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(Qd(n=t[e],0,9,e),v=n),t.hasOwnProperty(e="POW_PRECISION")&&(Qd(n=t[e],0,Gd,e),k=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(Yd+e+" not an object: "+n);M=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(Yd+e+" invalid: "+n);S="0123456789"==n.slice(0,10),A=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:m,EXPONENTIAL_AT:[g,y],RANGE:[b,w],CRYPTO:_,MODULO_MODE:v,POW_PRECISION:k,FORMAT:M,ALPHABET:A}},I.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!I.DEBUG)return!0;var e,n,r=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-Gd&&i<=Gd&&i===jd(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%Hd)<1&&(e+=Hd),String(r[0]).length==e){for(e=0;e=Wd||n!==jd(n))break t;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(Yd+"Invalid BigNumber: "+t)},I.maximum=I.max=function(){return E(arguments,-1)},I.minimum=I.min=function(){return E(arguments,1)},I.random=(o=9007199254740992,s=Math.random()*o&2097151?function(){return jd(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,o,a=0,u=[],c=new I(f);if(null==t?t=p:Qd(t,0,Gd),i=Ud(t/Hd),_)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));a>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[a]=n[0],e[a+1]=n[1]):(u.push(o%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw _=!1,Error(Yd+"crypto unavailable");for(e=crypto.randomBytes(i*=7);a=9e15?crypto.randomBytes(7).copy(e,a):(u.push(o%1e14),a+=7);a=i/7}if(!_)for(;a=10;o/=10,a++);an-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var u,c,d,l,h,f,g,y,b=r.indexOf("."),w=p,_=m;for(b>=0&&(l=k,k=0,r=r.replace(".",""),f=(y=new I(i)).pow(r.length-b),k=l,y.c=e(nl(Xd(f.c),f.e,"0"),10,o,t),y.e=y.c.length),d=l=(g=e(r,i,o,a?(u=A,t):(u=t,A))).length;0==g[--l];g.pop());if(!g[0])return u.charAt(0);if(b<0?--d:(f.c=g,f.e=d,f.s=s,g=(f=n(f,y,w,_,o)).c,h=f.r,d=f.e),b=g[c=d+w+1],l=o/2,h=h||c<0||null!=g[c+1],h=_<4?(null!=b||h)&&(0==_||_==(f.s<0?3:2)):b>l||b==l&&(4==_||h||6==_&&1&g[c-1]||_==(f.s<0?8:7)),c<1||!g[0])r=h?nl(u.charAt(1),-w,u.charAt(0)):u.charAt(0);else{if(g.length=c,h)for(--o;++g[--c]>o;)g[c]=0,c||(++d,g=[1].concat(g));for(l=g.length;!g[--l];);for(b=0,r="";b<=l;r+=u.charAt(g[b++]));r=nl(r,d,u.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,u=t.length,c=e%Vd,d=e/Vd|0;for(t=t.slice();u--;)a=((i=c*(o=t[u]%Vd)+(r=d*o+(s=t[u]/Vd|0)*c)%Vd*Vd+a)/n|0)+(r/Vd|0)+d*s,t[u]=i%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.splice(0,1));}return function(r,i,o,s,a){var u,c,d,l,h,f,p,m,g,y,b,w,_,v,k,M,A,S=r.s==i.s?1:-1,x=r.c,E=i.c;if(!(x&&x[0]&&E&&E[0]))return new I(r.s&&i.s&&(x?!E||x[0]!=E[0]:E)?x&&0==x[0]||!E?0*S:S/0:NaN);for(g=(m=new I(S)).c=[],S=o+(c=r.e-i.e)+1,a||(a=Wd,c=Zd(r.e/Hd)-Zd(i.e/Hd),S=S/Hd|0),d=0;E[d]==(x[d]||0);d++);if(E[d]>(x[d]||0)&&c--,S<0)g.push(1),l=!0;else{for(v=x.length,M=E.length,d=0,S+=2,(h=jd(a/(E[0]+1)))>1&&(E=t(E,h,a),x=t(x,h,a),M=E.length,v=x.length),_=M,b=(y=x.slice(0,M)).length;b=a/2&&k++;do{if(h=0,(u=e(E,y,M,b))<0){if(w=y[0],M!=b&&(w=w*a+(y[1]||0)),(h=jd(w/k))>1)for(h>=a&&(h=a-1),p=(f=t(E,h,a)).length,b=y.length;1==e(f,y,p,b);)h--,n(f,M=10;S/=10,d++);P(m,o+(m.e=d+c*Hd-1)+1,s,l)}else m.e=c,m.r=+l;return m}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,c=/^\.([^.]+)$/,d=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(l,"");if(d.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(a,(function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e})),r&&(i=r,o=o.replace(u,"$1").replace(c,"0.$1")),e!=o))return new I(o,i);if(I.DEBUG)throw Error(Yd+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},h.absoluteValue=h.abs=function(){var t=new I(this);return t.s<0&&(t.s=1),t},h.comparedTo=function(t,e){return Jd(this,new I(t,e))},h.decimalPlaces=h.dp=function(t,e){var n,r,i,o=this;if(null!=t)return Qd(t,0,Gd),null==e?e=m:Qd(e,0,8),P(new I(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-Zd(this.e/Hd))*Hd,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},h.dividedBy=h.div=function(t,e){return n(this,new I(t,e),p,m)},h.dividedToIntegerBy=h.idiv=function(t,e){return n(this,new I(t,e),0,1)},h.exponentiatedBy=h.pow=function(t,e){var n,r,i,o,s,a,u,c,d=this;if((t=new I(t)).c&&!t.isInteger())throw Error(Yd+"Exponent not an integer: "+B(t));if(null!=e&&(e=new I(e)),s=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return c=new I(Math.pow(+B(d),s?t.s*(2-tl(t)):+B(t))),e?c.mod(e):c;if(a=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new I(NaN);(r=!a&&d.isInteger()&&e.isInteger())&&(d=d.mod(e))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||s&&d.c[1]>=24e7:d.c[0]<8e13||s&&d.c[0]<=9999975e7)))return o=d.s<0&&tl(t)?-0:0,d.e>-1&&(o=1/o),new I(a?1/o:o);k&&(o=Ud(k/Hd+2))}for(s?(n=new I(.5),a&&(t.s=1),u=tl(t)):u=(i=Math.abs(+B(t)))%2,c=new I(f);;){if(u){if(!(c=c.times(d)).c)break;o?c.c.length>o&&(c.c.length=o):r&&(c=c.mod(e))}if(i){if(0===(i=jd(i/2)))break;u=i%2}else if(P(t=t.times(n),t.e+1,1),t.e>14)u=tl(t);else{if(0==(i=+B(t)))break;u=i%2}d=d.times(d),o?d.c&&d.c.length>o&&(d.c.length=o):r&&(d=d.mod(e))}return r?c:(a&&(c=f.div(c)),e?c.mod(e):o?P(c,k,m,void 0):c)},h.integerValue=function(t){var e=new I(this);return null==t?t=m:Qd(t,0,8),P(e,e.e+1,t)},h.isEqualTo=h.eq=function(t,e){return 0===Jd(this,new I(t,e))},h.isFinite=function(){return!!this.c},h.isGreaterThan=h.gt=function(t,e){return Jd(this,new I(t,e))>0},h.isGreaterThanOrEqualTo=h.gte=function(t,e){return 1===(e=Jd(this,new I(t,e)))||0===e},h.isInteger=function(){return!!this.c&&Zd(this.e/Hd)>this.c.length-2},h.isLessThan=h.lt=function(t,e){return Jd(this,new I(t,e))<0},h.isLessThanOrEqualTo=h.lte=function(t,e){return-1===(e=Jd(this,new I(t,e)))||0===e},h.isNaN=function(){return!this.s},h.isNegative=function(){return this.s<0},h.isPositive=function(){return this.s>0},h.isZero=function(){return!!this.c&&0==this.c[0]},h.minus=function(t,e){var n,r,i,o,s=this,a=s.s;if(e=(t=new I(t,e)).s,!a||!e)return new I(NaN);if(a!=e)return t.s=-e,s.plus(t);var u=s.e/Hd,c=t.e/Hd,d=s.c,l=t.c;if(!u||!c){if(!d||!l)return d?(t.s=-e,t):new I(l?s:NaN);if(!d[0]||!l[0])return l[0]?(t.s=-e,t):new I(d[0]?s:3==m?-0:0)}if(u=Zd(u),c=Zd(c),d=d.slice(),a=u-c){for((o=a<0)?(a=-a,i=d):(c=u,i=l),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=d.length)<(e=l.length))?a:e,a=e=0;e0)for(;e--;d[n++]=0);for(e=99999999999999;r>a;){if(d[--r]=0;){for(n=0,h=w[i]%g,f=w[i]/g|0,o=i+(s=u);o>i;)n=((c=h*(c=b[--s]%g)+(a=f*c+(d=b[s]/g|0)*h)%g*g+p[o]+n)/m|0)+(a/g|0)+f*d,p[o--]=c%m;p[o]=n}return n?++r:p.splice(0,1),T(t,p,r)},h.negated=function(){var t=new I(this);return t.s=-t.s||null,t},h.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new I(t,e)).s,!i||!e)return new I(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/Hd,s=t.e/Hd,a=r.c,u=t.c;if(!o||!s){if(!a||!u)return new I(i/0);if(!a[0]||!u[0])return u[0]?t:new I(a[0]?r:0*i)}if(o=Zd(o),s=Zd(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(e=u.length)<0&&(n=u,u=a,a=n,e=i),i=0;e;)i=(a[--e]=a[e]+u[e]+i)/Wd|0,a[e]=Wd===a[e]?0:a[e]%Wd;return i&&(a=[i].concat(a),++s),T(t,a,s)},h.precision=h.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return Qd(t,1,Gd),null==e?e=m:Qd(e,0,8),P(new I(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*Hd+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},h.shiftedBy=function(t){return Qd(t,-9007199254740991,Kd),this.times("1e"+t)},h.squareRoot=h.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,u=s.s,c=s.e,d=p+4,l=new I("0.5");if(1!==u||!a||!a[0])return new I(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+B(s)))||u==1/0?(((e=Xd(a)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=Zd((c+1)/2)-(c<0||c%2),r=new I(e=u==1/0?"5e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):r=new I(u+""),r.c[0])for((u=(c=r.e)+d)<3&&(u=0);;)if(o=r,r=l.times(o.plus(n(s,o,d,1))),Xd(o.c).slice(0,u)===(e=Xd(r.c)).slice(0,u)){if(r.e0&&p>0){for(o=p%a||a,d=f.substr(0,o);o0&&(d+=c+f.slice(o)),h&&(d="-"+d)}r=l?d+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):l):d}return(n.prefix||"")+r+(n.suffix||"")},h.toFraction=function(t){var e,r,i,o,s,a,u,c,d,l,h,p,g=this,y=g.c;if(null!=t&&(!(u=new I(t)).isInteger()&&(u.c||1!==u.s)||u.lt(f)))throw Error(Yd+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+B(u));if(!y)return new I(g);for(e=new I(f),d=r=new I(f),i=c=new I(f),p=Xd(y),s=e.e=p.length-g.e-1,e.c[0]=qd[(a=s%Hd)<0?Hd+a:a],t=!t||u.comparedTo(e)>0?s>0?e:d:u,a=w,w=1/0,u=new I(p),c.c[0]=0;l=n(u,e,0,1),1!=(o=r.plus(l.times(i))).comparedTo(t);)r=i,i=o,d=c.plus(l.times(o=d)),c=o,e=u.minus(l.times(o=e)),u=o;return o=n(t.minus(r),i,0,1),c=c.plus(o.times(d)),r=r.plus(o.times(i)),c.s=d.s=g.s,h=n(d,i,s*=2,m).minus(g).abs().comparedTo(n(c,r,s,m).minus(g).abs())<1?[d,i]:[c,r],w=a,h},h.toNumber=function(){return+B(this)},h.toPrecision=function(t,e){return null!=t&&Qd(t,1,Gd),x(this,t,e,2)},h.toString=function(t){var e,n=this,i=n.s,o=n.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=g||o>=y?el(Xd(n.c),o):nl(Xd(n.c),o,"0"):10===t&&S?e=nl(Xd((n=P(new I(n),p+o+1,m)).c),n.e,"0"):(Qd(t,2,A.length,"Base"),e=r(nl(Xd(n.c),o,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},h.valueOf=h.toJSON=function(){return B(this)},h._isBigNumber=!0,h[Symbol.toStringTag]="BigNumber",h[Symbol.for("nodejs.util.inspect.custom")]=h.valueOf,null!=e&&I.set(e),I}();new rl("1e+18");const il=t=>{const e=(0,Ld.u8)(t),{encode:n,decode:r}=Rd(e),i=e;return i.decode=(t,e)=>!!r(t,e),i.encode=(t,e,r)=>{const i=Number(t);return n(i,e,r)},i};var ol=n(68716);const sl=t=>{const e=(0,Ld.blob)(32,t),{encode:n,decode:r}=Rd(e),i=e;return i.decode=(t,e)=>{const n=r(t,e);return new ol.PublicKey(n)},i.encode=(t,e,r)=>{const i=t.toBuffer();return n(i,e,r)},i};class al extends Error{constructor(t){super(t)}}class ul extends al{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class cl extends al{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}}class dl extends al{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class ll extends al{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class hl extends al{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}var fl;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(fl||(fl={}));const pl=1,ml=(0,Ld.struct)([(0,Ld.u8)("m"),(0,Ld.u8)("n"),il("isInitialized"),sl("signer1"),sl("signer2"),sl("signer3"),sl("signer4"),sl("signer5"),sl("signer6"),sl("signer7"),sl("signer8"),sl("signer9"),sl("signer10"),sl("signer11")]).span;var gl,yl=n(48764).Buffer;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(gl||(gl={}));const bl=(0,Ld.struct)([sl("mint"),sl("owner"),Nd("amount"),(0,Ld.u32)("delegateOption"),sl("delegate"),(0,Ld.u8)("state"),(0,Ld.u32)("isNativeOption"),Nd("isNative"),Nd("delegatedAmount"),(0,Ld.u32)("closeAuthorityOption"),sl("closeAuthority")]),wl=bl.span;var _l=n(48764).Buffer;const vl=(0,Ld.struct)([(0,Ld.u32)("mintAuthorityOption"),sl("mintAuthority"),Nd("supply"),(0,Ld.u8)("decimals"),il("isInitialized"),(0,Ld.u32)("freezeAuthorityOption"),sl("freezeAuthority")]),kl=vl.span;function Ml(t,e,n=Kr){if(!e)throw new ul;if(!e.owner.equals(n))throw new dl;if(e.data.lengthkl){if(e.data.length<=wl)throw new ll;if(e.data.length===ml)throw new ll;if(e.data[wl]!=fl.Mint)throw new hl;i=e.data.slice(wl+pl)}return{address:t,mintAuthority:r.mintAuthorityOption?r.mintAuthority:null,supply:r.supply,decimals:r.decimals,isInitialized:r.isInitialized,freezeAuthority:r.freezeAuthorityOption?r.freezeAuthority:null,tlvData:i}}var Al;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.TransferFeeConfig=1]="TransferFeeConfig",t[t.TransferFeeAmount=2]="TransferFeeAmount",t[t.MintCloseAuthority=3]="MintCloseAuthority",t[t.ConfidentialTransferMint=4]="ConfidentialTransferMint",t[t.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",t[t.DefaultAccountState=6]="DefaultAccountState",t[t.ImmutableOwner=7]="ImmutableOwner",t[t.MemoTransfer=8]="MemoTransfer",t[t.NonTransferable=9]="NonTransferable",t[t.InterestBearingConfig=10]="InterestBearingConfig",t[t.CpiGuard=11]="CpiGuard",t[t.PermanentDelegate=12]="PermanentDelegate",t[t.NonTransferableAccount=13]="NonTransferableAccount",t[t.TransferHook=14]="TransferHook",t[t.TransferHookAccount=15]="TransferHookAccount",t[t.MetadataPointer=18]="MetadataPointer",t[t.TokenMetadata=19]="TokenMetadata",t[t.GroupPointer=20]="GroupPointer",t[t.GroupMemberPointer=22]="GroupMemberPointer"}(Al||(Al={}));const Sl=2,Il=2;function xl(t){return t+Sl+Il}function El(t,e){let n=0;for(;xl(n)<=e.length;){const r=e.readUInt16LE(n),i=e.readUInt16LE(n+Sl),o=xl(n);if(r==t)return e.slice(o,o+i);n=o+i}return null}function Tl(t){const e=[];let n=0;for(;n((t,e)=>{if(t.length>=e)return t;const n=new Uint8Array(e).fill(0);return n.set(t),n})(t.length<=e?t:t.slice(0,e),e);function Gl(t,e){return"fixedSize"in e?e.fixedSize:e.getSizeFromValue(t)}function Zl(t){return Object.freeze({...t,encode:e=>{const n=new Uint8Array(Gl(e,t));return t.write(e,n,0),n}})}function Xl(t){return Object.freeze({...t,decode:(e,n=0)=>t.read(e,n)[0]})}function Jl(t){return"fixedSize"in t&&"number"==typeof t.fixedSize}function Ql(t,e){if(!Jl(t))throw new Error(e??"Expected a fixed-size codec, got a variable-size one.")}function th(t,e){if(Jl(t)!==Jl(e))throw new Error("Encoder and decoder must either both be fixed-size or variable-size.");if(Jl(t)&&Jl(e)&&t.fixedSize!==e.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${t.fixedSize}] and [${e.fixedSize}].`);if(!Jl(t)&&!Jl(e)&&t.maxSize!==e.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${t.maxSize}] and [${e.maxSize}].`);return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}}function eh(t,e){return Zl({fixedSize:e,write:(n,r,i)=>{const o=t.encode(n),s=o.length>e?o.slice(0,e):o;return r.set(s,i),i+e}})}function nh(t,e){return Xl({fixedSize:e,read:(n,r)=>{ql("fixCodec",e,n,r),(r>0||n.length>e)&&(n=n.slice(r,r+e)),Jl(t)&&(n=Vl(n,t.fixedSize));const[i]=t.read(n,0);return[i,r+e]}})}function rh(t){return 1!==t?.endian}function ih(t){return Zl({fixedSize:t.size,write(e,n,r){t.range&&function(t,e,n,r){if(rn)throw new Error(`Codec [${t}] expected number to be in the range [${e}, ${n}], got ${r}.`)}(t.name,t.range[0],t.range[1],e);const i=new ArrayBuffer(t.size);return t.set(new DataView(i),e,rh(t.config)),n.set(new Uint8Array(i),r),r+t.size}})}var oh=(t={})=>ih({config:t,name:"u32",range:[0,Number("0xffffffff")],set:(t,e,n)=>t.setUint32(0,e,n),size:4}),sh=(t={})=>{return Xl({fixedSize:(e={config:t,get:(t,e)=>t.getUint32(0,e),name:"u32",size:4}).size,read(t,n=0){Kl(e.name,t,n),ql(e.name,e.size,t,n);const r=new DataView(function(t,e,n){const r=t.byteOffset+(e??0),i=n??t.byteLength;return t.buffer.slice(r,r+i)}(t,n,e.size));return[e.get(r,rh(e.config)),n+e.size]}});var e};function ah(t,e,n){if(e!==n)throw new Error(`Expected [${t}] to have ${e} items, got ${n}.`)}function uh(t){return t.reduce(((t,e)=>null===t||null===e?null:t+e),0)}function ch(t){return Jl(t)?t.fixedSize:null}function dh(t){return Jl(t)?t.fixedSize:t.maxSize??null}function lh(t,e){return"number"!=typeof t?null:0===t?0:null===e?null:e*t}function hh(t={}){return th(function(t={}){const e=t.size??"variable",n=Zl({getSizeFromValue:t=>t.length,write:(t,e,n)=>(e.set(t,n),n+t.length)});return"variable"===e?n:"number"==typeof e?eh(n,e):Zl({getSizeFromValue:t=>Gl(t.length,e)+t.length,write:(t,r,i)=>(i=e.write(t.length,r,i),n.write(t,r,i))})}(t),function(t={}){const e=t.size??"variable",n=Xl({read:(t,e)=>{const n=t.slice(e);return[n,e+n.length]}});return"variable"===e?n:"number"==typeof e?nh(n,e):Xl({read:(t,r)=>{Kl("bytes",t,r);const[i,o]=e.read(t,r),s=Number(i);r=o;const a=t.slice(r,r+s);ql("bytes",s,a);const[u,c]=n.read(a,0);return[u,r+=c]}})}(t))}var fh=t=>t.replace(/\u0000/g,""),ph=globalThis.TextDecoder,mh=globalThis.TextEncoder;function gh(t={}){return th(function(t={}){const e=t.size??oh(),n=t.encoding??(()=>{let t;return Zl({getSizeFromValue:e=>(t||=new mh).encode(e).length,write:(e,n,r)=>{const i=(t||=new mh).encode(e);return n.set(i,r),r+i.length}})})();return"variable"===e?n:"number"==typeof e?eh(n,e):Zl({getSizeFromValue:t=>{const r=Gl(t,n);return Gl(r,e)+r},write:(t,r,i)=>{const o=Gl(t,n);return i=e.write(o,r,i),n.write(t,r,i)}})}(t),function(t={}){const e=t.size??sh(),n=t.encoding??(()=>{let t;return Xl({read(e,n){const r=(t||=new ph).decode(e.slice(n));return[fh(r),e.length]}})})();return"variable"===e?n:"number"==typeof e?nh(n,e):Xl({read:(t,r=0)=>{Kl("string",t,r);const[i,o]=e.read(t,r),s=Number(i);r=o;const a=t.slice(r,r+s);ql("string",s,a);const[u,c]=n.read(a,0);return[u,r+=c]}})}(t))}n(48764).Buffer.from([112,132,90,90,11,88,157,87]);const yh=(bh=[["updateAuthority",hh({size:32})],["mint",hh({size:32})],["name",gh()],["symbol",gh()],["uri",gh()],["additionalMetadata",function(t,e={}){return th(function(t,e={}){const n=e.size??oh();"remainder"===n&&Ql(t,'Codecs of "remainder" size must have fixed-size items.');const r=lh(n,ch(t)),i=lh(n,dh(t))??void 0;return Zl({...null!==r?{fixedSize:r}:{getSizeFromValue:e=>("object"==typeof n?Gl(e.length,n):0)+[...e].reduce(((e,n)=>e+Gl(n,t)),0),maxSize:i},write:(e,r,i)=>("number"==typeof n&&ah("array",n,e.length),"object"==typeof n&&(i=n.write(e.length,r,i)),e.forEach((e=>{i=t.write(e,r,i)})),i)})}(t,e),function(t,e={}){const n=e.size??sh();"remainder"===n&&Ql(t,'Codecs of "remainder" size must have fixed-size items.');const r=ch(t),i=lh(n,r),o=lh(n,dh(t))??void 0;return Xl({...null!==i?{fixedSize:i}:{maxSize:o},read:(e,i)=>{const o=[];if("object"==typeof n&&0===e.slice(i).length)return[o,i];const[s,a]=function(t,e,n,r){if("number"==typeof t)return[t,r];if("object"==typeof t)return t.read(n,r);if("remainder"===t){if(null===e)throw new Error('Codecs of "remainder" size must have fixed-size items.');const t=Math.max(0,n.length-r);if(t%e!=0)throw new Error(`The remainder of the byte array (${t} bytes) cannot be split into chunks of ${e} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${t} modulo ${e} should be equal to zero.`);return[t/e,r]}throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(t)}`)}(n,r,e,i);i=a;for(let n=0;nt.map(((t,n)=>Gl(e[n],t))).reduce(((t,e)=>t+e),0),maxSize:n}:{fixedSize:e},write:(e,n,r)=>(ah("tuple",t.length,e.length),t.forEach(((t,i)=>{r=t.write(e[i],n,r)})),r)})}(wh),function(t){const e=uh(t.map(ch)),n=uh(t.map(dh))??void 0;return Xl({...null===e?{maxSize:n}:{fixedSize:e},read:(e,n)=>{const r=[];return t.forEach((t=>{const[i,o]=t.read(e,n);r.push(i),n=o})),[r,n]}})}(wh))))]],th(function(t){const e=t.map((([,t])=>t)),n=uh(e.map(ch)),r=uh(e.map(dh))??void 0;return Zl({...null===n?{getSizeFromValue:e=>t.map((([t,n])=>Gl(e[t],n))).reduce(((t,e)=>t+e),0),maxSize:r}:{fixedSize:n},write:(e,n,r)=>(t.forEach((([t,i])=>{r=i.write(e[t],n,r)})),r)})}(bh),function(t){const e=t.map((([,t])=>t)),n=uh(e.map(ch)),r=uh(e.map(dh))??void 0;return Xl({...null===n?{maxSize:r}:{fixedSize:n},read:(e,n)=>{const r={};return t.forEach((([t,i])=>{const[o,s]=i.read(e,n);n=s,r[t]=o})),[r,n]}})}(bh)));var bh,wh;async function _h(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=function(t,e,n=Kr){if(!e)throw new ul;if(!e.owner.equals(n))throw new dl;if(e.data.lengthwl){if(e.data.length===ml)throw new ll;if(e.data[wl]!=fl.Account)throw new cl;i=e.data.slice(wl+pl)}return{address:t,mint:r.mint,owner:r.owner,amount:r.amount,delegate:r.delegateOption?r.delegate:null,delegatedAmount:r.delegatedAmount,isInitialized:r.state!==gl.Uninitialized,isFrozen:r.state===gl.Frozen,isNative:!!r.isNativeOption,rentExemptReserve:r.isNativeOption?r.isNative:null,closeAuthority:r.closeAuthorityOption?r.closeAuthority:null,tlvData:i}}(e,r,qr),{accountInfo:s}=await Zn(n,o.mint),a=Ml(o.mint,s,qr),u=function(t){const e=El(Al.TransferFeeAmount,t.tlvData);return null!==e?Ll.decode(e):null}(o),c=function(t){const e=El(Al.ImmutableOwner,t.tlvData);return null!==e?$l.decode(e):null}(o),d=function(t){const e=El(Al.MemoTransfer,t.tlvData);return null!==e?Rl.decode(e):null}(o),l=function(t){const e=El(Al.CpiGuard,t.tlvData);return null!==e?Ol.decode(e):null}(o),h=function(t){const e=El(Al.NonTransferableAccount,t.tlvData);return null!==e?Dl.decode(e):null}(o),f=function(t){const e=El(Al.TransferHookAccount,t.tlvData);return null!==e?Nl.decode(e):null}(o),p=Tl(o.tlvData).sort().filter((t=>{switch(t){case Al.TransferFeeAmount:case Al.ImmutableOwner:case Al.MemoTransfer:case Al.CpiGuard:case Al.NonTransferableAccount:case Al.TransferHookAccount:return!1;default:return!0}})),m=(await kt.utils.token.associatedAddress({mint:o.mint,owner:o.owner})).equals(e);return{meta:Xn(e,r,i),parsed:{base:o,extensions:{transferFeeAmount:u,immutableOwner:c,memoTransfer:d,cpiGuard:l,nonTransferableAccount:h,transferHookAccount:f},unknownExtensions:p},derived:{decimals:a.decimals,amount:bn.DecimalUtil.fromBN(new(_n())(o.amount.toString()),a.decimals),isATA:m}}}function vh(t){let e,n,r,i,o,s,a;o=new Ir({props:{href:t[2]}});const u=t[4].default,c=d(u,t,t[3],null);return{c(){e=A("dt"),n=A("b"),r=S(t[0]),i=I(),ht(o.$$.fragment),s=A("dd"),c&&c.c(),P(n,"title",t[1]),$(s,"margin-left","0px")},m(t,u){v(t,e,u),_(e,n),_(n,r),_(e,i),ft(o,e,null),v(t,s,u),c&&c.m(s,null),a=!0},p(t,[e]){(!a||1&e)&&B(r,t[0]),(!a||2&e)&&P(n,"title",t[1]);const i={};4&e&&(i.href=t[2]),o.$set(i),c&&c.p&&(!a||8&e)&&f(c,u,t,t[3],a?h(u,t[3],e,null):p(t[3]),null)},i(t){a||(ot(o.$$.fragment,t),ot(c,t),a=!0)},o(t){st(o.$$.fragment,t),st(c,t),a=!1},d(t){t&&k(e),pt(o),t&&k(s),c&&c.d(t)}}}function kh(t,e,n){let{$$slots:r={},$$scope:i}=e,{name:o}=e,{desc:s}=e,{href:a}=e;return t.$$set=t=>{"name"in t&&n(0,o=t.name),"desc"in t&&n(1,s=t.desc),"href"in t&&n(2,a=t.href),"$$scope"in t&&n(3,i=t.$$scope)},[o,s,a,i,r]}const Mh=class extends gt{constructor(t){super(),mt(this,t,kh,vh,a,{name:0,desc:1,href:2})}};function Ah(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Sh(t){let e,n,r,i;return e=new pr({props:{accountType:"token2022/account",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Vh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Ih(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.owner}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.owner),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function xh(t){let e,n;return e=new Gn({props:{type:"token2022/mint",address:t[2].parsed.base.mint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.mint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Eh(t){let e,n=t[2].parsed.base.amount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.amount+"")&&B(e,n)},d(t){t&&k(e)}}}function Th(t){let e,n=t[2].parsed.base.isNative+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.isNative+"")&&B(e,n)},d(t){t&&k(e)}}}function Ph(t){let e,n=t[2].parsed.base.isFrozen+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.isFrozen+"")&&B(e,n)},d(t){t&&k(e)}}}function Bh(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.delegate}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.delegate),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Lh(t){let e,n=t[2].parsed.base.delegatedAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.delegatedAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function $h(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.closeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.closeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Rh(t){let e,n;return e=new Mh({props:{name:"Unknown ExtensionType🚨",href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/extension/mod.rs#L906",desc:"Please be careful. Account microscope detected unknown extensions.",$$slots:{default:[Oh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Oh(t){let e,n,r=JSON.stringify(t[2].parsed.unknownExtensions)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=JSON.stringify(t[2].parsed.unknownExtensions)+"")&&B(n,r)},d(t){t&&k(e)}}}function Dh(t){let e,n,r=xn(t[2].parsed.extensions.transferFeeAmount)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.transferFeeAmount)+"")&&B(n,r)},d(t){t&&k(e)}}}function Ch(t){let e,n,r=xn(t[2].parsed.extensions.immutableOwner)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.immutableOwner)+"")&&B(n,r)},d(t){t&&k(e)}}}function Nh(t){let e,n,r=xn(t[2].parsed.extensions.memoTransfer)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.memoTransfer)+"")&&B(n,r)},d(t){t&&k(e)}}}function zh(t){let e,n,r=xn(t[2].parsed.extensions.cpiGuard)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.cpiGuard)+"")&&B(n,r)},d(t){t&&k(e)}}}function Uh(t){let e,n,r=xn(t[2].parsed.extensions.nonTransferableAccount)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.nonTransferableAccount)+"")&&B(n,r)},d(t){t&&k(e)}}}function jh(t){let e,n,r=xn(t[2].parsed.extensions.transferHookAccount)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.transferHookAccount)+"")&&B(n,r)},d(t){t&&k(e)}}}function Yh(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p=t[2].parsed.unknownExtensions.length>0&&Rh(t);return n=new Mh({props:{name:"TransferFeeAmount(2)",href:"https://spl.solana.com/token-2022/extensions#transfer-fees",desc:"Includes withheld transfer fees",$$slots:{default:[Dh]},$$scope:{ctx:t}}}),i=new Mh({props:{name:"ImmutableOwner(7)",href:"https://spl.solana.com/token-2022/extensions#immutable-owner",desc:"Indicates that the Account owner authority cannot be changed",$$slots:{default:[Ch]},$$scope:{ctx:t}}}),s=new Mh({props:{name:"MemoTransfer(8)",href:"https://spl.solana.com/token-2022/extensions#required-memo-on-transfer",desc:"Require inbound transfers to have memo",$$slots:{default:[Nh]},$$scope:{ctx:t}}}),u=new Mh({props:{name:"CpiGuard(11)",href:"https://spl.solana.com/token-2022/extensions#cpi-guard",desc:"Locks privileged token operations from happening via CPI",$$slots:{default:[zh]},$$scope:{ctx:t}}}),d=new Mh({props:{name:"NonTransferableAccount(13)",href:"https://spl.solana.com/token-2022/extensions#non-transferable-tokens",desc:"Indicates that the tokens in this account belong to a non-transferable mint",$$slots:{default:[Uh]},$$scope:{ctx:t}}}),h=new Mh({props:{name:"TransferHookAccount(15)",href:"https://spl.solana.com/token-2022/extensions#transfer-hook",desc:"Indicates that the tokens in this account belong to a mint with a transfer hook",$$slots:{default:[jh]},$$scope:{ctx:t}}}),{c(){p&&p.c(),e=I(),ht(n.$$.fragment),r=I(),ht(i.$$.fragment),o=I(),ht(s.$$.fragment),a=I(),ht(u.$$.fragment),c=I(),ht(d.$$.fragment),l=I(),ht(h.$$.fragment)},m(t,m){p&&p.m(t,m),v(t,e,m),ft(n,t,m),v(t,r,m),ft(i,t,m),v(t,o,m),ft(s,t,m),v(t,a,m),ft(u,t,m),v(t,c,m),ft(d,t,m),v(t,l,m),ft(h,t,m),f=!0},p(t,r){t[2].parsed.unknownExtensions.length>0?p?(p.p(t,r),2&r&&ot(p,1)):(p=Rh(t),p.c(),ot(p,1),p.m(e.parentNode,e)):p&&(rt(),st(p,1,1,(()=>{p=null})),it());const o={};10&r&&(o.$$scope={dirty:r,ctx:t}),n.$set(o);const a={};10&r&&(a.$$scope={dirty:r,ctx:t}),i.$set(a);const c={};10&r&&(c.$$scope={dirty:r,ctx:t}),s.$set(c);const l={};10&r&&(l.$$scope={dirty:r,ctx:t}),u.$set(l);const f={};10&r&&(f.$$scope={dirty:r,ctx:t}),d.$set(f);const m={};10&r&&(m.$$scope={dirty:r,ctx:t}),h.$set(m)},i(t){f||(ot(p),ot(n.$$.fragment,t),ot(i.$$.fragment,t),ot(s.$$.fragment,t),ot(u.$$.fragment,t),ot(d.$$.fragment,t),ot(h.$$.fragment,t),f=!0)},o(t){st(p),st(n.$$.fragment,t),st(i.$$.fragment,t),st(s.$$.fragment,t),st(u.$$.fragment,t),st(d.$$.fragment,t),st(h.$$.fragment,t),f=!1},d(t){p&&p.d(t),t&&k(e),pt(n,t),t&&k(r),pt(i,t),t&&k(o),pt(s,t),t&&k(a),pt(u,t),t&&k(c),pt(d,t),t&&k(l),pt(h,t)}}}function Fh(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b;return e=new vt({props:{name:"owner",type:"PublicKey",offset:"32",$$slots:{default:[Ih]},$$scope:{ctx:t}}}),r=new vt({props:{name:"mint",type:"PublicKey",offset:"0",$$slots:{default:[xh]},$$scope:{ctx:t}}}),o=new vt({props:{name:"amount",type:"u64",offset:"64",$$slots:{default:[Eh]},$$scope:{ctx:t}}}),a=new vt({props:{name:"isNative",type:"bool",$$slots:{default:[Th]},$$scope:{ctx:t}}}),c=new vt({props:{name:"isFrozen",type:"bool",$$slots:{default:[Ph]},$$scope:{ctx:t}}}),l=new vt({props:{name:"delegate",type:"COption",offset:"COption(72)+PublicKey(76)",$$slots:{default:[Bh]},$$scope:{ctx:t}}}),f=new vt({props:{name:"delegatedAmount",type:"u64",offset:"121",$$slots:{default:[Lh]},$$scope:{ctx:t}}}),m=new vt({props:{name:"closeAuthority",type:"COption",offset:"COption(129)+PublicKey(133)",$$slots:{default:[$h]},$$scope:{ctx:t}}}),y=new vt({props:{name:"extensions",$$slots:{default:[Yh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment)},m(t,w){ft(e,t,w),v(t,n,w),ft(r,t,w),v(t,i,w),ft(o,t,w),v(t,s,w),ft(a,t,w),v(t,u,w),ft(c,t,w),v(t,d,w),ft(l,t,w),v(t,h,w),ft(f,t,w),v(t,p,w),ft(m,t,w),v(t,g,w),ft(y,t,w),b=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const w={};10&n&&(w.$$scope={dirty:n,ctx:t}),y.$set(w)},i(t){b||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),b=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),b=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t)}}}function Wh(t){let e,n=t[2].derived.decimals+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.decimals+"")&&B(e,n)},d(t){t&&k(e)}}}function Hh(t){let e,n=t[2].derived.amount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.amount+"")&&B(e,n)},d(t){t&&k(e)}}}function Kh(t){let e,n=t[2].derived.isATA+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isATA+"")&&B(e,n)},d(t){t&&k(e)}}}function qh(t){let e,n,r,i,o,s;return e=new vt({props:{name:"decimals",$$slots:{default:[Wh]},$$scope:{ctx:t}}}),r=new vt({props:{name:"amount",$$slots:{default:[Hh]},$$scope:{ctx:t}}}),o=new vt({props:{name:"isATA",$$slots:{default:[Kh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment)},m(t,a){ft(e,t,a),v(t,n,a),ft(r,t,a),v(t,i,a),ft(o,t,a),s=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const a={};10&n&&(a.$$scope={dirty:n,ctx:t}),o.$set(a)},i(t){s||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),s=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),s=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t)}}}function Vh(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Fh]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[qh]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Gh(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Zh(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/state.rs#L93"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Gh,then:Sh,catch:Ah,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("💎Token2022::Account "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Xh(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=_h(i.pubkey))},[i,r]}function Jh(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Qh(t){let e,n,r,i;return e=new pr({props:{accountType:"token2022/mint",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[_f]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function tf(t){let e,n=t[2].parsed.base.decimals+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.decimals+"")&&B(e,n)},d(t){t&&k(e)}}}function ef(t){let e,n=t[2].parsed.base.supply+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.base.supply+"")&&B(e,n)},d(t){t&&k(e)}}}function nf(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.mintAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.mintAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function rf(t){let e,n;return e=new Gn({props:{address:t[2].parsed.base.freezeAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.base.freezeAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function of(t){let e,n;return e=new Mh({props:{name:"Unknown ExtensionType🚨",href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/extension/mod.rs#L906",desc:"Please be careful. Account microscope detected unknown extensions.",$$slots:{default:[sf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function sf(t){let e,n,r=JSON.stringify(t[2].parsed.unknownExtensions)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=JSON.stringify(t[2].parsed.unknownExtensions)+"")&&B(n,r)},d(t){t&&k(e)}}}function af(t){let e,n,r=xn(t[2].parsed.extensions.transferFeeConfig)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.transferFeeConfig)+"")&&B(n,r)},d(t){t&&k(e)}}}function uf(t){let e,n,r=xn(t[2].parsed.extensions.mintCloseAuthority)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.mintCloseAuthority)+"")&&B(n,r)},d(t){t&&k(e)}}}function cf(t){let e,n,r=xn(t[2].parsed.extensions.defaultAccountState)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.defaultAccountState)+"")&&B(n,r)},d(t){t&&k(e)}}}function df(t){let e,n,r=xn(t[2].parsed.extensions.nonTransferable)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.nonTransferable)+"")&&B(n,r)},d(t){t&&k(e)}}}function lf(t){let e,n,r=xn(t[2].parsed.extensions.interestBearingConfig)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.interestBearingConfig)+"")&&B(n,r)},d(t){t&&k(e)}}}function hf(t){let e,n,r=xn(t[2].parsed.extensions.permanentDelegate)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.permanentDelegate)+"")&&B(n,r)},d(t){t&&k(e)}}}function ff(t){let e,n,r=xn(t[2].parsed.extensions.transferHook)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.transferHook)+"")&&B(n,r)},d(t){t&&k(e)}}}function pf(t){let e,n,r=xn(t[2].parsed.extensions.metadataPointer)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.metadataPointer)+"")&&B(n,r)},d(t){t&&k(e)}}}function mf(t){let e,n,r=xn(t[2].parsed.extensions.tokenMetadata)+"";return{c(){e=A("pre"),n=S(r)},m(t,r){v(t,e,r),_(e,n)},p(t,e){2&e&&r!==(r=xn(t[2].parsed.extensions.tokenMetadata)+"")&&B(n,r)},d(t){t&&k(e)}}}function gf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_=t[2].parsed.unknownExtensions.length>0&&of(t);return n=new Mh({props:{name:"TransferFeeConfig(1)",href:"https://spl.solana.com/token-2022/extensions#transfer-fees",desc:"Includes transfer fee rate info and accompanying authorities to withdraw and set the fee",$$slots:{default:[af]},$$scope:{ctx:t}}}),i=new Mh({props:{name:"MintCloseAuthority(3)",href:"https://spl.solana.com/token-2022/extensions#mint-close-authority",desc:"Includes an optional mint close authority",$$slots:{default:[uf]},$$scope:{ctx:t}}}),s=new Mh({props:{name:"DefaultAccountState(6)",href:"https://spl.solana.com/token-2022/extensions#default-account-state",desc:"Specifies the default Account::state for new Accounts",$$slots:{default:[cf]},$$scope:{ctx:t}}}),u=new Mh({props:{name:"NonTransferable(9)",href:"https://spl.solana.com/token-2022/extensions#non-transferable-tokens",desc:"Indicates that the tokens from this mint can't be transfered",$$slots:{default:[df]},$$scope:{ctx:t}}}),d=new Mh({props:{name:"InterestBearingConfig(10)",href:"https://spl.solana.com/token-2022/extensions#interest-bearing-tokens",desc:"Tokens accrue interest over time",$$slots:{default:[lf]},$$scope:{ctx:t}}}),h=new Mh({props:{name:"PermanentDelegate(12)",href:"https://spl.solana.com/token-2022/extensions#permanent-delegate",desc:"Includes an optional permanent delegate",$$slots:{default:[hf]},$$scope:{ctx:t}}}),p=new Mh({props:{name:"TransferHook(14)",href:"https://spl.solana.com/token-2022/extensions#transfer-hook",desc:"Mint requires a CPI to a program implementing the 'transfer hook' interface",$$slots:{default:[ff]},$$scope:{ctx:t}}}),g=new Mh({props:{name:"MetadataPointer(18)",href:"https://spl.solana.com/token-2022/extensions#metadata-pointer",desc:"Mint contains a pointer to another account (or the same account) that holds metadata",$$slots:{default:[pf]},$$scope:{ctx:t}}}),b=new Mh({props:{name:"TokenMetadata(19)",href:"https://spl.solana.com/token-2022/extensions#metadata",desc:"Mint contains token-metadata",$$slots:{default:[mf]},$$scope:{ctx:t}}}),{c(){_&&_.c(),e=I(),ht(n.$$.fragment),r=I(),ht(i.$$.fragment),o=I(),ht(s.$$.fragment),a=I(),ht(u.$$.fragment),c=I(),ht(d.$$.fragment),l=I(),ht(h.$$.fragment),f=I(),ht(p.$$.fragment),m=I(),ht(g.$$.fragment),y=I(),ht(b.$$.fragment)},m(t,k){_&&_.m(t,k),v(t,e,k),ft(n,t,k),v(t,r,k),ft(i,t,k),v(t,o,k),ft(s,t,k),v(t,a,k),ft(u,t,k),v(t,c,k),ft(d,t,k),v(t,l,k),ft(h,t,k),v(t,f,k),ft(p,t,k),v(t,m,k),ft(g,t,k),v(t,y,k),ft(b,t,k),w=!0},p(t,r){t[2].parsed.unknownExtensions.length>0?_?(_.p(t,r),2&r&&ot(_,1)):(_=of(t),_.c(),ot(_,1),_.m(e.parentNode,e)):_&&(rt(),st(_,1,1,(()=>{_=null})),it());const o={};10&r&&(o.$$scope={dirty:r,ctx:t}),n.$set(o);const a={};10&r&&(a.$$scope={dirty:r,ctx:t}),i.$set(a);const c={};10&r&&(c.$$scope={dirty:r,ctx:t}),s.$set(c);const l={};10&r&&(l.$$scope={dirty:r,ctx:t}),u.$set(l);const f={};10&r&&(f.$$scope={dirty:r,ctx:t}),d.$set(f);const m={};10&r&&(m.$$scope={dirty:r,ctx:t}),h.$set(m);const y={};10&r&&(y.$$scope={dirty:r,ctx:t}),p.$set(y);const w={};10&r&&(w.$$scope={dirty:r,ctx:t}),g.$set(w);const v={};10&r&&(v.$$scope={dirty:r,ctx:t}),b.$set(v)},i(t){w||(ot(_),ot(n.$$.fragment,t),ot(i.$$.fragment,t),ot(s.$$.fragment,t),ot(u.$$.fragment,t),ot(d.$$.fragment,t),ot(h.$$.fragment,t),ot(p.$$.fragment,t),ot(g.$$.fragment,t),ot(b.$$.fragment,t),w=!0)},o(t){st(_),st(n.$$.fragment,t),st(i.$$.fragment,t),st(s.$$.fragment,t),st(u.$$.fragment,t),st(d.$$.fragment,t),st(h.$$.fragment,t),st(p.$$.fragment,t),st(g.$$.fragment,t),st(b.$$.fragment,t),w=!1},d(t){_&&_.d(t),t&&k(e),pt(n,t),t&&k(r),pt(i,t),t&&k(o),pt(s,t),t&&k(a),pt(u,t),t&&k(c),pt(d,t),t&&k(l),pt(h,t),t&&k(f),pt(p,t),t&&k(m),pt(g,t),t&&k(y),pt(b,t)}}}function yf(t){let e,n,r,i,o,s,a,u,c,d;return e=new vt({props:{name:"decimals",type:"u8",offset:"44",$$slots:{default:[tf]},$$scope:{ctx:t}}}),r=new vt({props:{name:"supply",type:"u64",offset:"36",$$slots:{default:[ef]},$$scope:{ctx:t}}}),o=new vt({props:{name:"mintAuthority",type:"COption",offset:"COption(0)+PublicKey(4)",$$slots:{default:[nf]},$$scope:{ctx:t}}}),a=new vt({props:{name:"freezeAuthority",type:"COption",offset:"COption(46)+PublicKey(50)",$$slots:{default:[rf]},$$scope:{ctx:t}}}),c=new vt({props:{name:"extensions",$$slots:{default:[gf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment)},m(t,l){ft(e,t,l),v(t,n,l),ft(r,t,l),v(t,i,l),ft(o,t,l),v(t,s,l),ft(a,t,l),v(t,u,l),ft(c,t,l),d=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const l={};10&n&&(l.$$scope={dirty:n,ctx:t}),c.$set(l)},i(t){d||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),d=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),d=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t)}}}function bf(t){let e,n=t[2].derived.supply+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supply+"")&&B(e,n)},d(t){t&&k(e)}}}function wf(t){let e,n;return e=new vt({props:{name:"supply",$$slots:{default:[bf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function _f(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[yf]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[wf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function vf(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function kf(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/state.rs#L22"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:vf,then:Qh,catch:Jh,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("💎Token2022::Mint "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Mf(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=Ml(e,r,qr),s=function(t){const e=El(Al.TransferFeeConfig,t.tlvData);return null!==e?Bl.decode(e):null}(o),a=function(t){const e=El(Al.MintCloseAuthority,t.tlvData);return null!==e?jl.decode(e):null}(o),u=function(t){const e=El(Al.DefaultAccountState,t.tlvData);return null!==e?Yl.decode(e):null}(o),c=function(t){const e=El(Al.NonTransferable,t.tlvData);return null!==e?Dl.decode(e):null}(o),d=function(t){const e=El(Al.InterestBearingConfig,t.tlvData);return null!==e?Fl.decode(e):null}(o),l=function(t){const e=El(Al.PermanentDelegate,t.tlvData);return null!==e?Wl.decode(e):null}(o),h=function(t){const e=El(Al.TransferHook,t.tlvData);return null!==e?Cl.decode(e):null}(o),f=function(t){const e=El(Al.MetadataPointer,t.tlvData);if(null!==e){const{authority:t,metadataAddress:n}=Hl.decode(e);return{authority:t.equals(Mt.PublicKey.default)?null:t,metadataAddress:n.equals(Mt.PublicKey.default)?null:n}}return null}(o),p=(()=>{const t=El(Al.TokenMetadata,o.tlvData);return null===t?null:function(t){const e=yh.decode(t);return function(t){for(let e=0;e{switch(t){case Al.TransferFeeConfig:case Al.MintCloseAuthority:case Al.DefaultAccountState:case Al.NonTransferable:case Al.InterestBearingConfig:case Al.PermanentDelegate:case Al.TransferHook:case Al.MetadataPointer:case Al.TokenMetadata:return!1;default:return!0}}));return{meta:Xn(e,r,i),parsed:{base:o,extensions:{transferFeeConfig:s,mintCloseAuthority:a,defaultAccountState:u,nonTransferable:c,interestBearingConfig:d,permanentDelegate:l,transferHook:h,metadataPointer:f,tokenMetadata:p},unknownExtensions:m},derived:{supply:bn.DecimalUtil.fromBN(new(_n())(o.supply.toString()),o.decimals)}}}(i.pubkey))},[i,r]}var Af=n(64188);function Sf(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function If(t){let e,n,r,i;return e=new pr({props:{accountType:"tokenswap/swapstate",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Gf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function xf(t){let e,n=t[2].parsed.bumpSeed+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.bumpSeed+"")&&B(e,n)},d(t){t&&k(e)}}}function Ef(t){let e,n;return e=new Gn({props:{address:t[2].parsed.tokenProgramId}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.tokenProgramId),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Tf(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.vaultA}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.vaultA),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Pf(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.vaultB}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.vaultB),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Bf(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.poolMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.poolMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Lf(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.mintA}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.mintA),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function $f(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.mintB}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.mintB),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Rf(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.poolFeeAccount}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.poolFeeAccount),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Of(t){let e,n,r,i=t[2].parsed.traderFee.numerator+"",o=t[2].parsed.traderFee.denominator+"";return{c(){e=S(i),n=S(" / "),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].parsed.traderFee.numerator+"")&&B(e,i),2&n&&o!==(o=t[2].parsed.traderFee.denominator+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Df(t){let e,n,r,i=t[2].parsed.ownerFee.numerator+"",o=t[2].parsed.ownerFee.denominator+"";return{c(){e=S(i),n=S(" / "),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].parsed.ownerFee.numerator+"")&&B(e,i),2&n&&o!==(o=t[2].parsed.ownerFee.denominator+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Cf(t){let e,n=t[2].parsed.curveType+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.curveType+"")&&B(e,n)},d(t){t&&k(e)}}}function Nf(t){let e,n;return e=new vt({props:{name:"amp",type:"u64",offset:"284",$$slots:{default:[zf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function zf(t){let e,n=t[2].parsed.amp+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.amp+"")&&B(e,n)},d(t){t&&k(e)}}}function Uf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,E;e=new vt({props:{name:"bumpSeed",type:"u8",offset:"2",$$slots:{default:[xf]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tokenProgram",type:"PublicKey",offset:"3",$$slots:{default:[Ef]},$$scope:{ctx:t}}}),o=new vt({props:{name:"vaultA",type:"PublicKey",offset:"35",$$slots:{default:[Tf]},$$scope:{ctx:t}}}),a=new vt({props:{name:"vaultB",type:"PublicKey",offset:"67",$$slots:{default:[Pf]},$$scope:{ctx:t}}}),c=new vt({props:{name:"poolMint",type:"PublicKey",offset:"99",$$slots:{default:[Bf]},$$scope:{ctx:t}}}),l=new vt({props:{name:"mintA",type:"PublicKey",offset:"131",$$slots:{default:[Lf]},$$scope:{ctx:t}}}),f=new vt({props:{name:"mintB",type:"PublicKey",offset:"163",$$slots:{default:[$f]},$$scope:{ctx:t}}}),m=new vt({props:{name:"poolFeeAccount",type:"PublicKey",offset:"195",$$slots:{default:[Rf]},$$scope:{ctx:t}}}),y=new vt({props:{name:"traderFee",type:"u64, u64",offset:"u64(227)+u64(235)",$$slots:{default:[Of]},$$scope:{ctx:t}}}),w=new vt({props:{name:"ownerFee",type:"u64, u64",offset:"u64(243)+u64(251)",$$slots:{default:[Df]},$$scope:{ctx:t}}}),M=new vt({props:{name:"curveType",type:"u8",offset:"283",$$slots:{default:[Cf]},$$scope:{ctx:t}}});let T="Stable"===t[2].parsed.curveType&&Nf(t);return{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment),A=I(),T&&T.c(),S=x()},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),v(t,A,k),T&&T.m(t,k),v(t,S,k),E=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};10&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k),"Stable"===t[2].parsed.curveType?T?(T.p(t,n),2&n&&ot(T,1)):(T=Nf(t),T.c(),ot(T,1),T.m(S.parentNode,S)):T&&(rt(),st(T,1,1,(()=>{T=null})),it())},i(t){E||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),ot(T),E=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),st(T),E=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t),t&&k(A),T&&T.d(t),t&&k(S)}}}function jf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w;return u=new Gn({props:{type:"tokenswap/swapstate",address:t[2].meta.pubkey}}),f=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].derived.aquaFarm}}),b=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].derived.doubleDip}}),{c(){e=A("table"),n=A("thead"),n.innerHTML='accountpubkey',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),s.textContent="pool",a=A("td"),ht(u.$$.fragment),c=I(),d=A("tr"),l=A("td"),l.textContent="aquafarm",h=A("td"),ht(f.$$.fragment),p=I(),m=A("tr"),g=A("td"),g.textContent="doubledip",y=A("td"),ht(b.$$.fragment),P(s,"class","svelte-1i4wn2p"),P(a,"class","svelte-1i4wn2p"),P(l,"class","svelte-1i4wn2p"),P(h,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(y,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(o,a),ft(u,a,null),_(i,c),_(i,d),_(d,l),_(d,h),ft(f,h,null),_(i,p),_(i,m),_(m,g),_(m,y),ft(b,y,null),w=!0},p(t,e){const n={};2&e&&(n.address=t[2].meta.pubkey),u.$set(n);const r={};2&e&&(r.address=t[2].derived.aquaFarm),f.$set(r);const i={};2&e&&(i.address=t[2].derived.doubleDip),b.$set(i)},i(t){w||(ot(u.$$.fragment,t),ot(f.$$.fragment,t),ot(b.$$.fragment,t),w=!0)},o(t){st(u.$$.fragment,t),st(f.$$.fragment,t),st(b.$$.fragment,t),w=!1},d(t){t&&k(e),pt(u),pt(f),pt(b)}}}function Yf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,x,E,T=Jf(t[2].derived.tokenInfoA)+"",L=t[2].derived.decimalsA+"",R=Jf(t[2].derived.tokenInfoB)+"",O=t[2].derived.decimalsB+"",D=t[2].derived.decimalsLP+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokendecimals',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("A"),u=S(T),c=A("td"),d=S(L),l=I(),h=A("tr"),f=A("td"),p=S("B"),m=S(R),g=A("td"),y=S(O),b=I(),w=A("tr"),M=A("td"),M.textContent="LP",x=A("td"),E=S(D),P(s,"class","svelte-1i4wn2p"),P(c,"class","svelte-1i4wn2p"),P(f,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(M,"class","svelte-1i4wn2p"),P(x,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y),_(i,b),_(i,w),_(w,M),_(w,x),_(x,E)},p(t,e){2&e&&T!==(T=Jf(t[2].derived.tokenInfoA)+"")&&B(u,T),2&e&&L!==(L=t[2].derived.decimalsA+"")&&B(d,L),2&e&&R!==(R=Jf(t[2].derived.tokenInfoB)+"")&&B(m,R),2&e&&O!==(O=t[2].derived.decimalsB+"")&&B(y,O),2&e&&D!==(D=t[2].derived.decimalsLP+"")&&B(E,D)},d(t){t&&k(e)}}}function Ff(t){let e,n=t[2].derived.supplyLP+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supplyLP+"")&&B(e,n)},d(t){t&&k(e)}}}function Wf(t){let e,n,r,i=t[2].derived.price+"",o=Qf(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"";return{c(){e=S(i),n=I(),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].derived.price+"")&&B(e,i),2&n&&o!==(o=Qf(t[2].derived.tokenInfoA,t[2].derived.tokenInfoB)+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function Hf(t){let e,n,r=t[2].derived.feeRate+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.feeRate+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function Kf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b=Jf(t[2].derived.tokenInfoA)+"",w=t[2].derived.tokenVaultAAmount+"",M=Jf(t[2].derived.tokenInfoB)+"",x=t[2].derived.tokenVaultBAmount+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokenamount',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),a=S("A"),u=S(b),c=A("td"),d=S(w),l=I(),h=A("tr"),f=A("td"),p=S("B"),m=S(M),g=A("td"),y=S(x),P(s,"class","svelte-1i4wn2p"),P(c,"class","svelte-1i4wn2p"),P(f,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,b){v(t,e,b),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(s,a),_(s,u),_(o,c),_(c,d),_(i,l),_(i,h),_(h,f),_(f,p),_(f,m),_(h,g),_(g,y)},p(t,e){2&e&&b!==(b=Jf(t[2].derived.tokenInfoA)+"")&&B(u,b),2&e&&w!==(w=t[2].derived.tokenVaultAAmount+"")&&B(d,w),2&e&&M!==(M=Jf(t[2].derived.tokenInfoB)+"")&&B(m,M),2&e&&x!==(x=t[2].derived.tokenVaultBAmount+"")&&B(y,x)},d(t){t&&k(e)}}}function qf(t){let e,n=t[2].derived.poolFeeAccountAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.poolFeeAccountAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function Vf(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p;return e=new vt({props:{name:"pool / aquafarm / doubledip",$$slots:{default:[jf]},$$scope:{ctx:t}}}),r=new vt({props:{name:"decimals",$$slots:{default:[Yf]},$$scope:{ctx:t}}}),o=new vt({props:{name:"LP token supply",$$slots:{default:[Ff]},$$scope:{ctx:t}}}),a=new vt({props:{name:"price",$$slots:{default:[Wf]},$$scope:{ctx:t}}}),c=new vt({props:{name:"fee rate",$$slots:{default:[Hf]},$$scope:{ctx:t}}}),l=new vt({props:{name:"token vault amount",$$slots:{default:[Kf]},$$scope:{ctx:t}}}),f=new vt({props:{name:"pool fee account amount",$$slots:{default:[qf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment)},m(t,m){ft(e,t,m),v(t,n,m),ft(r,t,m),v(t,i,m),ft(o,t,m),v(t,s,m),ft(a,t,m),v(t,u,m),ft(c,t,m),v(t,d,m),ft(l,t,m),v(t,h,m),ft(f,t,m),p=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const m={};10&n&&(m.$$scope={dirty:n,ctx:t}),f.$set(m)},i(t){p||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),p=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),p=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t)}}}function Gf(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Uf]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Vf]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Zf(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Xf(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/solana-labs/solana-program-library/blob/master/token-swap/program/src/state.rs#L104"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Zf,then:If,catch:Sf,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("⚖️TokenSwap::SwapState "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Jf(t,e=!1){return void 0===t?"":e?t.symbol:`(${t.symbol})`}function Qf(t,e){return void 0===t||void 0===e?"":`${e.symbol}/${t.symbol}`}function tp(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){var e,n;const r=bn.AddressUtil.toPubKey(t),i=It(),o=(0,jr.buildDefaultAccountFetcher)(i),{accountInfo:s,slotContext:a}=await Zn(i,r),u=function(t){if(324!==t.length)return null;const e=new DataView(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength));let n=2;const r=e.getUint8(n);n+=1;const i=new Mt.PublicKey(t.slice(n,n+32));n+=32;const o=new Mt.PublicKey(t.slice(n,n+32));n+=32;const s=new Mt.PublicKey(t.slice(n,n+32));n+=32;const a=new Mt.PublicKey(t.slice(n,n+32));n+=32;const u=new Mt.PublicKey(t.slice(n,n+32));n+=32;const c=new Mt.PublicKey(t.slice(n,n+32));n+=32;const d=new Mt.PublicKey(t.slice(n,n+32));n+=32;const l=Number(e.getBigUint64(n,!0));n+=8;const h=Number(e.getBigUint64(n,!0));n+=8;const f=Number(e.getBigUint64(n,!0));n+=8;const p=Number(e.getBigUint64(n,!0));n+=8,n+=32;const m=e.getUint8(n);n+=1;const g=Number(e.getBigUint64(n,!0));return n+=8,{bumpSeed:r,tokenProgramId:i,vaultA:o,vaultB:s,poolMint:a,mintA:u,mintB:c,poolFeeAccount:d,traderFee:bn.Percentage.fromFraction(l,h),ownerFee:bn.Percentage.fromFraction(f,p),curveType:0===m?"ConstantProduct":"Stable",amp:0===m?void 0:g}}(s.data),c=Array.from((await o.getMintInfos([u.mintA,u.mintB,u.poolMint],jr.IGNORE_CACHE)).values()),d=await Rn(),l=d.getTokenInfoByMint(u.mintA),h=d.getTokenInfoByMint(u.mintB),f=Array.from((await o.getTokenInfos([u.vaultA,u.vaultB,u.poolFeeAccount],jr.IGNORE_CACHE)).values()),p=bn.DecimalUtil.fromBN(f[0].amount,c[0].decimals),m=bn.DecimalUtil.fromBN(f[1].amount,c[1].decimals),g=c[0].decimals,y=c[1].decimals;let b=new fn(0);"ConstantProduct"!==u.curveType||p.isZero()||(b=Jn(m.div(p),y)),"Stable"===u.curveType&&(b=bn.DecimalUtil.fromBN((0,Af.Ek)(new kt.BN(1*10**g),f[0].amount,f[1].amount,new kt.BN(u.amp)),y));let w=u.traderFee;u.ownerFee.denominator.isZero()||(w=w.add(u.ownerFee));const _=await Nn(),v=_.getAquaFarmByAddress(u.poolMint),k=_.getDoubleDipByAddress(null==v?void 0:v.farmTokenMint),M=null==v?void 0:v.account,A=null==k?void 0:k.account;return{meta:Xn(r,s,a),parsed:u,derived:{decimalsA:c[0].decimals,decimalsB:c[1].decimals,decimalsLP:c[2].decimals,tokenInfoA:l,tokenInfoB:h,supplyLP:bn.DecimalUtil.fromBN(c[2].supply,c[2].decimals),tokenVaultAAmount:bn.DecimalUtil.fromBN(f[0].amount,c[0].decimals),tokenVaultBAmount:bn.DecimalUtil.fromBN(f[1].amount,c[1].decimals),poolFeeAccountAmount:bn.DecimalUtil.fromBN(null!==(n=null===(e=f[2])||void 0===e?void 0:e.amount)&&void 0!==n?n:new kt.BN(0),c[2].decimals),feeRate:w.toDecimal().mul(100),price:b,aquaFarm:M,doubleDip:A}}}(i.pubkey))},[i,r]}function ep(t,e,n){const r=t.slice();return r[7]=e[n],r}function np(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function rp(t){let e,n,r,i,o,s=t[6],a=[];for(let e=0;est(a[t],1,1,(()=>{a[t]=null}));return{c(){e=A("table"),n=A("thead"),n.innerHTML='namedeprecatedaquafarmdoubledipdoubledip reward',r=I(),i=A("tbody");for(let t=0;t{x=null})),it()),t[7].doubledip?E?(E.p(t,e),2&e&&ot(E,1)):(E=sp(t),E.c(),ot(E,1),E.m(f,null)):E&&(rt(),st(E,1,1,(()=>{E=null})),it()),t[7].doubledip?T?(T.p(t,e),2&e&&ot(T,1)):(T=ap(t),T.c(),ot(T,1),T.m(m,null)):T&&(rt(),st(T,1,1,(()=>{T=null})),it())},i(t){y||(ot(x),ot(E),ot(T),y=!0)},o(t){st(x),st(E),st(T),y=!1},d(t){t&&k(e),M&&M.d(),x&&x.d(),E&&E.d(),T&&T.d()}}}function cp(e){let n;return{c(){n=S("loading...")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&k(n)}}}function dp(t){let e,n,r,i,s,a,u,c,d,l,h,f,p={ctx:t,current:null,token:null,hasCatch:!1,pending:cp,then:rp,catch:np,value:6,blocks:[,,,]};return at(d=t[1],p),{c(){e=A("h2"),e.textContent="⚖️TokenSwap::list",n=I(),r=A("form"),i=A("input"),s=I(),a=A("input"),u=I(),c=x(),p.block.c(),$(i,"margin","0.5em 0em"),P(i,"type","text"),P(i,"size","64"),P(i,"placeholder","SOL/USDC"),P(a,"type","submit"),a.value="Set Filter!",$(r,"margin-bottom","1em")},m(o,d){v(o,e,d),v(o,n,d),v(o,r,d),_(r,i),L(i,t[0]),_(r,s),_(r,a),v(o,u,d),v(o,c,d),p.block.m(o,p.anchor=d),p.mount=()=>c.parentNode,p.anchor=c,l=!0,h||(f=[E(i,"input",t[4]),E(r,"submit",T(t[2]))],h=!0)},p(e,[n]){t=e,1&n&&i.value!==t[0]&&L(i,t[0]),p.ctx=t,2&n&&d!==(d=t[1])&&at(d,p)||ut(p,t,n)},i(t){l||(ot(p.block),l=!0)},o(t){for(let t=0;t<3;t+=1)st(p.blocks[t]);l=!1},d(t){t&&k(e),t&&k(n),t&&k(r),t&&k(u),t&&k(c),p.block.d(t),p.token=null,p=null,h=!1,o(f)}}}function lp(t,e,n){let r,i,o;return t.$$.update=()=>{8&t.$$.dirty&&n(1,i=async function(t){return(await Nn()).tuples.filter((e=>0==t.length||-1!=e.pool.name.toUpperCase().indexOf(t.toUpperCase())))}(r))},n(3,r=""),[o,i,function(){n(3,r=o)},r,function(){o=this.value,n(0,o)}]}var hp=n(71794),fp=n(20880),pp=n(61401);async function mp(t){var e;const n=bn.AddressUtil.toPubKey(t),r=It(),i=(0,jr.buildDefaultAccountFetcher)(r),{accountInfo:o,slotContext:s}=await Zn(r,n),a=(0,pp.decodeGlobalFarmBuffer)(o),u=Array.from((await i.getTokenInfos([a.baseTokenVault,a.rewardTokenVault],jr.IGNORE_CACHE)).values()),c=u[1].mint,d=Array.from((await i.getMintInfos([a.baseTokenMint,a.farmTokenMint,c],jr.IGNORE_CACHE)).values()),l=d[0].decimals,h=d[1].decimals,f=d[2].decimals,p=bn.DecimalUtil.fromBN(d[0].supply,l),m=bn.DecimalUtil.fromBN(d[1].supply,h),g=bn.DecimalUtil.fromBN(u[1].amount,f),y=(await(0,fp.getAuthorityAndNonce)(n,o.owner))[0];let b=new fn(0);if(!a.emissionsPerSecondDenominator.isZero()){const t=604800,e=new fn(a.emissionsPerSecondNumerator.toString()),n=new fn(a.emissionsPerSecondDenominator.toString());b=Jn(bn.DecimalUtil.adjustDecimals(e.mul(t).div(n),f),f)}const w=await Nn();let _,v,k,M;const A=void 0!==w.getAquaFarmByAddress(n);if(A){const t=w.getAquaFarmByAddress(n);_=w.getPoolByAddress(t.baseTokenMint).account,k=t.account,M=null===(e=w.getDoubleDipByAddress(t.farmTokenMint))||void 0===e?void 0:e.account,v=w.getPoolByAddress(t.baseTokenMint).name}const S=void 0!==w.getDoubleDipByAddress(n);if(S){const t=w.getDoubleDipByAddress(n),e=w.getAquaFarmByAddress(t.baseTokenMint);M=t.account,k=e.account,_=w.getPoolByAddress(e.baseTokenMint).account,v=w.getPoolByAddress(e.baseTokenMint).name}return{meta:Xn(n,o,s),parsed:a,derived:{authority:y,rewardMint:c,decimalsBase:l,decimalsFarm:h,decimalsReward:f,supplyBase:p,supplyFarm:m,rewardVaultAmount:g,lastUpdatedTimestamp:yn().unix(a.lastUpdatedTimestamp.toNumber()),rewardWeeklyEmission:b,isAquaFarm:A,isDoubleDip:S,pool:_,aquaFarm:k,doubleDip:M,poolName:v}}}function gp(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function yp(t){let e,n,r,i;return e=new pr({props:{accountType:"aquafarm/globalfarm",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[Fp]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function bp(t){let e,n=t[2].parsed.nonce+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.nonce+"")&&B(e,n)},d(t){t&&k(e)}}}function wp(t){let e,n;return e=new Gn({props:{address:t[2].parsed.tokenProgramId}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.tokenProgramId),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function _p(t){let e,n;return e=new Gn({props:{address:t[2].parsed.emissionsAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.emissionsAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function vp(t){let e,n;return e=new Gn({props:{address:t[2].parsed.removeRewardsAuthority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.removeRewardsAuthority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function kp(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.baseTokenMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.baseTokenMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Mp(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.baseTokenVault}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.baseTokenVault),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ap(t){let e,n;return e=new Gn({props:{type:"token/account",address:t[2].parsed.rewardTokenVault}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.rewardTokenVault),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Sp(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].parsed.farmTokenMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.farmTokenMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ip(t){let e,n,r,i=t[2].parsed.emissionsPerSecondNumerator+"",o=t[2].parsed.emissionsPerSecondDenominator+"";return{c(){e=S(i),n=S(" / "),r=S(o)},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i)},p(t,n){2&n&&i!==(i=t[2].parsed.emissionsPerSecondNumerator+"")&&B(e,i),2&n&&o!==(o=t[2].parsed.emissionsPerSecondDenominator+"")&&B(r,o)},d(t){t&&k(e),t&&k(n),t&&k(r)}}}function xp(t){let e,n=t[2].parsed.lastUpdatedTimestamp+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.lastUpdatedTimestamp+"")&&B(e,n)},d(t){t&&k(e)}}}function Ep(t){let e,n=t[2].parsed.cumulativeEmissionsPerFarmToken+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.cumulativeEmissionsPerFarmToken+"")&&B(e,n)},d(t){t&&k(e)}}}function Tp(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A;return e=new vt({props:{name:"nonce",type:"u8",offset:"2",$$slots:{default:[bp]},$$scope:{ctx:t}}}),r=new vt({props:{name:"tokenProgramId",type:"PublicKey",offset:"3",$$slots:{default:[wp]},$$scope:{ctx:t}}}),o=new vt({props:{name:"emissionsAuthority",type:"PublicKey",offset:"35",$$slots:{default:[_p]},$$scope:{ctx:t}}}),a=new vt({props:{name:"removeRewardsAuthority",type:"PublicKey",offset:"67",$$slots:{default:[vp]},$$scope:{ctx:t}}}),c=new vt({props:{name:"baseTokenMint",type:"PublicKey",offset:"99",$$slots:{default:[kp]},$$scope:{ctx:t}}}),l=new vt({props:{name:"baseTokenVault",type:"PublicKey",offset:"131",$$slots:{default:[Mp]},$$scope:{ctx:t}}}),f=new vt({props:{name:"rewardTokenVault",type:"PublicKey",offset:"163",$$slots:{default:[Ap]},$$scope:{ctx:t}}}),m=new vt({props:{name:"farmTokenMint",type:"PublicKey",offset:"195",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),y=new vt({props:{name:"emissionsPerSecondNumerator/Denominator",type:"u64, u64",offset:"u64(227)+u64(235)",$$slots:{default:[Ip]},$$scope:{ctx:t}}}),w=new vt({props:{name:"lastUpdatedTimestamp",type:"u64",offset:"243",$$slots:{default:[xp]},$$scope:{ctx:t}}}),M=new vt({props:{name:"cumulativeEmissionsPerFarmToken",type:"u256",offset:"251",$$slots:{default:[Ep]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),A=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};10&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k)},i(t){A||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),A=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),A=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t)}}}function Pp(t){let e,n=t[2].derived.isAquaFarm+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isAquaFarm+"")&&B(e,n)},d(t){t&&k(e)}}}function Bp(t){let e,n=t[2].derived.isDoubleDip+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.isDoubleDip+"")&&B(e,n)},d(t){t&&k(e)}}}function Lp(t){let e,n=t[2].derived.poolName+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.poolName+"")&&B(e,n)},d(t){t&&k(e)}}}function $p(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w;return u=new Gn({props:{type:"tokenswap/swapstate",address:t[2].derived.pool}}),f=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].derived.aquaFarm}}),b=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].derived.doubleDip}}),{c(){e=A("table"),n=A("thead"),n.innerHTML='accountpubkey',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),s.textContent="pool",a=A("td"),ht(u.$$.fragment),c=I(),d=A("tr"),l=A("td"),l.textContent="aquafarm",h=A("td"),ht(f.$$.fragment),p=I(),m=A("tr"),g=A("td"),g.textContent="doubledip",y=A("td"),ht(b.$$.fragment),P(s,"class","svelte-1i4wn2p"),P(a,"class","svelte-1i4wn2p"),P(l,"class","svelte-1i4wn2p"),P(h,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(y,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,k){v(t,e,k),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(o,a),ft(u,a,null),_(i,c),_(i,d),_(d,l),_(d,h),ft(f,h,null),_(i,p),_(i,m),_(m,g),_(m,y),ft(b,y,null),w=!0},p(t,e){const n={};2&e&&(n.address=t[2].derived.pool),u.$set(n);const r={};2&e&&(r.address=t[2].derived.aquaFarm),f.$set(r);const i={};2&e&&(i.address=t[2].derived.doubleDip),b.$set(i)},i(t){w||(ot(u.$$.fragment,t),ot(f.$$.fragment,t),ot(b.$$.fragment,t),w=!0)},o(t){st(u.$$.fragment,t),st(f.$$.fragment,t),st(b.$$.fragment,t),w=!1},d(t){t&&k(e),pt(u),pt(f),pt(b)}}}function Rp(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w=t[2].derived.decimalsBase+"",M=t[2].derived.decimalsFarm+"",x=t[2].derived.decimalsReward+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokendecimals',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),s.textContent="Base",a=A("td"),u=S(w),c=I(),d=A("tr"),l=A("td"),l.textContent="Farm",h=A("td"),f=S(M),p=I(),m=A("tr"),g=A("td"),g.textContent="Reward",y=A("td"),b=S(x),P(s,"class","svelte-1i4wn2p"),P(a,"class","svelte-1i4wn2p"),P(l,"class","svelte-1i4wn2p"),P(h,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(y,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,w){v(t,e,w),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(o,a),_(a,u),_(i,c),_(i,d),_(d,l),_(d,h),_(h,f),_(i,p),_(i,m),_(m,g),_(m,y),_(y,b)},p(t,e){2&e&&w!==(w=t[2].derived.decimalsBase+"")&&B(u,w),2&e&&M!==(M=t[2].derived.decimalsFarm+"")&&B(f,M),2&e&&x!==(x=t[2].derived.decimalsReward+"")&&B(b,x)},d(t){t&&k(e)}}}function Op(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].derived.rewardMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.rewardMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Dp(t){let e,n;return e=new Gn({props:{address:t[2].derived.authority}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.authority),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Cp(t){let e,n=t[2].derived.supplyBase+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supplyBase+"")&&B(e,n)},d(t){t&&k(e)}}}function Np(t){let e,n=t[2].derived.supplyFarm+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.supplyFarm+"")&&B(e,n)},d(t){t&&k(e)}}}function zp(t){let e,n=t[2].derived.rewardVaultAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.rewardVaultAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function Up(t){let e,n=t[2].derived.rewardWeeklyEmission+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.rewardWeeklyEmission+"")&&B(e,n)},d(t){t&&k(e)}}}function jp(t){let e,n=t[2].derived.lastUpdatedTimestamp.format("YYYY/MM/DD HH:mm:ss UTCZZ")+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.lastUpdatedTimestamp.format("YYYY/MM/DD HH:mm:ss UTCZZ")+"")&&B(e,n)},d(t){t&&k(e)}}}function Yp(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w,_,M,A,S,x;return e=new vt({props:{name:"is aquafarm",$$slots:{default:[Pp]},$$scope:{ctx:t}}}),r=new vt({props:{name:"is doubledip",$$slots:{default:[Bp]},$$scope:{ctx:t}}}),o=new vt({props:{name:"pool",$$slots:{default:[Lp]},$$scope:{ctx:t}}}),a=new vt({props:{name:"pool / aquafarm / doubledip",$$slots:{default:[$p]},$$scope:{ctx:t}}}),c=new vt({props:{name:"decimals",$$slots:{default:[Rp]},$$scope:{ctx:t}}}),l=new vt({props:{name:"rewardMint",$$slots:{default:[Op]},$$scope:{ctx:t}}}),f=new vt({props:{name:"authority",$$slots:{default:[Dp]},$$scope:{ctx:t}}}),m=new vt({props:{name:"base token supply",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),y=new vt({props:{name:"farm token supply",$$slots:{default:[Np]},$$scope:{ctx:t}}}),w=new vt({props:{name:"reward vault amount",$$slots:{default:[zp]},$$scope:{ctx:t}}}),M=new vt({props:{name:"reward weekly emission",$$slots:{default:[Up]},$$scope:{ctx:t}}}),S=new vt({props:{name:"reward last updated timestamp",$$slots:{default:[jp]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment),p=I(),ht(m.$$.fragment),g=I(),ht(y.$$.fragment),b=I(),ht(w.$$.fragment),_=I(),ht(M.$$.fragment),A=I(),ht(S.$$.fragment)},m(t,k){ft(e,t,k),v(t,n,k),ft(r,t,k),v(t,i,k),ft(o,t,k),v(t,s,k),ft(a,t,k),v(t,u,k),ft(c,t,k),v(t,d,k),ft(l,t,k),v(t,h,k),ft(f,t,k),v(t,p,k),ft(m,t,k),v(t,g,k),ft(y,t,k),v(t,b,k),ft(w,t,k),v(t,_,k),ft(M,t,k),v(t,A,k),ft(S,t,k),x=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const g={};10&n&&(g.$$scope={dirty:n,ctx:t}),f.$set(g);const b={};10&n&&(b.$$scope={dirty:n,ctx:t}),m.$set(b);const _={};10&n&&(_.$$scope={dirty:n,ctx:t}),y.$set(_);const v={};10&n&&(v.$$scope={dirty:n,ctx:t}),w.$set(v);const k={};10&n&&(k.$$scope={dirty:n,ctx:t}),M.$set(k);const A={};10&n&&(A.$$scope={dirty:n,ctx:t}),S.$set(A)},i(t){x||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),ot(m.$$.fragment,t),ot(y.$$.fragment,t),ot(w.$$.fragment,t),ot(M.$$.fragment,t),ot(S.$$.fragment,t),x=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),st(m.$$.fragment,t),st(y.$$.fragment,t),st(w.$$.fragment,t),st(M.$$.fragment,t),st(S.$$.fragment,t),x=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t),t&&k(p),pt(m,t),t&&k(g),pt(y,t),t&&k(b),pt(w,t),t&&k(_),pt(M,t),t&&k(A),pt(S,t)}}}function Fp(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Tp]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[Yp]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Wp(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Hp(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/aquafarm-sdk/blob/main/src/utils/layout.ts#L102"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:Wp,then:yp,catch:gp,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🐋AquaFarm::GlobalFarm "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function Kp(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=mp(i.pubkey))},[i,r]}function qp(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Vp(t){let e,n,r,i;return e=new pr({props:{accountType:"aquafarm/userfarm",meta:t[2].meta}}),r=new Mr({props:{$$slots:{default:[um]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function Gp(t){let e,n;return e=new Gn({props:{type:"aquafarm/globalfarm",address:t[2].parsed.globalFarm}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.globalFarm),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Zp(t){let e,n;return e=new Gn({props:{address:t[2].parsed.owner}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].parsed.owner),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Xp(t){let e,n=t[2].parsed.baseTokensConverted+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.baseTokensConverted+"")&&B(e,n)},d(t){t&&k(e)}}}function Jp(t){let e,n=t[2].parsed.cumulativeEmissionsCheckpoint+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].parsed.cumulativeEmissionsCheckpoint+"")&&B(e,n)},d(t){t&&k(e)}}}function Qp(t){let e,n,r,i,o,s,a,u;return e=new vt({props:{name:"globalFarm",type:"PublicKey",offset:"2",$$slots:{default:[Gp]},$$scope:{ctx:t}}}),r=new vt({props:{name:"owner",type:"PublicKey",offset:"34",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),o=new vt({props:{name:"baseTokensConverted",type:"u64",offset:"42",$$slots:{default:[Xp]},$$scope:{ctx:t}}}),a=new vt({props:{name:"cumulativeEmissionsCheckpoint",type:"u256",offset:"50",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment)},m(t,c){ft(e,t,c),v(t,n,c),ft(r,t,c),v(t,i,c),ft(o,t,c),v(t,s,c),ft(a,t,c),u=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const c={};10&n&&(c.$$scope={dirty:n,ctx:t}),a.$set(c)},i(t){u||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),u=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),u=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t)}}}function tm(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p,m,g,y,b,w=t[2].derived.decimalsBase+"",M=t[2].derived.decimalsFarm+"",x=t[2].derived.decimalsReward+"";return{c(){e=A("table"),n=A("thead"),n.innerHTML='tokendecimals',r=I(),i=A("tbody"),o=A("tr"),s=A("td"),s.textContent="Base",a=A("td"),u=S(w),c=I(),d=A("tr"),l=A("td"),l.textContent="Farm",h=A("td"),f=S(M),p=I(),m=A("tr"),g=A("td"),g.textContent="Reward",y=A("td"),b=S(x),P(s,"class","svelte-1i4wn2p"),P(a,"class","svelte-1i4wn2p"),P(l,"class","svelte-1i4wn2p"),P(h,"class","svelte-1i4wn2p"),P(g,"class","svelte-1i4wn2p"),P(y,"class","svelte-1i4wn2p"),$(e,"border-spacing","0")},m(t,w){v(t,e,w),_(e,n),_(e,r),_(e,i),_(i,o),_(o,s),_(o,a),_(a,u),_(i,c),_(i,d),_(d,l),_(d,h),_(h,f),_(i,p),_(i,m),_(m,g),_(m,y),_(y,b)},p(t,e){2&e&&w!==(w=t[2].derived.decimalsBase+"")&&B(u,w),2&e&&M!==(M=t[2].derived.decimalsFarm+"")&&B(f,M),2&e&&x!==(x=t[2].derived.decimalsReward+"")&&B(b,x)},d(t){t&&k(e)}}}function em(t){let e,n;return e=new Gn({props:{type:"token/mint",address:t[2].derived.rewardMint}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.address=t[2].derived.rewardMint),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function nm(t){let e,n=t[2].derived.harvestableAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.harvestableAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function rm(t){let e,n=t[2].derived.currentHarvestableAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.currentHarvestableAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function im(t){let e,n=t[2].derived.rewardWeeklyEmission+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.rewardWeeklyEmission+"")&&B(e,n)},d(t){t&&k(e)}}}function om(t){let e,n,r=t[2].derived.sharePercentOfFarm+"";return{c(){e=S(r),n=S(" %")},m(t,r){v(t,e,r),v(t,n,r)},p(t,n){2&n&&r!==(r=t[2].derived.sharePercentOfFarm+"")&&B(e,r)},d(t){t&&k(e),t&&k(n)}}}function sm(t){let e,n=t[2].derived.rewardWeeklyAmount+"";return{c(){e=S(n)},m(t,n){v(t,e,n)},p(t,r){2&r&&n!==(n=t[2].derived.rewardWeeklyAmount+"")&&B(e,n)},d(t){t&&k(e)}}}function am(t){let e,n,r,i,o,s,a,u,c,d,l,h,f,p;return e=new vt({props:{name:"decimals",$$slots:{default:[tm]},$$scope:{ctx:t}}}),r=new vt({props:{name:"rewardMint",$$slots:{default:[em]},$$scope:{ctx:t}}}),o=new vt({props:{name:"harvestable reward amount",$$slots:{default:[nm]},$$scope:{ctx:t}}}),a=new vt({props:{name:"harvestable reward amount (estimate)",$$slots:{default:[rm]},$$scope:{ctx:t}}}),c=new vt({props:{name:"farm reward weekly emission",$$slots:{default:[im]},$$scope:{ctx:t}}}),l=new vt({props:{name:"share of farm",$$slots:{default:[om]},$$scope:{ctx:t}}}),f=new vt({props:{name:"reward weekly earned",$$slots:{default:[sm]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment),i=I(),ht(o.$$.fragment),s=I(),ht(a.$$.fragment),u=I(),ht(c.$$.fragment),d=I(),ht(l.$$.fragment),h=I(),ht(f.$$.fragment)},m(t,m){ft(e,t,m),v(t,n,m),ft(r,t,m),v(t,i,m),ft(o,t,m),v(t,s,m),ft(a,t,m),v(t,u,m),ft(c,t,m),v(t,d,m),ft(l,t,m),v(t,h,m),ft(f,t,m),p=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const s={};10&n&&(s.$$scope={dirty:n,ctx:t}),r.$set(s);const u={};10&n&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const d={};10&n&&(d.$$scope={dirty:n,ctx:t}),a.$set(d);const h={};10&n&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};10&n&&(p.$$scope={dirty:n,ctx:t}),l.$set(p);const m={};10&n&&(m.$$scope={dirty:n,ctx:t}),f.$set(m)},i(t){p||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),ot(o.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(l.$$.fragment,t),ot(f.$$.fragment,t),p=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),st(o.$$.fragment,t),st(a.$$.fragment,t),st(c.$$.fragment,t),st(l.$$.fragment,t),st(f.$$.fragment,t),p=!1},d(t){pt(e,t),t&&k(n),pt(r,t),t&&k(i),pt(o,t),t&&k(s),pt(a,t),t&&k(u),pt(c,t),t&&k(d),pt(l,t),t&&k(h),pt(f,t)}}}function um(t){let e,n,r,i;return e=new yr({props:{$$slots:{default:[Qp]},$$scope:{ctx:t}}}),r=new _r({props:{$$slots:{default:[am]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment),n=I(),ht(r.$$.fragment)},m(t,o){ft(e,t,o),v(t,n,o),ft(r,t,o),i=!0},p(t,n){const i={};10&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};10&n&&(o.$$scope={dirty:n,ctx:t}),r.$set(o)},i(t){i||(ot(e.$$.fragment,t),ot(r.$$.fragment,t),i=!0)},o(t){st(e.$$.fragment,t),st(r.$$.fragment,t),i=!1},d(t){pt(e,t),t&&k(n),pt(r,t)}}}function cm(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function dm(t){let e,n,r,i,o,s,a;r=new Ir({props:{href:"https://github.com/orca-so/aquafarm-sdk/blob/main/src/utils/layout.ts#L163"}});let u={ctx:t,current:null,token:null,hasCatch:!1,pending:cm,then:Vp,catch:qp,value:2,blocks:[,,,]};return at(s=t[1],u),{c(){e=A("h2"),n=S("🐋AquaFarm::UserFarm "),ht(r.$$.fragment),i=I(),o=x(),u.block.c()},m(t,s){v(t,e,s),_(e,n),ft(r,e,null),v(t,i,s),v(t,o,s),u.block.m(t,u.anchor=s),u.mount=()=>o.parentNode,u.anchor=o,a=!0},p(e,[n]){t=e,u.ctx=t,2&n&&s!==(s=t[1])&&at(s,u)||ut(u,t,n)},i(t){a||(ot(r.$$.fragment,t),ot(u.block),a=!0)},o(t){st(r.$$.fragment,t);for(let t=0;t<3;t+=1)st(u.blocks[t]);a=!1},d(t){t&&k(e),pt(r),t&&k(i),t&&k(o),u.block.d(t),u.token=null,u=null}}}function lm(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e),o=(0,pp.decodeUserFarmBuffer)(r),s=await mp(o.globalFarm),a=s.derived.decimalsReward,u=bn.DecimalUtil.fromBN(o.baseTokensConverted,s.derived.decimalsBase),[c,d]=function(t,e,n){const r=new hp.Aquafarm(new hp.GlobalFarm(Object.assign(Object.assign({},e.parsed),{publicKey:e.meta.pubkey,authority:e.derived.authority})),e.meta.owner,new hp.UserFarm(Object.assign(Object.assign({},n),{publicKey:t}))),i=bn.DecimalUtil.toBN(e.derived.supplyFarm,e.derived.decimalsFarm);return[r.getCurrentHarvestableAmount(i),r.getHarvestableAmount()]}(e,s,o);let l,h;void 0!==c&&(l=bn.DecimalUtil.fromBN(c,a)),void 0!==d&&(h=bn.DecimalUtil.fromBN(d,a));let f=new fn(0);s.derived.supplyFarm.isZero()||(f=Jn(u.mul(100).div(s.derived.supplyFarm),9));const p=Jn(s.derived.rewardWeeklyEmission.mul(f.div(100)),a);return{meta:Xn(e,r,i),parsed:o,derived:{rewardMint:s.derived.rewardMint,decimalsBase:s.derived.decimalsBase,decimalsFarm:s.derived.decimalsFarm,decimalsReward:s.derived.decimalsReward,baseTokensConverted:u,sharePercentOfFarm:f,rewardWeeklyAmount:p,currentHarvestableAmount:l,harvestableAmount:h,rewardWeeklyEmission:s.derived.rewardWeeklyEmission}}}(i.pubkey))},[i,r]}function hm(t,e,n){const r=t.slice();return r[13]=e[n],r[15]=n,r}function fm(t,e,n){const r=t.slice();return r[13]=e[n],r[15]=n,r}function pm(t,e,n){const r=t.slice();return r[13]=e[n],r[18]=n,r}function mm(t,e,n){const r=t.slice();return r[13]=e[n],r[20]=n,r}function gm(t,e,n){const r=t.slice();return r[13]=e[n],r[15]=n,r}function ym(e){let n,r,i,o=(16*e[15]).toString(16).padStart(4,"0")+"";return{c(){n=A("div"),r=S(o),i=S(":")},m(t,e){v(t,n,e),_(n,r),_(n,i)},p:t,d(t){t&&k(n)}}}function bm(t){let e,n,r,i,s,a=t[4].data.toString("hex",16*t[15]+4*t[18]+t[20],16*t[15]+4*t[18]+t[20]+1)+"";function u(){return t[10](t[15],t[18],t[20])}function c(){return t[11](t[15],t[18],t[20])}return{c(){e=A("div"),n=S(a),P(e,"class",r=m(Sm(t[2],16*t[15]+4*t[18]+t[20]))+" svelte-13rs43s")},m(t,r){v(t,e,r),_(e,n),i||(s=[E(e,"click",u),E(e,"mouseenter",c),E(e,"mouseleave",Dm)],i=!0)},p(n,i){t=n,4&i&&r!==(r=m(Sm(t[2],16*t[15]+4*t[18]+t[20]))+" svelte-13rs43s")&&P(e,"class",r)},d(t){t&&k(e),i=!1,o(s)}}}function wm(t){let e,n=new Array(4),r=[];for(let e=0;e ',O=I(),D=A("thead"),D.innerHTML='typevalue',C=I(),N=A("tbody"),z=A("tr"),U=A("td"),U.textContent="pubkey",j=A("td"),W.c(),H=I(),K=A("tr"),q=A("td"),q.textContent="u8",V=A("td"),G=S(se),Z=I(),X=A("tr"),J=A("td"),J.textContent="i8",Q=A("td"),tt=S(ae),et=I(),nt=A("tr"),at=A("td"),at.textContent="u16",ut=A("td"),ct=S(ue),dt=I(),lt=A("tr"),ht=A("td"),ht.textContent="i16",ft=A("td"),pt=S(ce),mt=I(),gt=A("tr"),yt=A("td"),yt.textContent="u32",bt=A("td"),wt=S(de),_t=I(),vt=A("tr"),kt=A("td"),kt.textContent="i32",Mt=A("td"),At=S(le),St=I(),It=A("tr"),xt=A("td"),xt.textContent="u64",Et=A("td"),Tt=S(he),Pt=I(),Bt=A("tr"),Lt=A("td"),Lt.textContent="i64",$t=A("td"),Rt=S(fe),Ot=I(),Dt=A("tr"),Ct=A("td"),Ct.textContent="u128",Nt=A("td"),zt=S(pe),Ut=I(),jt=A("tr"),Yt=A("td"),Yt.textContent="datetime",Ft=A("td"),Wt=S(me),Ht=I(),Kt=A("tr"),qt=A("td"),qt.textContent="string",Vt=A("td"),Gt=S(ge),Zt=I(),Xt=A("tr"),Jt=A("td"),Qt=A("div"),te=A("input"),ee=S(" LittleEndian"),$(r,"display","flex"),$(r,"flex-direction","column"),$(r,"row-gap","2px"),$(o,"display","flex"),$(o,"flex-direction","column"),$(o,"row-gap","0px"),$(u,"display","flex"),$(u,"flex-direction","column"),$(u,"row-gap","2px"),P(p,"class","svelte-13rs43s"),P(m,"class","svelte-13rs43s"),P(w,"class","svelte-13rs43s"),P(x,"class","svelte-13rs43s"),P(U,"class","svelte-13rs43s"),P(j,"class","svelte-13rs43s"),P(q,"class","svelte-13rs43s"),P(V,"class","svelte-13rs43s"),P(J,"class","svelte-13rs43s"),P(Q,"class","svelte-13rs43s"),P(at,"class","svelte-13rs43s"),P(ut,"class","svelte-13rs43s"),P(ht,"class","svelte-13rs43s"),P(ft,"class","svelte-13rs43s"),P(yt,"class","svelte-13rs43s"),P(bt,"class","svelte-13rs43s"),P(kt,"class","svelte-13rs43s"),P(Mt,"class","svelte-13rs43s"),P(xt,"class","svelte-13rs43s"),P(Et,"class","svelte-13rs43s"),P(Lt,"class","svelte-13rs43s"),P($t,"class","svelte-13rs43s"),P(Ct,"class","svelte-13rs43s"),P(Nt,"class","svelte-13rs43s"),P(Yt,"class","svelte-13rs43s"),P(Ft,"class","svelte-13rs43s"),P(qt,"class","svelte-13rs43s"),P(Vt,"class","svelte-13rs43s"),P(te,"type","checkbox"),$(te,"background-color","green"),$(Qt,"display","flex"),$(Qt,"flex-direction","row"),$(Qt,"align-items","center"),P(Jt,"colspan","2"),P(Jt,"class","svelte-13rs43s"),$(h,"border-spacing","0"),$(l,"border-left","5px solid black"),$(l,"position","fixed"),$(l,"padding","2px 0px"),$(n,"display","flex"),$(n,"flex-direction","row"),$(n,"column-gap","12px"),$(n,"font-family","Consolas, ui-monospace, SFMono-Regular, Menlo, Monaco, 'Liberation Mono', 'Courier New', monospace")},m(t,k){v(t,n,k),_(n,r);for(let t=0;t{Se[n]=null})),it(),W=Se[F],W?W.p(t,e):(W=Se[F]=Ae[F](t),W.c()),ot(W,1),W.m(j,null)),(!ne||6&e)&&se!==(se=xm(t[4].data,t[2],t[1])+"")&&B(G,se),(!ne||6&e)&&ae!==(ae=Em(t[4].data,t[2],t[1])+"")&&B(tt,ae),(!ne||6&e)&&ue!==(ue=Tm(t[4].data,t[2],t[1])+"")&&B(ct,ue),(!ne||6&e)&&ce!==(ce=Pm(t[4].data,t[2],t[1])+"")&&B(pt,ce),(!ne||6&e)&&de!==(de=Bm(t[4].data,t[2],t[1])+"")&&B(wt,de),(!ne||6&e)&&le!==(le=Lm(t[4].data,t[2],t[1])+"")&&B(At,le),(!ne||6&e)&&he!==(he=$m(t[4].data,t[2],t[1])+"")&&B(Tt,he),(!ne||6&e)&&fe!==(fe=Rm(t[4].data,t[2],t[1])+"")&&B(Rt,fe),(!ne||6&e)&&pe!==(pe=t[6](t[4].data,t[2],t[1])+"")&&B(zt,pe),(!ne||6&e)&&me!==(me=t[7](t[4].data,t[2],t[1])+"")&&B(Wt,me),(!ne||6&e)&&ge!==(ge=Om(t[4].data,t[2],t[1])+"")&&B(Gt,ge),2&e&&(te.checked=t[1])},i(t){ne||(ot(W),ne=!0)},o(t){st(W),ne=!1},d(t){t&&k(n),M(be,t),M(_e,t),ve&&ve.d(),M(Me,t),Se[F].d(),re=!1,ie()}}}function Sm(t,e){return e{e.push(t<32||t>126?".":String.fromCharCode(t))})),e.join("")}function xm(t,e,n=!0){if(void 0!==e&&!(e+1>t.length))return t.readUInt8(e).toString()}function Em(t,e,n=!0){if(void 0!==e&&!(e+1>t.length))return t.readInt8(e).toString()}function Tm(t,e,n=!0){if(void 0!==e&&!(e+2>t.length))return n?t.readUInt16LE(e).toString():t.readUInt16BE(e).toString()}function Pm(t,e,n=!0){if(void 0!==e&&!(e+2>t.length))return n?t.readInt16LE(e).toString():t.readInt16BE(e).toString()}function Bm(t,e,n=!0){if(void 0!==e&&!(e+4>t.length))return n?t.readUInt32LE(e).toString():t.readUInt32BE(e).toString()}function Lm(t,e,n=!0){if(void 0!==e&&!(e+4>t.length))return n?t.readInt32LE(e).toString():t.readInt32BE(e).toString()}function $m(t,e,n=!0){if(void 0!==e&&!(e+8>t.length))return n?t.readBigUInt64LE(e).toString():t.readBigUInt64BE(e).toString()}function Rm(t,e,n=!0){if(void 0!==e&&!(e+8>t.length))return n?t.readBigInt64LE(e).toString():t.readBigInt64BE(e).toString()}function Om(t,e,n=!0){if(void 0!==e&&!(e+1>t.length))return t.readUInt8(e),Im(t.slice(e,e+32))}const Dm=()=>{};function Cm(t,e,n){const r=10240;let{accountInfo:i}=e;const o=Object.assign(Object.assign({},i),{data:i.meta.data.slice(0,r),overflow:i.meta.data.length>r});let s,a,u=!0;function c(t){n(2,a=t)}return t.$$set=t=>{"accountInfo"in t&&n(9,i=t.accountInfo)},[s,u,a,r,o,c,function(t,e,n=!0){if(void 0===e)return;if(e+16>t.length)return;const r=n?t.readBigUInt64LE(e+8):t.readBigUInt64BE(e),i=n?t.readBigUInt64LE(e):t.readBigUInt64BE(e+8);return new(_n())(i.toString()).add(new(_n())(r.toString()).shln(64)).toString()},function(t,e,n=!0){if(void 0===e)return;if(e+8>t.length)return;const r=n?t.readBigInt64LE(e):t.readBigInt64BE(e);if(!(r<0||r>253402300799))try{return yn().unix(Number.parseInt(r.toString())).format("YYYY/MM/DD HH:mm:ss UTCZZ")}catch(t){return}},function(t,e,n=!0){if(void 0!==e&&!(e+32>t.length))try{return new Mt.PublicKey(t.slice(e,e+32))}catch(t){return}},i,(t,e,n)=>c(16*t+4*e+n),(t,e,r)=>{n(0,s=16*t+4*e+r)},function(){u=this.checked,n(1,u)}]}const Nm=class extends gt{constructor(t){super(),mt(this,t,Cm,Am,a,{accountInfo:9})}};function zm(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Um(t){let e,n,r,i;e=new pr({props:{accountType:"generic",meta:t[2].meta}});let o=t[2].meta.data.length>0&&jm(t);return{c(){ht(e.$$.fragment),n=I(),o&&o.c(),r=x()},m(t,s){ft(e,t,s),v(t,n,s),o&&o.m(t,s),v(t,r,s),i=!0},p(t,n){const i={};2&n&&(i.meta=t[2].meta),e.$set(i),t[2].meta.data.length>0?o?(o.p(t,n),2&n&&ot(o,1)):(o=jm(t),o.c(),ot(o,1),o.m(r.parentNode,r)):o&&(rt(),st(o,1,1,(()=>{o=null})),it())},i(t){i||(ot(e.$$.fragment,t),ot(o),i=!0)},o(t){st(e.$$.fragment,t),st(o),i=!1},d(t){pt(e,t),t&&k(n),o&&o.d(t),t&&k(r)}}}function jm(t){let e,n;return e=new oi({props:{$$slots:{default:[Ym]},$$scope:{ctx:t}}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};10&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Ym(t){let e,n;return e=new Nm({props:{accountInfo:t[2]}}),{c(){ht(e.$$.fragment)},m(t,r){ft(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.accountInfo=t[2]),e.$set(r)},i(t){n||(ot(e.$$.fragment,t),n=!0)},o(t){st(e.$$.fragment,t),n=!1},d(t){pt(e,t)}}}function Fm(e){let n,r,i=e[0].pubkey+"";return{c(){n=S("loading...\n "),r=S(i)},m(t,e){v(t,n,e),v(t,r,e)},p(t,e){1&e&&i!==(i=t[0].pubkey+"")&&B(r,i)},i:t,o:t,d(t){t&&k(n),t&&k(r)}}}function Wm(t){let e,n,r,i,o,s={ctx:t,current:null,token:null,hasCatch:!1,pending:Fm,then:Um,catch:zm,value:2,blocks:[,,,]};return at(i=t[1],s),{c(){e=A("h2"),e.textContent="📘Generic",n=I(),r=x(),s.block.c()},m(t,i){v(t,e,i),v(t,n,i),v(t,r,i),s.block.m(t,s.anchor=i),s.mount=()=>r.parentNode,s.anchor=r,o=!0},p(e,[n]){t=e,s.ctx=t,2&n&&i!==(i=t[1])&&at(i,s)||ut(s,t,n)},i(t){o||(ot(s.block),o=!0)},o(t){for(let t=0;t<3;t+=1)st(s.blocks[t]);o=!1},d(t){t&&k(e),t&&k(n),t&&k(r),s.block.d(t),s.token=null,s=null}}}function Hm(t,e,n){let r,{params:i}=e;return t.$$set=t=>{"params"in t&&n(0,i=t.params)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),{accountInfo:r,slotContext:i}=await Zn(n,e);return{meta:Xn(e,r,i),parsed:{},derived:{}}}(i.pubkey))},[i,r]}const Km={"/":class extends gt{constructor(t){super(),mt(this,t,null,yt,a,{})}},"/whirlpool/list":class extends gt{constructor(t){super(),mt(this,t,Gu,Vu,a,{})}},"/whirlpool/listPositions/:pubkey":class extends gt{constructor(t){super(),mt(this,t,rc,ec,a,{params:10})}},"/whirlpool/config/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Ma,ka,a,{params:0})}},"/whirlpool/configextension/:pubkey":class extends gt{constructor(t){super(),mt(this,t,$a,La,a,{params:0})}},"/whirlpool/tokenbadge/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Ya,ja,a,{params:0})}},"/whirlpool/feetier/:pubkey":class extends gt{constructor(t){super(),mt(this,t,tu,Qa,a,{params:0})}},"/whirlpool/whirlpool/:pubkey":class extends gt{constructor(t){super(),mt(this,t,os,ns,a,{params:0})}},"/whirlpool/tickarray/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Mu,ku,a,{params:0})}},"/whirlpool/position/:pubkey":class extends gt{constructor(t){super(),mt(this,t,sa,ra,a,{params:0})}},"/whirlpool/positionbundle/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Yu,ju,a,{params:0})}},"/token/account/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Ac,Mc,a,{params:0})}},"/token/mint/:pubkey":class extends gt{constructor(t){super(),mt(this,t,sd,od,a,{params:0})}},"/token/listTokenAccounts/:pubkey?":class extends gt{constructor(t){super(),mt(this,t,_d,wd,a,{params:4})}},"/token/deriveAta":class extends gt{constructor(t){super(),mt(this,t,Bd,Td,a,{})}},"/token2022/account/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Xh,Zh,a,{params:0})}},"/token2022/mint/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Mf,kf,a,{params:0})}},"/tokenswap/list":class extends gt{constructor(t){super(),mt(this,t,lp,dp,a,{})}},"/tokenswap/swapstate/:pubkey":class extends gt{constructor(t){super(),mt(this,t,tp,Xf,a,{params:0})}},"/aquafarm/globalfarm/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Kp,Hp,a,{params:0})}},"/aquafarm/userfarm/:pubkey":class extends gt{constructor(t){super(),mt(this,t,lm,dm,a,{params:0})}},"/generic/:pubkey":class extends gt{constructor(t){super(),mt(this,t,Hm,Wm,a,{params:0})}}};function qm(t,e,n){const r=t.slice();return r[6]=e[n],r}function Vm(e){let n,r,i,o,s,a,u=e[6].name+"",c=e[6].url+"";return{c(){n=A("option"),r=S(u),i=S(" ("),o=S(c),s=S(")"),n.__value=a=e[6].id,n.value=n.__value},m(t,e){v(t,n,e),_(n,r),_(n,i),_(n,o),_(n,s)},p:t,d(t){t&&k(n)}}}function Gm(e){let n,r,i,s,a,u,c,d,l=e[1],h=[];for(let t=0;te[3].call(i)))},m(t,o){v(t,n,o),_(n,r),_(r,i);for(let t=0;tn(4,r=t),t.$$.on_destroy.push(c(i,o));const s=xt,a=new Map;let u;return s.forEach((t=>a.set(t.id,t))),St(s[0].url),[u,s,function(){let t="";if("custom"===u)t=window.prompt("Input your RPC Server");else{const e=a.get(u);console.log(e),t=e.url}St(t),async function(t){if(!t||t.length<1||"/"!=t.charAt(0)&&0!==t.indexOf("#/"))throw Error("Invalid parameter location");await q();const e=("#"==t.charAt(0)?"":"#")+t;try{const t={...history.state};delete t.__svelte_spa_router_scrollX,delete t.__svelte_spa_router_scrollY,window.history.replaceState(t,void 0,e)}catch(t){console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}(r)},function(){u=O(this),n(0,u),n(1,s)}]}const Xm=class extends gt{constructor(t){super(),mt(this,t,Zm,Gm,a,{})}},Jm=new Mt.PublicKey("DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1"),Qm=new Mt.PublicKey("9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP"),tg=new Mt.PublicKey("3xQ8SWv2GaFXXpHZNqkXsdxq5DZciHBz6ZFoPPfbFd7U"),eg=new Mt.PublicKey("82yxjeMsvaURa4MbZZ7WZZHfobirZYkH1zF8fmeGtyaQ");function ng(t){let e,n,r,i,s,a,u,c,d,l,h,f,p,m,g,y,b,w,M,S,x,B,R,O,D,C,N,z,U;return r=new Xm({}),C=new Ur({props:{routes:Km}}),{c(){e=A("main"),n=A("div"),ht(r.$$.fragment),i=I(),s=A("h1"),s.textContent="🔬Account microscope",a=I(),u=A("div"),u.innerHTML='Account microscope is open source. \n If you are interested in how they are derived, please check the code 👍',c=I(),d=A("form"),l=A("input"),h=I(),f=A("input"),p=I(),m=A("input"),g=I(),y=A("a"),y.textContent="🪧 whirlpool/list",b=I(),w=A("a"),w.textContent="🪧 tokenswap/list",M=I(),S=A("a"),S.textContent="🪧 token/listTokenAccounts",x=I(),B=A("a"),B.textContent="🪧 token/deriveAta",R=I(),O=A("hr"),D=I(),ht(C.$$.fragment),$(n,"text-align","right"),$(s,"margin","0em"),$(u,"font-size","small"),$(u,"margin-bottom","10px"),$(l,"margin","0.5em 0em"),P(l,"type","text"),P(l,"size","64"),P(l,"placeholder","HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ"),P(f,"type","submit"),f.value="Check!",P(m,"type","button"),m.value="HexDump!",P(y,"href","#/whirlpool/list"),$(y,"font-size","smaller"),$(y,"text-decoration","none"),P(w,"href","#/tokenswap/list"),$(w,"font-size","smaller"),$(w,"text-decoration","none"),P(S,"href","#/token/listTokenAccounts"),$(S,"font-size","smaller"),$(S,"text-decoration","none"),P(B,"href","#/token/deriveAta"),$(B,"font-size","smaller"),$(B,"text-decoration","none"),P(e,"class","svelte-dgluc6")},m(o,k){v(o,e,k),_(e,n),ft(r,n,null),_(e,i),_(e,s),_(e,a),_(e,u),_(e,c),_(e,d),_(d,l),L(l,t[0]),_(d,h),_(d,f),_(d,p),_(d,m),_(e,g),_(e,y),_(e,b),_(e,w),_(e,M),_(e,S),_(e,x),_(e,B),_(e,R),_(e,O),_(e,D),ft(C,e,null),N=!0,z||(U=[E(l,"input",t[3]),E(m,"click",t[2]),E(d,"submit",T(t[1]))],z=!0)},p(t,[e]){1&e&&l.value!==t[0]&&L(l,t[0])},i(t){N||(ot(r.$$.fragment,t),ot(C.$$.fragment,t),N=!0)},o(t){st(r.$$.fragment,t),st(C.$$.fragment,t),N=!1},d(t){t&&k(e),pt(r),pt(C),z=!1,o(U)}}}function rg(t,e,n){let r;function i(t){const e=`${t.path}/${t.pubkey}`;console.log(e),Nr(e)}return[r,function(){console.log(r),async function(t){const e=bn.AddressUtil.toPubKey(t),n=It(),r=await n.getAccountInfo(e);if(r.owner.equals(jr.ORCA_WHIRLPOOL_PROGRAM_ID))switch(r.data.length){case 9988:return{pubkey:e,path:"/whirlpool/tickarray"};case 653:return{pubkey:e,path:"/whirlpool/whirlpool"};case 616:return{pubkey:e,path:"/whirlpool/configextension"};case 216:return{pubkey:e,path:"/whirlpool/position"};case 200:return{pubkey:e,path:"/whirlpool/tokenbadge"};case 136:return{pubkey:e,path:"/whirlpool/positionbundle"};case 108:return{pubkey:e,path:"/whirlpool/config"};case 44:return{pubkey:e,path:"/whirlpool/feetier"}}if(r.owner.equals(Hr))switch(r.data.length){case 165:return{pubkey:e,path:"/token/account"};case 82:return{pubkey:e,path:"/token/mint"}}if(r.owner.equals(qr))switch(r.data.length){case 165:return{pubkey:e,path:"/token2022/account"};case 82:return{pubkey:e,path:"/token2022/mint"};default:if(r.data.length>=166){if(1===r.data[165])return{pubkey:e,path:"/token2022/mint"};if(2===r.data[165])return{pubkey:e,path:"/token2022/account"}}}if((r.owner.equals(Jm)||r.owner.equals(Qm)||r.owner.equals(tg))&&324===r.data.length)return{pubkey:e,path:"/tokenswap/swapstate"};if(r.owner.equals(eg))switch(r.data.length){case 283:return{pubkey:e,path:"/aquafarm/globalfarm"};case 106:return{pubkey:e,path:"/aquafarm/userfarm"}}return{pubkey:e,path:"/generic"}}(r).then(i)},function(){const t=`/generic/${r}`;console.log(t),Nr(t)},function(){r=this.value,n(0,r)}]}BigInt.prototype.toJSON=function(){return this.toString()},new class extends gt{constructor(t){super(),mt(this,t,rg,ng,a,{})}}({target:document.body,props:{name:"world"}})})()})(); \ No newline at end of file diff --git a/src/libs/account.ts b/src/libs/account.ts index df60408..71c5b53 100644 --- a/src/libs/account.ts +++ b/src/libs/account.ts @@ -61,7 +61,7 @@ export function toAccountJSON(meta: AccountMetaInfo, embedSlotContext: boolean): executable: meta.executable, lamports: meta.lamports, owner: meta.owner.toBase58(), - rentEpoch: meta.rentEpoch ?? 0, + rentEpoch: /* meta.rentEpoch ?? */ 0, // now all accounts must be rent-exempt data: [meta.data.toString("base64"), "base64"], }, ...slotContext,