diff --git a/67bf8fbb25c78771c929.main.js b/b739b8fe885221974425.main.js similarity index 55% rename from 67bf8fbb25c78771c929.main.js rename to b739b8fe885221974425.main.js index f3684df..600ddc9 100644 --- a/67bf8fbb25c78771c929.main.js +++ b/b739b8fe885221974425.main.js @@ -1,2 +1,2 @@ -/*! For license information please see 67bf8fbb25c78771c929.main.js.LICENSE.txt */ -(()=>{var e,t,n={8845:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AccountClient:()=>ya,AnchorError:()=>no,AnchorProvider:()=>gr,BN:()=>a(),BorshAccountsCoder:()=>fo,BorshCoder:()=>yo,BorshEventCoder:()=>ho,BorshInstructionCoder:()=>co,DISCRIMINATOR_SIZE:()=>lo,EventManager:()=>ba,EventParser:()=>va,IdlError:()=>eo,LangErrorCode:()=>oo,LangErrorMessage:()=>ao,MethodsBuilderFactory:()=>Ca,Native:()=>Ua,Program:()=>za,ProgramError:()=>ro,ProgramErrorStack:()=>to,SystemCoder:()=>Jo,getProvider:()=>Er,parseIdlErrors:()=>zn,setProvider:()=>_r,splitArgsAndCtx:()=>la,toInstruction:()=>jn,translateAddress:()=>Fn,translateError:()=>io,utils:()=>ua,validateAccounts:()=>Un,web3:()=>i});var r=n(8764),i=n(7581),o=n(3550),a=n.n(o),s=n(7191),c=n.n(s),u=n(3204),l=n.n(u),d=n(5970),f=n(7748);function h(e){let t=e.length;for(;--t>=0;)e[t]=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]),y=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]),m=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),g=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);h(b);const v=new Array(60);h(v);const w=new Array(512);h(w);const _=new Array(256);h(_);const E=new Array(29);h(E);const S=new Array(30);function A(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let k,x,O;function I(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}h(S);const R=e=>e<256?w[e]:w[256+(e>>>7)],T=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},P=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<{P(e,n[2*t],n[2*t+1])},N=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},B=(e,t,n)=>{const r=new Array(16);let i,o,a=0;for(i=1;i<=15;i++)a=a+n[i-1]<<1,r[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=N(r[t]++,t))}},M=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},L=e=>{e.bi_valid>8?T(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},D=(e,t,n,r)=>{const i=2*t,o=2*n;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,o,a,s=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+s++],r+=(255&e.pending_buf[e.sym_buf+s++])<<8,i=e.pending_buf[e.sym_buf+s++],0===r?C(e,i,t):(o=_[i],C(e,o+256+1,t),a=p[o],0!==a&&(i-=E[o],P(e,i,a)),r--,o=R(r),C(e,o,n),a=y[o],0!==a&&(r-=S[o],P(e,r,a)))}while(s{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,c,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a>1;a>=1;a--)z(e,n,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],z(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[2*c]=n[2*a]+n[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[2*a+1]=n[2*s+1]=c,e.heap[1]=c++,z(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,d,f,h,p,y=0;for(f=0;f<=15;f++)e.bl_count[f]=0;for(n[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],f=n[2*n[2*l+1]+1]+1,f>c&&(f=c,y++),n[2*l+1]=f,l>r||(e.bl_count[f]++,h=0,l>=s&&(h=a[l-s]),p=n[2*l],e.opt_len+=p*(f+h),o&&(e.static_len+=p*(i[2*l+1]+h)));if(0!==y){do{for(f=c-1;0===e.bl_count[f];)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,y-=2}while(y>0);for(f=c;0!==f;f--)for(l=e.bl_count[f];0!==l;)d=e.heap[--u],d>r||(n[2*d+1]!==f&&(e.opt_len+=(f-n[2*d+1])*n[2*d],n[2*d+1]=f),l--)}})(e,t),B(n,u,e.bl_count)},F=(e,t,n)=>{let r,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=t[2*(r+1)+1],++s{let r,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=n;r++)if(i=a,a=t[2*(r+1)+1],!(++s{P(e,0+(r?1:0),3),L(e),T(e,n),T(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var K={_tr_init:e=>{H||((()=>{let e,t,n,r,i;const o=new Array(16);for(n=0,r=0;r<28;r++)for(E[r]=n,e=0;e<1<>=7;r<30;r++)for(S[r]=i<<7,e=0;e<1<{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),U(e,e.l_desc),U(e,e.d_desc),a=(e=>{let t;for(F(e,e.dyn_ltree,e.l_desc.max_code),F(e,e.dyn_dtree,e.d_desc.max_code),U(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*g[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==t?q(e,t,n,r):4===e.strategy||o===i?(P(e,2+(r?1:0),3),j(e,b,v)):(P(e,4+(r?1:0),3),((e,t,n,r)=>{let i;for(P(e,t-257,5),P(e,n-1,5),P(e,r-4,4),i=0;i(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(_[n]+256+1)]++,e.dyn_dtree[2*R(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{P(e,2,3),C(e,256,b),(e=>{16===e.bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},G=(e,t,n,r)=>{let i=65535&e,o=e>>>16&65535,a=0;for(;0!==n;){a=n>2e3?2e3:n,n-=a;do{i=i+t[r++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16};const $=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var V=(e,t,n,r)=>{const i=$,o=r+n;e^=-1;for(let n=r;n>>8^i[255&(e^t[n])];return~e},Z={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"},Y={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:J,_tr_stored_block:X,_tr_flush_block:Q,_tr_tally:ee,_tr_align:te}=K,{Z_NO_FLUSH:ne,Z_PARTIAL_FLUSH:re,Z_FULL_FLUSH:ie,Z_FINISH:oe,Z_BLOCK:ae,Z_OK:se,Z_STREAM_END:ce,Z_STREAM_ERROR:ue,Z_DATA_ERROR:le,Z_BUF_ERROR:de,Z_DEFAULT_COMPRESSION:fe,Z_FILTERED:he,Z_HUFFMAN_ONLY:pe,Z_RLE:ye,Z_FIXED:me,Z_DEFAULT_STRATEGY:ge,Z_UNKNOWN:be,Z_DEFLATED:ve}=Y,we=258,_e=262,Ee=42,Se=113,Ae=666,ke=(e,t)=>(e.msg=Z[t],t),xe=e=>2*e-(e>4?9:0),Oe=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ie=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do{n=e.head[--r],e.head[r]=n>=i?n-i:0}while(--t);t=i,r=t;do{n=e.prev[--r],e.prev[r]=n>=i?n-i:0}while(--t)};let Re=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},Pe=(e,t)=>{Q(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Te(e.strm)},Ce=(e,t)=>{e.pending_buf[e.pending++]=t},Ne=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Be=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),1===e.state.wrap?e.adler=G(e.adler,t,i,n):2===e.state.wrap&&(e.adler=V(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},Me=(e,t)=>{let n,r,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-_e?e.strstart-(e.w_size-_e):0,u=e.window,l=e.w_mask,d=e.prev,f=e.strstart+we;let h=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(n=t,u[n+a]===p&&u[n+a-1]===h&&u[n]===u[o]&&u[++n]===u[o+1]){o+=2,n++;do{}while(u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&oa){if(e.match_start=t,a=r,r>=s)break;h=u[o+a-1],p=u[o+a]}}}while((t=d[t&l])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead},Le=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-_e)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ie(e),r+=t),0===e.strm.avail_in)break;if(n=Be(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Re(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Re(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<_e&&0!==e.strm.avail_in)},De=(e,t)=>{let n,r,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(n=65535,i=e.bi_valid+42>>3,e.strm.avail_outr+e.strm.avail_in&&(n=r+e.strm.avail_in),n>i&&(n=i),n>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Te(e.strm),r&&(r>n&&(r=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,n-=r),n&&(Be(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_wateri&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(Be(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=o||(r||t===oe)&&t!==ne&&0===e.strm.avail_in&&r<=i)&&(n=r>i?i:r,a=t===oe&&0===e.strm.avail_in&&n===r?1:0,X(e,e.block_start,n,a),e.block_start+=n,Te(e.strm)),a?3:1)},ze=(e,t)=>{let n,r;for(;;){if(e.lookahead<_e){if(Le(e),e.lookahead<_e&&t===ne)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Re(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-_e&&(e.match_length=Me(e,n)),e.match_length>=3)if(r=ee(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Re(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Re(e,e.ins_h,e.window[e.strstart+1]);else r=ee(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Pe(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===oe?(Pe(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Pe(e,!1),0===e.strm.avail_out)?1:2},je=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<_e){if(Le(e),e.lookahead<_e&&t===ne)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Re(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=ee(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=Re(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Pe(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=ee(e,0,e.window[e.strstart-1]),r&&Pe(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=ee(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===oe?(Pe(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Pe(e,!1),0===e.strm.avail_out)?1:2};function Ue(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const Fe=[new Ue(0,0,0,0,De),new Ue(4,4,8,4,ze),new Ue(4,5,16,8,ze),new Ue(4,6,32,32,ze),new Ue(4,4,16,16,je),new Ue(8,16,32,32,je),new Ue(8,16,128,128,je),new Ue(8,32,128,256,je),new Ue(32,128,258,1024,je),new Ue(32,258,258,4096,je)];function We(){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=ve,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),Oe(this.dyn_ltree),Oe(this.dyn_dtree),Oe(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),Oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Oe(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 He=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ee&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Se&&t.status!==Ae?1:0},qe=e=>{if(He(e))return ke(e,ue);e.total_in=e.total_out=0,e.data_type=be;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Ee:Se,e.adler=2===t.wrap?0:1,t.last_flush=-2,J(t),se},Ke=e=>{const t=qe(e);var n;return t===se&&((n=e.state).window_size=2*n.w_size,Oe(n.head),n.max_lazy_match=Fe[n.level].max_lazy,n.good_match=Fe[n.level].good_length,n.nice_match=Fe[n.level].nice_length,n.max_chain_length=Fe[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),t},Ge=(e,t,n,r,i,o)=>{if(!e)return ue;let a=1;if(t===fe&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>9||n!==ve||r<8||r>15||t<0||t>9||o<0||o>me||8===r&&1!==a)return ke(e,ue);8===r&&(r=9);const s=new We;return e.state=s,s.strm=e,s.status=Ee,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<Ge(e,t,ve,15,8,ge),deflateInit2:Ge,deflateReset:Ke,deflateResetKeep:qe,deflateSetHeader:(e,t)=>He(e)||2!==e.state.wrap?ue:(e.state.gzhead=t,se),deflate:(e,t)=>{if(He(e)||t>ae||t<0)return e?ke(e,ue):ue;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===Ae&&t!==oe)return ke(e,0===e.avail_out?de:ue);const r=n.last_flush;if(n.last_flush=t,0!==n.pending){if(Te(e),0===e.avail_out)return n.last_flush=-1,se}else if(0===e.avail_in&&xe(t)<=xe(r)&&t!==oe)return ke(e,de);if(n.status===Ae&&0!==e.avail_in)return ke(e,de);if(n.status===Ee&&0===n.wrap&&(n.status=Se),n.status===Ee){let t=ve+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=pe||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=r<<6,0!==n.strstart&&(t|=32),t+=31-t%31,Ne(n,t),0!==n.strstart&&(Ne(n,e.adler>>>16),Ne(n,65535&e.adler)),e.adler=1,n.status=Se,Te(e),0!==n.pending)return n.last_flush=-1,se}if(57===n.status)if(e.adler=0,Ce(n,31),Ce(n,139),Ce(n,8),n.gzhead)Ce(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)),Ce(n,255&n.gzhead.time),Ce(n,n.gzhead.time>>8&255),Ce(n,n.gzhead.time>>16&255),Ce(n,n.gzhead.time>>24&255),Ce(n,9===n.level?2:n.strategy>=pe||n.level<2?4:0),Ce(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Ce(n,255&n.gzhead.extra.length),Ce(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=V(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Ce(n,0),Ce(n,0),Ce(n,0),Ce(n,0),Ce(n,0),Ce(n,9===n.level?2:n.strategy>=pe||n.level<2?4:0),Ce(n,3),n.status=Se,Te(e),0!==n.pending)return n.last_flush=-1,se;if(69===n.status){if(n.gzhead.extra){let t=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>t&&(e.adler=V(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Te(e),0!==n.pending)return n.last_flush=-1,se;t=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>t&&(e.adler=V(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=V(e.adler,n.pending_buf,n.pending-r,r)),Te(e),0!==n.pending)return n.last_flush=-1,se;r=0}t=n.gzindexr&&(e.adler=V(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=V(e.adler,n.pending_buf,n.pending-r,r)),Te(e),0!==n.pending)return n.last_flush=-1,se;r=0}t=n.gzindexr&&(e.adler=V(e.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&&(Te(e),0!==n.pending))return n.last_flush=-1,se;Ce(n,255&e.adler),Ce(n,e.adler>>8&255),e.adler=0}if(n.status=Se,Te(e),0!==n.pending)return n.last_flush=-1,se}if(0!==e.avail_in||0!==n.lookahead||t!==ne&&n.status!==Ae){let r=0===n.level?De(n,t):n.strategy===pe?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(Le(e),0===e.lookahead)){if(t===ne)return 1;break}if(e.match_length=0,n=ee(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Pe(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===oe?(Pe(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Pe(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===ye?((e,t)=>{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=we){if(Le(e),e.lookahead<=we&&t===ne)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+we;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=ee(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=ee(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Pe(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===oe?(Pe(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Pe(e,!1),0===e.strm.avail_out)?1:2})(n,t):Fe[n.level].func(n,t);if(3!==r&&4!==r||(n.status=Ae),1===r||3===r)return 0===e.avail_out&&(n.last_flush=-1),se;if(2===r&&(t===re?te(n):t!==ae&&(X(n,0,0,!1),t===ie&&(Oe(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Te(e),0===e.avail_out))return n.last_flush=-1,se}return t!==oe?se:n.wrap<=0?ce:(2===n.wrap?(Ce(n,255&e.adler),Ce(n,e.adler>>8&255),Ce(n,e.adler>>16&255),Ce(n,e.adler>>24&255),Ce(n,255&e.total_in),Ce(n,e.total_in>>8&255),Ce(n,e.total_in>>16&255),Ce(n,e.total_in>>24&255)):(Ne(n,e.adler>>>16),Ne(n,65535&e.adler)),Te(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?se:ce)},deflateEnd:e=>{if(He(e))return ue;const t=e.state.status;return e.state=null,t===Se?ke(e,le):se},deflateSetDictionary:(e,t)=>{let n=t.length;if(He(e))return ue;const r=e.state,i=r.wrap;if(2===i||1===i&&r.status!==Ee||r.lookahead)return ue;if(1===i&&(e.adler=G(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){0===i&&(Oe(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Le(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{r.ins_h=Re(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,Le(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,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,se},deflateInfo:"pako deflate (from Nodeca project)"};const Ve=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ze={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)Ve(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Je[254]=Je[254]=1;var Xe={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},buf2string:(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,i;const o=new Array(2*n);for(i=0,r=0;r4)o[i++]=65533,r+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&r1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Ye)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+Je[e[n]]>t?n:t}},Qe=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 et=Object.prototype.toString,{Z_NO_FLUSH:tt,Z_SYNC_FLUSH:nt,Z_FULL_FLUSH:rt,Z_FINISH:it,Z_OK:ot,Z_STREAM_END:at,Z_DEFAULT_COMPRESSION:st,Z_DEFAULT_STRATEGY:ct,Z_DEFLATED:ut}=Y;function lt(e){this.options=Ze.assign({level:st,method:ut,chunkSize:16384,windowBits:15,memLevel:8,strategy:ct},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qe,this.strm.avail_out=0;let n=$e.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==ot)throw new Error(Z[n]);if(t.header&&$e.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Xe.string2buf(t.dictionary):"[object ArrayBuffer]"===et.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=$e.deflateSetDictionary(this.strm,e),n!==ot)throw new Error(Z[n]);this._dict_set=!0}}function dt(e,t){const n=new lt(t);if(n.push(e,!0),n.err)throw n.msg||Z[n.err];return n.result}lt.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?it:tt,"string"==typeof e?n.input=Xe.string2buf(e):"[object ArrayBuffer]"===et.call(e)?n.input=new Uint8Array(e):n.input=e,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===nt||o===rt)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=$e.deflate(n,o),i===at)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=$e.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ot;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},lt.prototype.onData=function(e){this.chunks.push(e)},lt.prototype.onEnd=function(e){e===ot&&(this.result=Ze.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ft={Deflate:lt,deflate:dt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,dt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,dt(e,t)},constants:Y};const ht=16209;var pt=function(e,t){let n,r,i,o,a,s,c,u,l,d,f,h,p,y,m,g,b,v,w,_,E,S,A,k;const x=e.state;n=e.next_in,A=e.input,r=n+(e.avail_in-5),i=e.next_out,k=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=x.dmax,c=x.wsize,u=x.whave,l=x.wnext,d=x.window,f=x.hold,h=x.bits,p=x.lencode,y=x.distcode,m=(1<>>24,f>>>=v,h-=v,v=b>>>16&255,0===v)k[i++]=65535&b;else{if(!(16&v)){if(64&v){if(32&v){x.mode=16191;break e}e.msg="invalid literal/length code",x.mode=ht;break e}b=p[(65535&b)+(f&(1<>>=v,h-=v),h<15&&(f+=A[n++]<>>24,f>>>=v,h-=v,v=b>>>16&255,16&v){if(_=65535&b,v&=15,hs){e.msg="invalid distance too far back",x.mode=ht;break e}if(f>>>=v,h-=v,v=i-o,_>v){if(v=_-v,v>u&&x.sane){e.msg="invalid distance too far back",x.mode=ht;break e}if(E=0,S=d,0===l){if(E+=c-v,v2;)k[i++]=S[E++],k[i++]=S[E++],k[i++]=S[E++],w-=3;w&&(k[i++]=S[E++],w>1&&(k[i++]=S[E++]))}else{E=i-_;do{k[i++]=k[E++],k[i++]=k[E++],k[i++]=k[E++],w-=3}while(w>2);w&&(k[i++]=k[E++],w>1&&(k[i++]=k[E++]))}break}if(64&v){e.msg="invalid distance code",x.mode=ht;break e}b=y[(65535&b)+(f&(1<>3,n-=w,h-=w<<3,f&=(1<{const c=s.bits;let u,l,d,f,h,p,y=0,m=0,g=0,b=0,v=0,w=0,_=0,E=0,S=0,A=0,k=null;const x=new Uint16Array(16),O=new Uint16Array(16);let I,R,T,P=null;for(y=0;y<=15;y++)x[y]=0;for(m=0;m=1&&0===x[b];b--);if(v>b&&(v=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(g=1;g0&&(0===e||1!==b))return-1;for(O[1]=0,y=1;y<15;y++)O[y+1]=O[y]+x[y];for(m=0;m852||2===e&&S>592)return 1;for(;;){I=y-_,a[m]+1=p?(R=P[a[m]-p],T=k[a[m]-p]):(R=96,T=0),u=1<>_)+l]=I<<24|R<<16|T}while(0!==l);for(u=1<>=1;if(0!==u?(A&=u-1,A+=u):A=0,m++,0==--x[y]){if(y===b)break;y=t[n+a[m]]}if(y>v&&(A&f)!==d){for(0===_&&(_=v),h+=g,w=y-_,E=1<852||2===e&&S>592)return 1;d=A&f,i[d]=v<<24|w<<16|h-o}}return 0!==A&&(i[h+A]=y-_<<24|64<<16),s.bits=v,0};const{Z_FINISH:wt,Z_BLOCK:_t,Z_TREES:Et,Z_OK:St,Z_STREAM_END:At,Z_NEED_DICT:kt,Z_STREAM_ERROR:xt,Z_DATA_ERROR:Ot,Z_MEM_ERROR:It,Z_BUF_ERROR:Rt,Z_DEFLATED:Tt}=Y,Pt=16180,Ct=16190,Nt=16191,Bt=16192,Mt=16194,Lt=16199,Dt=16200,zt=16206,jt=16209,Ut=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ft(){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 Wt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Ht=e=>{if(Wt(e))return xt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Pt,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,St},qt=e=>{if(Wt(e))return xt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ht(e)},Kt=(e,t)=>{let n;if(Wt(e))return xt;const r=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?xt:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,qt(e))},Gt=(e,t)=>{if(!e)return xt;const n=new Ft;e.state=n,n.strm=e,n.window=null,n.mode=Pt;const r=Kt(e,t);return r!==St&&(e.state=null),r};let $t,Vt,Zt=!0;const Yt=e=>{if(Zt){$t=new Int32Array(512),Vt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(vt(1,e.lens,0,288,$t,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;vt(2,e.lens,0,32,Vt,0,e.work,{bits:5}),Zt=!1}e.lencode=$t,e.lenbits=9,e.distcode=Vt,e.distbits=5},Jt=(e,t,n,r)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(t.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(t.subarray(n-r,n-r+i),o.wnext),(r-=i)?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whaveGt(e,15),inflateInit2:Gt,inflate:(e,t)=>{let n,r,i,o,a,s,c,u,l,d,f,h,p,y,m,g,b,v,w,_,E,S,A=0;const k=new Uint8Array(4);let x,O;const I=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Wt(e)||!e.output||!e.input&&0!==e.avail_in)return xt;n=e.state,n.mode===Nt&&(n.mode=Bt),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,l=n.bits,d=s,f=c,S=St;e:for(;;)switch(n.mode){case Pt:if(0===n.wrap){n.mode=Bt;break}for(;l<16;){if(0===s)break e;s--,u+=r[o++]<>>8&255,n.check=V(n.check,k,2,0),u=0,l=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=jt;break}if((15&u)!==Tt){e.msg="unknown compression method",n.mode=jt;break}if(u>>>=4,l-=4,E=8+(15&u),0===n.wbits&&(n.wbits=E),E>15||E>n.wbits){e.msg="invalid window size",n.mode=jt;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(k[0]=255&u,k[1]=u>>>8&255,n.check=V(n.check,k,2,0)),u=0,l=0,n.mode=16182;case 16182:for(;l<32;){if(0===s)break e;s--,u+=r[o++]<>>8&255,k[2]=u>>>16&255,k[3]=u>>>24&255,n.check=V(n.check,k,4,0)),u=0,l=0,n.mode=16183;case 16183:for(;l<16;){if(0===s)break e;s--,u+=r[o++]<>8),512&n.flags&&4&n.wrap&&(k[0]=255&u,k[1]=u>>>8&255,n.check=V(n.check,k,2,0)),u=0,l=0,n.mode=16184;case 16184:if(1024&n.flags){for(;l<16;){if(0===s)break e;s--,u+=r[o++]<>>8&255,n.check=V(n.check,k,2,0)),u=0,l=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(h=n.length,h>s&&(h=s),h&&(n.head&&(E=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+h),E)),512&n.flags&&4&n.wrap&&(n.check=V(n.check,r,h,o)),s-=h,o+=h,n.length-=h),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===s)break e;h=0;do{E=r[o+h++],n.head&&E&&n.length<65536&&(n.head.name+=String.fromCharCode(E))}while(E&&h>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Nt;break;case 16189:for(;l<32;){if(0===s)break e;s--,u+=r[o++]<>>=7&l,l-=7&l,n.mode=zt;break}for(;l<3;){if(0===s)break e;s--,u+=r[o++]<>>=1,l-=1,3&u){case 0:n.mode=16193;break;case 1:if(Yt(n),n.mode=Lt,t===Et){u>>>=2,l-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=jt}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=jt;break}if(n.length=65535&u,u=0,l=0,n.mode=Mt,t===Et)break e;case Mt:n.mode=16195;case 16195:if(h=n.length,h){if(h>s&&(h=s),h>c&&(h=c),0===h)break e;i.set(r.subarray(o,o+h),a),s-=h,o+=h,c-=h,a+=h,n.length-=h;break}n.mode=Nt;break;case 16196:for(;l<14;){if(0===s)break e;s--,u+=r[o++]<>>=5,l-=5,n.ndist=1+(31&u),u>>>=5,l-=5,n.ncode=4+(15&u),u>>>=4,l-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=jt;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,l-=3}for(;n.have<19;)n.lens[I[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,x={bits:n.lenbits},S=vt(0,n.lens,0,19,n.lencode,0,n.work,x),n.lenbits=x.bits,S){e.msg="invalid code lengths set",n.mode=jt;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,g=A>>>16&255,b=65535&A,!(m<=l);){if(0===s)break e;s--,u+=r[o++]<>>=m,l-=m,n.lens[n.have++]=b;else{if(16===b){for(O=m+2;l>>=m,l-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=jt;break}E=n.lens[n.have-1],h=3+(3&u),u>>>=2,l-=2}else if(17===b){for(O=m+3;l>>=m,l-=m,E=0,h=3+(7&u),u>>>=3,l-=3}else{for(O=m+7;l>>=m,l-=m,E=0,h=11+(127&u),u>>>=7,l-=7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=jt;break}for(;h--;)n.lens[n.have++]=E}}if(n.mode===jt)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=jt;break}if(n.lenbits=9,x={bits:n.lenbits},S=vt(1,n.lens,0,n.nlen,n.lencode,0,n.work,x),n.lenbits=x.bits,S){e.msg="invalid literal/lengths set",n.mode=jt;break}if(n.distbits=6,n.distcode=n.distdyn,x={bits:n.distbits},S=vt(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,x),n.distbits=x.bits,S){e.msg="invalid distances set",n.mode=jt;break}if(n.mode=Lt,t===Et)break e;case Lt:n.mode=Dt;case Dt:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=l,pt(e,f),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,l=n.bits,n.mode===Nt&&(n.back=-1);break}for(n.back=0;A=n.lencode[u&(1<>>24,g=A>>>16&255,b=65535&A,!(m<=l);){if(0===s)break e;s--,u+=r[o++]<>v)],m=A>>>24,g=A>>>16&255,b=65535&A,!(v+m<=l);){if(0===s)break e;s--,u+=r[o++]<>>=v,l-=v,n.back+=v}if(u>>>=m,l-=m,n.back+=m,n.length=b,0===g){n.mode=16205;break}if(32&g){n.back=-1,n.mode=Nt;break}if(64&g){e.msg="invalid literal/length code",n.mode=jt;break}n.extra=15&g,n.mode=16201;case 16201:if(n.extra){for(O=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;A=n.distcode[u&(1<>>24,g=A>>>16&255,b=65535&A,!(m<=l);){if(0===s)break e;s--,u+=r[o++]<>v)],m=A>>>24,g=A>>>16&255,b=65535&A,!(v+m<=l);){if(0===s)break e;s--,u+=r[o++]<>>=v,l-=v,n.back+=v}if(u>>>=m,l-=m,n.back+=m,64&g){e.msg="invalid distance code",n.mode=jt;break}n.offset=b,n.extra=15&g,n.mode=16203;case 16203:if(n.extra){for(O=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=jt;break}n.mode=16204;case 16204:if(0===c)break e;if(h=f-c,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=jt;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),y=n.window}else y=i,p=a-n.offset,h=n.length;h>c&&(h=c),c-=h,n.length-=h;do{i[a++]=y[p++]}while(--h);0===n.length&&(n.mode=Dt);break;case 16205:if(0===c)break e;i[a++]=n.length,c--,n.mode=Dt;break;case zt:if(n.wrap){for(;l<32;){if(0===s)break e;s--,u|=r[o++]<{if(Wt(e))return xt;let t=e.state;return t.window&&(t.window=null),e.state=null,St},inflateGetHeader:(e,t)=>{if(Wt(e))return xt;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,St):xt},inflateSetDictionary:(e,t)=>{const n=t.length;let r,i,o;return Wt(e)?xt:(r=e.state,0!==r.wrap&&r.mode!==Ct?xt:r.mode===Ct&&(i=1,i=G(i,t,n,0),i!==r.check)?Ot:(o=Jt(e,t,n,n),o?(r.mode=16210,It):(r.havedict=1,St)))},inflateInfo:"pako inflate (from Nodeca project)"},Qt=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 en=Object.prototype.toString,{Z_NO_FLUSH:tn,Z_FINISH:nn,Z_OK:rn,Z_STREAM_END:on,Z_NEED_DICT:an,Z_STREAM_ERROR:sn,Z_DATA_ERROR:cn,Z_MEM_ERROR:un}=Y;function ln(e){this.options=Ze.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qe,this.strm.avail_out=0;let n=Xt.inflateInit2(this.strm,t.windowBits);if(n!==rn)throw new Error(Z[n]);if(this.header=new Qt,Xt.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Xe.string2buf(t.dictionary):"[object ArrayBuffer]"===en.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Xt.inflateSetDictionary(this.strm,t.dictionary),n!==rn)))throw new Error(Z[n])}function dn(e,t){const n=new ln(t);if(n.push(e),n.err)throw n.msg||Z[n.err];return n.result}ln.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?nn:tn,"[object ArrayBuffer]"===en.call(e)?n.input=new Uint8Array(e):n.input=e,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=Xt.inflate(n,a),o===an&&i&&(o=Xt.inflateSetDictionary(n,i),o===rn?o=Xt.inflate(n,a):o===cn&&(o=an));n.avail_in>0&&o===on&&n.state.wrap>0&&0!==e[n.next_in];)Xt.inflateReset(n),o=Xt.inflate(n,a);switch(o){case sn:case cn:case an:case un:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(0===n.avail_out||o===on))if("string"===this.options.to){let e=Xe.utf8border(n.output,n.next_out),t=n.next_out-e,i=Xe.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),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!==s){if(o===on)return o=Xt.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},ln.prototype.onData=function(e){this.chunks.push(e)},ln.prototype.onEnd=function(e){e===rn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ze.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var fn={Inflate:ln,inflate:dn,inflateRaw:function(e,t){return(t=t||{}).raw=!0,dn(e,t)},ungzip:dn,constants:Y};const{Deflate:hn,deflate:pn,deflateRaw:yn,gzip:mn}=ft,{Inflate:gn,inflate:bn,inflateRaw:vn,ungzip:wn}=fn;var _n=bn,En=n(6729),Sn=n.n(En),An=n(8764).Buffer;const kn=e=>"version"in e;var xn=Object.freeze({__proto__:null,encode:function(e){return e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"0x")},decode:function(e){0===e.indexOf("0x")&&(e=e.substr(2)),e.length%2==1&&(e="0"+e);let t=e.match(/.{2}/g);return null===t?r.Buffer.from([]):r.Buffer.from(t.map((e=>parseInt(e,16))))}});function On(e){return new TextDecoder("utf-8").decode(e)}var In=Object.freeze({__proto__:null,decode:On,encode:function(e){return(new TextEncoder).encode(e)}});function Rn(e){return c().encode(e)}var Tn=Object.freeze({__proto__:null,encode:Rn,decode:function(e){return c().decode(e)}});function Pn(e){return e.toString("base64")}function Cn(e){return r.Buffer.from(e,"base64")}var Nn=Object.freeze({__proto__:null,encode:Pn,decode:Cn}),Bn=Object.freeze({__proto__:null,hex:xn,utf8:In,bs58:Tn,base64:Nn});function Mn(e){return"accounts"in e}const Ln=d.struct([d.publicKey("authority"),d.vecU8("data")]);function Dn(e,t,n,r){return(null==e?void 0:e.length)?e[0].name?n(e):r(e):t()}function zn(e){const t=new Map;return e.errors&&e.errors.forEach((e=>{var n;let r=null!==(n=e.msg)&&void 0!==n?n:e.name;t.set(e.code,r)})),t}function jn(e,...t){if(e.args.length!=t.length)throw new Error("Invalid argument length");const n={};let r=0;return e.args.forEach((e=>{n[e.name]=t[r],r+=1})),n}function Un(e,t={}){e.forEach((e=>{if(Mn(e))Un(e.accounts,t[e.name]);else if(!t[e.name])throw new Error(`Account \`${e.name}\` not provided.`)}))}function Fn(e){return e instanceof i.PublicKey?e:new i.PublicKey(e)}class Wn extends TypeError{constructor(e,t){let n;const{message:r,...i}=e,{path:o}=e;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=[e,...t()]}}}function Hn(e){return"object"==typeof e&&null!=e}function qn(e){return"string"==typeof e?JSON.stringify(e):""+e}function Kn(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:a}=n,{refinement:s,message:c="Expected a value of type `"+a+"`"+(s?" with refinement `"+s+"`":"")+", but received: `"+qn(r)+"`"}=e;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*Gn(e,t,n,r){var i;Hn(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const i of e){const e=Kn(i,t,n,r);e&&(yield e)}}function*$n(e,t,n){void 0===n&&(n={});const{path:r=[],branch:i=[e],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&Hn(t.schema)&&Hn(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c=!0;for(const n of t.validator(e,s))c=!1,yield[n,void 0];for(let[n,u,l]of t.entries(e,s)){const t=$n(u,l,{path:void 0===n?r:[...r,n],branch:void 0===n?i:[...i,u],coerce:o,mask:a});for(const r of t)r[0]?(c=!1,yield[r[0],void 0]):o&&(u=r[1],void 0===n?e=u:e instanceof Map?e.set(n,u):e instanceof Set?e.add(u):Hn(e)&&(e[n]=u))}if(c)for(const n of t.refiner(e,s))c=!1,yield[n,void 0];c&&(yield[void 0,e])}class Vn{constructor(e){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:t,schema:n,validator:r,refiner:i,coercer:o=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(e,t)=>Gn(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>Gn(i(e,t),t,this,e):()=>[]}assert(e){return function(e,t){const n=Jn(e,t);if(n[0])throw n[0]}(e,this)}create(e){return Zn(e,this)}is(e){return Yn(e,this)}mask(e){return function(e,t){const n=Jn(e,t,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(e,this)}validate(e,t){return void 0===t&&(t={}),Jn(e,this,t)}}function Zn(e,t){const n=Jn(e,t,{coerce:!0});if(n[0])throw n[0];return n[1]}function Yn(e,t){return!Jn(e,t)[0]}function Jn(e,t,n){void 0===n&&(n={});const r=$n(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);return i[0]?[new Wn(i[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]:[void 0,i[1]]}function Xn(e,t){return new Vn({type:e,schema:null,validator:t})}function Qn(e){return new Vn({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+qn(e)})}function er(e){const t=qn(e),n=typeof e;return new Vn({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||"Expected the literal `"+t+"`, but received: "+qn(n)})}function tr(e){return new Vn({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function nr(){return Xn("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+qn(e)))}function rr(e){return new Vn({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function ir(){return Xn("string",(e=>"string"==typeof e||"Expected a string, but received: "+qn(e)))}function or(e){const t=Object.keys(e);return new Vn({type:"type",schema:e,*entries(n){if(Hn(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>Hn(e)||"Expected an object, but received: "+qn(e)})}function ar(e){const t=e.map((e=>e.type)).join(" | ");return new Vn({type:"union",schema:null,coercer:(t,n)=>(e.find((e=>{const[n]=e.validate(t,{coerce:!0});return!n}))||sr()).coercer(t,n),validator(n,r){const i=[];for(const t of e){const[...e]=$n(n,t,r),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+qn(n),...i]}})}function sr(){return Xn("unknown",(()=>!0))}async function cr(e,t,n){if(t.length<=99)return await ur(e,t,n);{const r=function(e,t){return Array.apply(0,new Array(Math.ceil(e.length/99))).map(((t,n)=>e.slice(99*n,99*(n+1))))}(t);return(await Promise.all(r.map((t=>ur(e,t,n))))).flat()}}async function ur(e,t,n){const r=null!=n?n:e.commitment,{value:i,context:o}=await e.getMultipleAccountsInfoAndContext(t,r);return i.map(((e,n)=>null===e?null:{publicKey:t[n],account:e,context:o}))}async function lr(e,t,n,r,o){var a;n&&n.length>0&&t.sign(...n);const s=t._compile(),c=s.serialize(),u=t._serialize(c).toString("base64"),l={encoding:"base64",commitment:null!=r?r:e.commitment};if(o){const e=(Array.isArray(o)?o:s.nonProgramIds()).map((e=>e.toBase58()));l.accounts={encoding:"base64",addresses:e}}n&&n.length>0&&(l.sigVerify=!0);const d=[u,l],f=Zn(await e._rpcRequest("simulateTransaction",d),hr);if("error"in f){let e;if("data"in f.error&&(e=null===(a=f.error.data)||void 0===a?void 0:a.logs,e&&Array.isArray(e))){const t="\n ",n=t+e.join(t);console.error(f.error.message,n)}throw new i.SendTransactionError("failed to simulate transaction: "+f.error.message,e)}return f.result}const dr=fr(sr());function fr(e){return ar([or({jsonrpc:er("2.0"),id:ir(),result:e}),or({jsonrpc:er("2.0"),id:ir(),error:or({code:sr(),message:ir(),data:rr(Xn("any",(()=>!0)))})})])}const hr=(yr=or({err:tr(ar([or({}),ir()])),logs:tr(Qn(ir())),accounts:rr(tr(Qn(tr(or({executable:Xn("boolean",(e=>"boolean"==typeof e)),owner:ir(),lamports:nr(),data:Qn(ir()),rentEpoch:rr(nr())}))))),unitsConsumed:rr(nr())}),function(e,t,n){return new Vn({...e,coercer:(n,r)=>Yn(n,t)?e.coercer((e=>"error"in e?e:{...e,result:Zn(e.result,pr)})(n),r):e.coercer(n,r)})}(fr(pr=or({context:or({slot:nr()}),value:yr})),dr));var pr,yr,mr=Object.freeze({__proto__:null,invoke:async function(e,t,n,r){e=Fn(e),r||(r=Er());const o=new i.Transaction;if(o.add(new i.TransactionInstruction({programId:e,keys:null!=t?t:[],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(e,t,n){return(await cr(e,t,n)).map((e=>e?{publicKey:e.publicKey,account:e.account}:null))},getMultipleAccountsAndContext:cr,simulateTransaction:lr});class gr{constructor(e,t,n=gr.defaultOptions()){this.connection=e,this.wallet=t,this.opts=n,this.publicKey=null==t?void 0:t.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(e,t=gr.defaultOptions()){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(e,t,n){var r,o,a,s;if(void 0===n&&(n=this.opts),kn(e))t&&e.sign(t);else if(e.feePayer=null!==(r=e.feePayer)&&void 0!==r?r:this.wallet.publicKey,e.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,t)for(const n of t)e.partialSign(n);const c=(e=await this.wallet.signTransaction(e)).serialize();try{return await vr(this.connection,c,n)}catch(t){if(t instanceof wr){const n=Rn(kn(e)?(null===(o=e.signatures)||void 0===o?void 0:o[0])||new Uint8Array:null!==(a=e.signature)&&void 0!==a?a:new Uint8Array),r=kn(e)?0:void 0,c=await this.connection.getTransaction(n,{commitment:"confirmed",maxSupportedTransactionVersion:r});if(c){const e=null===(s=c.meta)||void 0===s?void 0:s.logMessages;throw e?new i.SendTransactionError(t.message,e):t}throw t}throw t}}async sendAll(e,t){var n,r,o;void 0===t&&(t=this.opts);const a=(await this.connection.getLatestBlockhash(t.preflightCommitment)).blockhash;let s=e.map((e=>{var t,n;if(kn(e.tx)){let t=e.tx;return e.signers&&t.sign(e.signers),t}{let r=e.tx,i=null!==(t=e.signers)&&void 0!==t?t:[];return r.feePayer=null!==(n=r.feePayer)&&void 0!==n?n:this.wallet.publicKey,r.recentBlockhash=a,i.forEach((e=>{r.partialSign(e)})),r}}));const c=await this.wallet.signAllTransactions(s),u=[];for(let e=0;e0&&(e.sign(t),e=await this.wallet.signTransaction(e)),i=await this.connection.simulateTransaction(e,{commitment:n})):(e.feePayer=e.feePayer||this.wallet.publicKey,e.recentBlockhash=o,t&&t.length>0&&(e=await this.wallet.signTransaction(e)),i=await lr(this.connection,e,t,n,r)),i.value.err)throw new br(i.value);return i.value}}class br extends Error{constructor(e,t){super(t),this.simulationResponse=e}}async function vr(e,t,n){const r=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment},i=await e.sendRawTransaction(t,r),o=(await e.confirmTransaction(i,n&&n.commitment)).value;if(o.err)throw new wr(`Raw transaction ${i} failed (${JSON.stringify(o)})`);return i}class wr extends Error{constructor(e){super(e)}}function _r(e){Sr=e}function Er(){return null===Sr?gr.local():Sr}let Sr=null;var Ar="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function kr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xr={};Object.defineProperty(xr,"__esModule",{value:!0});var Or=xr.ANCHOR_ERROR__REQUIRE_EQ_VIOLATED=xr.ANCHOR_ERROR__REQUIRE_VIOLATED=xr.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID=xr.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY=xr.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION=xr.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE=xr.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION=xr.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY=xr.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION=xr.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS=xr.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY=xr.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION=xr.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM=xr.ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM=xr.ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM=xr.ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE=xr.ANCHOR_ERROR__CONSTRAINT_SPACE=xr.ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS=xr.ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY=xr.ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY=xr.ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER=xr.ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT=xr.ANCHOR_ERROR__CONSTRAINT_ZERO=xr.ANCHOR_ERROR__CONSTRAINT_ADDRESS=xr.ANCHOR_ERROR__CONSTRAINT_CLOSE=xr.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT=xr.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED=xr.ANCHOR_ERROR__CONSTRAINT_STATE=xr.ANCHOR_ERROR__CONSTRAINT_EXECUTABLE=xr.ANCHOR_ERROR__CONSTRAINT_SEEDS=xr.ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT=xr.ANCHOR_ERROR__CONSTRAINT_OWNER=xr.ANCHOR_ERROR__CONSTRAINT_RAW=xr.ANCHOR_ERROR__CONSTRAINT_SIGNER=xr.ANCHOR_ERROR__CONSTRAINT_HAS_ONE=xr.ANCHOR_ERROR__CONSTRAINT_MUT=xr.ANCHOR_ERROR__EVENT_INSTRUCTION_STUB=xr.ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY=xr.ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM=xr.ANCHOR_ERROR__IDL_INSTRUCTION_STUB=xr.ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE=xr.ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE=xr.ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND=xr.ANCHOR_ERROR__INSTRUCTION_MISSING=void 0,Ir=xr.ANCHOR_ERROR__DEPRECATED=xr.ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION=xr.ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT=xr.ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH=xr.ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS=xr.ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT=xr.ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH=xr.ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT=xr.ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA=xr.ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED=xr.ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED=xr.ANCHOR_ERROR__ACCOUNT_NOT_SIGNER=xr.ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE=xr.ANCHOR_ERROR__INVALID_PROGRAM_ID=xr.ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM=xr.ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE=xr.ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS=xr.ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE=xr.ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE=xr.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH=xr.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND=xr.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET=xr.ANCHOR_ERROR__REQUIRE_GTE_VIOLATED=xr.ANCHOR_ERROR__REQUIRE_GT_VIOLATED=xr.ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED=xr.ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED=xr.ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED=void 0,Rr=xr.ANCHOR_ERROR__INSTRUCTION_MISSING=100,Tr=xr.ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND=101,Pr=xr.ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE=102,Cr=xr.ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE=103,Nr=xr.ANCHOR_ERROR__IDL_INSTRUCTION_STUB=1e3,Br=xr.ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM=1001,Mr=xr.ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY=1002,Lr=xr.ANCHOR_ERROR__EVENT_INSTRUCTION_STUB=1500,Dr=xr.ANCHOR_ERROR__CONSTRAINT_MUT=2e3,zr=xr.ANCHOR_ERROR__CONSTRAINT_HAS_ONE=2001,jr=xr.ANCHOR_ERROR__CONSTRAINT_SIGNER=2002,Ur=xr.ANCHOR_ERROR__CONSTRAINT_RAW=2003,Fr=xr.ANCHOR_ERROR__CONSTRAINT_OWNER=2004,Wr=xr.ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT=2005,Hr=xr.ANCHOR_ERROR__CONSTRAINT_SEEDS=2006,qr=xr.ANCHOR_ERROR__CONSTRAINT_EXECUTABLE=2007,Kr=xr.ANCHOR_ERROR__CONSTRAINT_STATE=2008,Gr=xr.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED=2009,$r=xr.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT=2010,Vr=xr.ANCHOR_ERROR__CONSTRAINT_CLOSE=2011,Zr=xr.ANCHOR_ERROR__CONSTRAINT_ADDRESS=2012,Yr=xr.ANCHOR_ERROR__CONSTRAINT_ZERO=2013,Jr=xr.ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT=2014,Xr=xr.ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER=2015,Qr=xr.ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY=2016,ei=xr.ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY=2017,ti=xr.ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS=2018,ni=xr.ANCHOR_ERROR__CONSTRAINT_SPACE=2019,ri=xr.ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE=2020,ii=xr.ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM=2021,oi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM=2022,ai=xr.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM=2023,si=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION=2024,ci=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY=2025,ui=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS=2026,li=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION=2027,di=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY=2028,fi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS=2029,hi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION=2030,pi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY=2031,yi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS=2032,mi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION=2033,gi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY=2034,bi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION=2035,vi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE=2036,wi=xr.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION=2037,_i=xr.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY=2038,Ei=xr.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID=2039,Si=xr.ANCHOR_ERROR__REQUIRE_VIOLATED=2500;Or=xr.ANCHOR_ERROR__REQUIRE_EQ_VIOLATED=2501;var Ai=xr.ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED=2502,ki=xr.ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED=2503,xi=xr.ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED=2504,Oi=xr.ANCHOR_ERROR__REQUIRE_GT_VIOLATED=2505,Ii=xr.ANCHOR_ERROR__REQUIRE_GTE_VIOLATED=2506,Ri=xr.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET=3e3,Ti=xr.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND=3001,Pi=xr.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH=3002,Ci=xr.ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE=3003,Ni=xr.ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE=3004,Bi=xr.ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS=3005,Mi=xr.ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE=3006,Li=xr.ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM=3007,Di=xr.ANCHOR_ERROR__INVALID_PROGRAM_ID=3008,zi=xr.ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE=3009,ji=xr.ANCHOR_ERROR__ACCOUNT_NOT_SIGNER=3010,Ui=xr.ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED=3011,Fi=xr.ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED=3012,Wi=xr.ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA=3013,Hi=xr.ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT=3014,qi=xr.ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH=3015,Ki=xr.ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT=3016,Gi=xr.ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS=3017,$i=xr.ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH=4100,Vi=xr.ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT=4101,Zi=xr.ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION=4102;Ir=xr.ANCHOR_ERROR__DEPRECATED=5e3;const Yi=new Set(["debug-logs"]),Ji=new Map;function Xi(e){return void 0!==Ji.get(e)}var Qi=Object.freeze({__proto__:null,set:function(e){if(!Yi.has(e))throw new Error("Invalid feature");Ji.set(e,!0)},isSet:Xi});class eo extends Error{constructor(e){super(e),this.name="IdlError"}}class to{constructor(e){this.stack=e}static parse(e){var t;const n=/^Program (\w*) invoke/,r=/^Program \w* success/,o=[];for(let a=0;ae.startsWith("Program log: AnchorError")));if(-1===t)return null;const n=e[t],r=[n];let o;if(t+11)return null;r=e[0].match(/([0-9]+)/g)[0]}try{i=parseInt(r)}catch(e){return null}let o=t.get(i);return void 0!==o?new ro(i,o,e.logs):(o=ao.get(i),void 0!==o?new ro(i,o,e.logs):null)}get program(){var e;return null===(e=this._programErrorStack)||void 0===e?void 0:e.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var e;return null===(e=this._programErrorStack)||void 0===e?void 0:e.stack}toString(){return this.msg}}function io(e,t){Xi("debug-logs")&&console.log("Translating error:",e);const n=no.parse(e.logs);if(n)return n;const r=ro.parse(e,t);if(r)return r;if(e.logs){const t={get:function(t,n){return"programErrorStack"===n?t.programErrorStack.stack:"program"===n?t.programErrorStack.stack[e.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return e.programErrorStack=to.parse(e.logs),new Proxy(e,t)}return e}const oo={InstructionMissing:Rr,InstructionFallbackNotFound:Tr,InstructionDidNotDeserialize:Pr,InstructionDidNotSerialize:Cr,IdlInstructionStub:Nr,IdlInstructionInvalidProgram:Br,IdlAccountNotEmpty:Mr,EventInstructionStub:Lr,ConstraintMut:Dr,ConstraintHasOne:zr,ConstraintSigner:jr,ConstraintRaw:Ur,ConstraintOwner:Fr,ConstraintRentExempt:Wr,ConstraintSeeds:Hr,ConstraintExecutable:qr,ConstraintState:Kr,ConstraintAssociated:Gr,ConstraintAssociatedInit:$r,ConstraintClose:Vr,ConstraintAddress:Zr,ConstraintZero:Yr,ConstraintTokenMint:Jr,ConstraintTokenOwner:Xr,ConstraintMintMintAuthority:Qr,ConstraintMintFreezeAuthority:ei,ConstraintMintDecimals:ti,ConstraintSpace:ni,ConstraintAccountIsNone:ri,ConstraintTokenTokenProgram:ii,ConstraintMintTokenProgram:oi,ConstraintAssociatedTokenTokenProgram:ai,ConstraintMintGroupPointerExtension:si,ConstraintMintGroupPointerExtensionAuthority:ci,ConstraintMintGroupPointerExtensionGroupAddress:ui,ConstraintMintGroupMemberPointerExtension:li,ConstraintMintGroupMemberPointerExtensionAuthority:di,ConstraintMintGroupMemberPointerExtensionMemberAddress:fi,ConstraintMintMetadataPointerExtension:hi,ConstraintMintMetadataPointerExtensionAuthority:pi,ConstraintMintMetadataPointerExtensionMetadataAddress:yi,ConstraintMintCloseAuthorityExtension:mi,ConstraintMintCloseAuthorityExtensionAuthority:gi,ConstraintMintPermanentDelegateExtension:bi,ConstraintMintPermanentDelegateExtensionDelegate:vi,ConstraintMintTransferHookExtension:wi,ConstraintMintTransferHookExtensionAuthority:_i,ConstraintMintTransferHookExtensionProgramId:Ei,RequireViolated:Si,RequireEqViolated:Or,RequireKeysEqViolated:Ai,RequireNeqViolated:ki,RequireKeysNeqViolated:xi,RequireGtViolated:Oi,RequireGteViolated:Ii,AccountDiscriminatorAlreadySet:Ri,AccountDiscriminatorNotFound:Ti,AccountDiscriminatorMismatch:Pi,AccountDidNotDeserialize:Ci,AccountDidNotSerialize:Ni,AccountNotEnoughKeys:Bi,AccountNotMutable:Mi,AccountOwnedByWrongProgram:Li,InvalidProgramId:Di,InvalidProgramExecutable:zi,AccountNotSigner:ji,AccountNotSystemOwned:Ui,AccountNotInitialized:Fi,AccountNotProgramData:Wi,AccountNotAssociatedTokenAccount:Hi,AccountSysvarMismatch:qi,AccountReallocExceedsLimit:Ki,AccountDuplicateReallocs:Gi,DeclaredProgramIdMismatch:$i,TryingToInitPayerAsProgramAccount:Vi,InvalidNumericConversion:Zi,Deprecated:Ir},ao=new Map([[oo.InstructionMissing,"8 byte instruction identifier not provided"],[oo.InstructionFallbackNotFound,"Fallback functions are not supported"],[oo.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[oo.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[oo.IdlInstructionStub,"The program was compiled without idl instructions"],[oo.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[oo.IdlAccountNotEmpty,"IDL account must be empty in order to resize, try closing first"],[oo.EventInstructionStub,"The program was compiled without `event-cpi` feature"],[oo.ConstraintMut,"A mut constraint was violated"],[oo.ConstraintHasOne,"A has one constraint was violated"],[oo.ConstraintSigner,"A signer constraint was violated"],[oo.ConstraintRaw,"A raw constraint was violated"],[oo.ConstraintOwner,"An owner constraint was violated"],[oo.ConstraintRentExempt,"A rent exemption constraint was violated"],[oo.ConstraintSeeds,"A seeds constraint was violated"],[oo.ConstraintExecutable,"An executable constraint was violated"],[oo.ConstraintState,"Deprecated Error, feel free to replace with something else"],[oo.ConstraintAssociated,"An associated constraint was violated"],[oo.ConstraintAssociatedInit,"An associated init constraint was violated"],[oo.ConstraintClose,"A close constraint was violated"],[oo.ConstraintAddress,"An address constraint was violated"],[oo.ConstraintZero,"Expected zero account discriminant"],[oo.ConstraintTokenMint,"A token mint constraint was violated"],[oo.ConstraintTokenOwner,"A token owner constraint was violated"],[oo.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[oo.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[oo.ConstraintMintDecimals,"A mint decimals constraint was violated"],[oo.ConstraintSpace,"A space constraint was violated"],[oo.ConstraintAccountIsNone,"A required account for the constraint is None"],[oo.ConstraintTokenTokenProgram,"A token account token program constraint was violated"],[oo.ConstraintMintTokenProgram,"A mint token program constraint was violated"],[oo.ConstraintAssociatedTokenTokenProgram,"An associated token account token program constraint was violated"],[oo.ConstraintMintGroupPointerExtension,"A group pointer extension constraint was violated"],[oo.ConstraintMintGroupPointerExtensionAuthority,"A group pointer extension authority constraint was violated"],[oo.ConstraintMintGroupPointerExtensionGroupAddress,"A group pointer extension group address constraint was violated"],[oo.ConstraintMintGroupMemberPointerExtension,"A group member pointer extension constraint was violated"],[oo.ConstraintMintGroupMemberPointerExtensionAuthority,"A group member pointer extension authority constraint was violated"],[oo.ConstraintMintGroupMemberPointerExtensionMemberAddress,"A group member pointer extension group address constraint was violated"],[oo.ConstraintMintMetadataPointerExtension,"A metadata pointer extension constraint was violated"],[oo.ConstraintMintMetadataPointerExtensionAuthority,"A metadata pointer extension authority constraint was violated"],[oo.ConstraintMintMetadataPointerExtensionMetadataAddress,"A metadata pointer extension metadata address constraint was violated"],[oo.ConstraintMintCloseAuthorityExtension,"A close authority constraint was violated"],[oo.ConstraintMintCloseAuthorityExtensionAuthority,"A close authority extension authority constraint was violated"],[oo.ConstraintMintPermanentDelegateExtension,"A permanent delegate extension constraint was violated"],[oo.ConstraintMintPermanentDelegateExtensionDelegate,"A permanent delegate extension delegate constraint was violated"],[oo.ConstraintMintTransferHookExtension,"A transfer hook extension constraint was violated"],[oo.ConstraintMintTransferHookExtensionAuthority,"A transfer hook extension authority constraint was violated"],[oo.ConstraintMintTransferHookExtensionProgramId,"A transfer hook extension transfer hook program id constraint was violated"],[oo.RequireViolated,"A require expression was violated"],[oo.RequireEqViolated,"A require_eq expression was violated"],[oo.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[oo.RequireNeqViolated,"A require_neq expression was violated"],[oo.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[oo.RequireGtViolated,"A require_gt expression was violated"],[oo.RequireGteViolated,"A require_gte expression was violated"],[oo.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[oo.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[oo.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[oo.AccountDidNotDeserialize,"Failed to deserialize the account"],[oo.AccountDidNotSerialize,"Failed to serialize the account"],[oo.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[oo.AccountNotMutable,"The given account is not mutable"],[oo.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[oo.InvalidProgramId,"Program ID was not as expected"],[oo.InvalidProgramExecutable,"Program account is not executable"],[oo.AccountNotSigner,"The given account did not sign"],[oo.AccountNotSystemOwned,"The given account is not owned by the system program"],[oo.AccountNotInitialized,"The program expected this account to be already initialized"],[oo.AccountNotProgramData,"The given account is not a program data account"],[oo.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[oo.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[oo.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[oo.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[oo.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[oo.TryingToInitPayerAsProgramAccount,"You cannot/should not initialize the payer account as a program account"],[oo.InvalidNumericConversion,"The program could not perform the numeric conversion, out of range integral type conversion attempted"],[oo.Deprecated,"The API being used is deprecated and should no longer be used"]]);class so{static fieldLayout(e,t=[],n){const r=e.name;switch(e.type){case"bool":return d.bool(r);case"u8":return d.u8(r);case"i8":return d.i8(r);case"u16":return d.u16(r);case"i16":return d.i16(r);case"u32":return d.u32(r);case"i32":return d.i32(r);case"f32":return d.f32(r);case"u64":return d.u64(r);case"i64":return d.i64(r);case"f64":return d.f64(r);case"u128":return d.u128(r);case"i128":return d.i128(r);case"u256":return d.u256(r);case"i256":return d.i256(r);case"bytes":return d.vecU8(r);case"string":return d.str(r);case"pubkey":return d.publicKey(r);default:if("option"in e.type)return d.option(so.fieldLayout({type:e.type.option},t,n),r);if("vec"in e.type)return d.vec(so.fieldLayout({type:e.type.vec},t,n),r);if("array"in e.type){let[i,o]=e.type.array;return o=so.resolveArrayLen(o,n),d.array(so.fieldLayout({type:i},t,n),o,r)}if("defined"in e.type){if(!t)throw new eo("User defined types not provided");const i=e.type.defined.name,o=t.find((e=>e.name===i));if(!o)throw new eo(`Type not found: ${e.name}`);return so.typeDefLayout({typeDef:o,types:t,genericArgs:null!=n?n:e.type.defined.generics,name:r})}if("generic"in e.type){const r=null==n?void 0:n.at(0);if("type"!==(null==r?void 0:r.kind))throw new eo(`Invalid generic field: ${e.name}`);return so.fieldLayout({...e,type:r.type},t)}throw new eo(`Not yet implemented: ${JSON.stringify(e.type)}`)}}static typeDefLayout({typeDef:e,types:t,name:n,genericArgs:r}){switch(e.type.kind){case"struct":{const i=Dn(e.type.fields,(()=>[]),(n=>n.map((n=>{const i=r?so.resolveGenericArgs({type:n.type,typeDef:e,genericArgs:r}):r;return so.fieldLayout(n,t,i)}))),(n=>n.map(((n,i)=>{const o=r?so.resolveGenericArgs({type:n,typeDef:e,genericArgs:r}):r;return so.fieldLayout({name:i.toString(),type:n},t,o)}))));return d.struct(i,n)}case"enum":{const i=e.type.variants.map((n=>{const i=Dn(n.fields,(()=>[]),(n=>n.map((n=>{const i=r?so.resolveGenericArgs({type:n.type,typeDef:e,genericArgs:r}):r;return so.fieldLayout(n,t,i)}))),(n=>n.map(((n,i)=>{const o=r?so.resolveGenericArgs({type:n,typeDef:e,genericArgs:r}):r;return so.fieldLayout({name:i.toString(),type:n},t,o)}))));return d.struct(i,n.name)}));return void 0!==n?d.rustEnum(i).replicate(n):d.rustEnum(i,n)}case"type":return so.fieldLayout({type:e.type.alias,name:n},t)}}static typeSize(e,t,n){var 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"pubkey":return 32;default:if("option"in e)return 1+so.typeSize(e.option,t,n);if("coption"in e)return 4+so.typeSize(e.coption,t,n);if("vec"in e)return 1;if("array"in e){let[r,i]=e.array;return i=so.resolveArrayLen(i,n),so.typeSize(r,t,n)*i}if("defined"in e){const i=null===(r=t.types)||void 0===r?void 0:r.find((t=>t.name===e.defined.name));if(!i)throw new eo(`Type not found: ${JSON.stringify(e)}`);const o=r=>{const o=null!=n?n:e.defined.generics,a=o?so.resolveGenericArgs({type:r,typeDef:i,genericArgs:o}):o;return so.typeSize(r,t,a)};switch(i.type.kind){case"struct":return Dn(i.type.fields,(()=>[0]),(e=>e.map((e=>o(e.type)))),(e=>e.map((e=>o(e))))).reduce(((e,t)=>e+t),0);case"enum":{const e=i.type.variants.map((e=>Dn(e.fields,(()=>[0]),(e=>e.map((e=>o(e.type)))),(e=>e.map((e=>o(e))))).reduce(((e,t)=>e+t),0)));return Math.max(...e)+1}case"type":return so.typeSize(i.type.alias,t,n)}}if("generic"in e){const r=null==n?void 0:n.at(0);if("type"!==(null==r?void 0:r.kind))throw new eo(`Invalid generic: ${e.generic}`);return so.typeSize(r.type,t,n)}throw new Error(`Invalid type ${JSON.stringify(e)}`)}}static resolveArrayLen(e,t){if("number"==typeof e)return e;if(t){const n=t.find((e=>"const"===e.kind));"const"===(null==n?void 0:n.kind)&&(e=+n.value)}if("number"!=typeof e)throw new eo("Generic array length did not resolve");return e}static resolveGenericArgs({type:e,typeDef:t,genericArgs:n,isDefined:r}){if("object"!=typeof e)return null;for(const i in t.generics){const o=t.generics[i];if("generic"in e&&o.name===e.generic)return[n[i]];if("option"in e){const i=so.resolveGenericArgs({type:e.option,typeDef:t,genericArgs:n,isDefined:r});if(!i||!r)return i;if("type"===i[0].kind)return[{kind:"type",type:{option:i[0].type}}]}if("vec"in e){const i=so.resolveGenericArgs({type:e.vec,typeDef:t,genericArgs:n,isDefined:r});if(!i||!r)return i;if("type"===i[0].kind)return[{kind:"type",type:{vec:i[0].type}}]}if("array"in e){const[a,s]=e.array,c="object"==typeof s,u=so.resolveGenericArgs({type:a,typeDef:t,genericArgs:n,isDefined:r});if(u){for(const e in t.generics.slice(+i)){const r=+i+ +e;c&&t.generics[r].name===s.generic&&u.push(n[r])}if(!r)return u;if("type"===u[0].kind&&"const"===u[1].kind)return[{kind:"type",type:{array:[u[0].type,+u[1].value]}}]}if(c&&o.name===s.generic){const e=n[i];return r?[{kind:"type",type:{array:[a,+e.value]}}]:[e]}return null}if("defined"in e)return e.defined.generics?e.defined.generics.flatMap((e=>{switch(e.kind){case"type":return so.resolveGenericArgs({type:e.type,typeDef:t,genericArgs:n,isDefined:!0});case"const":return[e]}})).filter((e=>null!==e)):null}return null}}class co{constructor(e){this.idl=e;const t=e.instructions.map((t=>{const n=t.name,r=t.args.map((t=>so.fieldLayout(t,e.types))),i=d.struct(r,n);return[n,{discriminator:t.discriminator,layout:i}]}));this.ixLayouts=new Map(t);const n=t.map((([e,{discriminator:t,layout:n}])=>[c().encode(t),{name:e,layout:n}]));this.sighashLayouts=new Map(n)}encode(e,t){const n=r.Buffer.alloc(1e3),i=this.ixLayouts.get(e);if(!i)throw new Error(`Unknown method: ${e}`);const o=i.layout.encode(t,n),a=n.slice(0,o);return r.Buffer.concat([r.Buffer.from(i.discriminator),a])}decode(e,t="hex"){"string"==typeof e&&(e="hex"===t?r.Buffer.from(e,"hex"):c().decode(e));const n=e.slice(0,lo),i=e.slice(lo),o=this.sighashLayouts.get(c().encode(n));return o?{name:o.name,data:o.layout.decode(i)}:null}format(e,t){return uo.format(e,t,this.idl)}}class uo{static format(e,t,n){const r=n.instructions.find((t=>e.name===t.name));if(!r)return console.error("Invalid instruction given"),null;const i=r.args.map((t=>({name:t.name,type:uo.formatIdlType(t.type),data:uo.formatIdlData(t,e.data[t.name],n.types)}))),o=uo.flattenIdlAccounts(r.accounts);return{args:i,accounts:t.map(((e,t)=>t`;if("coption"in e)return`COption<${this.formatIdlType(e.coption)}>`;if("vec"in e)return`Vec<${this.formatIdlType(e.vec)}>`;if("array"in e)return`Array<${e.array[0]}; ${e.array[1]}>`;if("defined"in e){const t=e.defined.name;return e.defined.generics?`${t}<${e.defined.generics.map((e=>{switch(e.kind){case"type":return uo.formatIdlType(e.type);case"const":return e.value}})).join(", ")}>`:t}throw new Error(`Unknown IDL type: ${e}`)}static formatIdlData(e,t,n){if("string"==typeof e.type)return t.toString();if("vec"in e.type)return"["+t.map((t=>this.formatIdlData({name:"",type:e.type.vec},t,n))).join(", ")+"]";if("option"in e.type)return null===t?"null":this.formatIdlData({name:"",type:e.type.option},t,n);if("defined"in e.type){if(!n)throw new Error("User defined types not provided");const r=e.type.defined.name,i=n.find((e=>e.name===r));if(!i)throw new Error(`Type not found: ${r}`);return uo.formatIdlDataDefined(i,t,n)}return"unknown"}static formatIdlDataDefined(e,t,n){switch(e.type.kind){case"struct":return"{ "+Dn(e.type.fields,(()=>""),(e=>Object.entries(t).map((([t,r])=>{const i=e.find((e=>e.name===t));if(!i)throw new Error(`Field not found: ${t}`);return t+": "+uo.formatIdlData(i,r,n)})).join(", ")),(e=>Object.entries(t).map((([t,r])=>t+": "+uo.formatIdlData({name:"",type:e[t]},r,n))).join(", ")))+" }";case"enum":{const r=Object.keys(t)[0],i=e.type.variants.find((e=>e.name===r));if(!i)throw new Error(`Unable to find variant: ${r}`);const o=t[r];return Dn(i.fields,(()=>r),(e=>{const t=Object.keys(o).map((t=>{const r=o[t],i=e.find((e=>e.name===t));if(!i)throw new Error(`Field not found: ${t}`);return t+": "+uo.formatIdlData(i,r,n)})).join(", ");return`${r} { ${t} }`}),(e=>{const t=Object.entries(o).map((([t,r])=>t+": "+uo.formatIdlData({name:"",type:e[t]},r,n))).join(", ");return`${r} { ${t} }`}))}case"type":return uo.formatIdlType(e.type.alias)}}static flattenIdlAccounts(e,t){return e.map((e=>{const n=function(e){const t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}(e.name);if(e.hasOwnProperty("accounts")){const r=t?`${t} > ${n}`:n;return uo.flattenIdlAccounts(e.accounts,r)}return{...e,name:t?`${t} > ${n}`:n}})).flat()}}const lo=8;class fo{constructor(e){if(this.idl=e,!e.accounts)return void(this.accountLayouts=new Map);const t=e.types;if(!t)throw new Error("Accounts require `idl.types`");const n=e.accounts.map((e=>{const n=t.find((t=>t.name===e.name));if(!n)throw new Error(`Account not found: ${e.name}`);return[e.name,so.typeDefLayout({typeDef:n,types:t})]}));this.accountLayouts=new Map(n)}async encode(e,t){const n=r.Buffer.alloc(1e3),i=this.accountLayouts.get(e);if(!i)throw new Error(`Unknown account: ${e}`);const o=i.encode(t,n),a=n.slice(0,o),s=this.accountDiscriminator(e);return r.Buffer.concat([s,a])}decode(e,t){if(this.accountDiscriminator(e).compare(t.slice(0,lo)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(e,t)}decodeAny(e){const t=e.slice(0,lo),n=Array.from(this.accountLayouts.keys()).find((e=>this.accountDiscriminator(e).equals(t)));if(!n)throw new Error("Account not found");return this.decodeUnchecked(n,e)}decodeUnchecked(e,t){const n=t.subarray(lo),r=this.accountLayouts.get(e);if(!r)throw new Error(`Unknown account: ${e}`);return r.decode(n)}memcmp(e,t){const n=this.accountDiscriminator(e);return{offset:0,bytes:c().encode(t?r.Buffer.concat([n,t]):n)}}size(e){return lo+so.typeSize({defined:{name:e}},this.idl)}accountDiscriminator(e){var t;const n=null===(t=this.idl.accounts)||void 0===t?void 0:t.find((t=>t.name===e));if(!n)throw new Error(`Account not found: ${e}`);return r.Buffer.from(n.discriminator)}}class ho{constructor(e){var t;if(!e.events)return void(this.layouts=new Map);const n=e.types;if(!n)throw new Error("Events require `idl.types`");const i=e.events.map((e=>{const t=n.find((t=>t.name===e.name));if(!t)throw new Error(`Event not found: ${e.name}`);return[e.name,so.typeDefLayout({typeDef:t,types:n})]}));this.layouts=new Map(i),this.discriminators=new Map((null!==(t=e.events)&&void 0!==t?t:[]).map((e=>[Pn(r.Buffer.from(e.discriminator)),e.name])))}decode(e){let t;try{t=Cn(e)}catch(e){return null}const n=Pn(t.slice(0,8)),r=this.discriminators.get(n);if(!r)return null;const i=this.layouts.get(r);if(!i)throw new Error(`Unknown event: ${r}`);return{data:i.decode(t.slice(8)),name:r}}}class po{constructor(e){const t=e.types;if(!t)return void(this.typeLayouts=new Map);const n=t.filter((e=>!e.generics)).map((e=>[e.name,so.typeDefLayout({typeDef:e,types:t})]));this.typeLayouts=new Map(n)}encode(e,t){const n=r.Buffer.alloc(1e3),i=this.typeLayouts.get(e);if(!i)throw new Error(`Unknown type: ${e}`);const o=i.encode(t,n);return n.slice(0,o)}decode(e,t){const n=this.typeLayouts.get(e);if(!n)throw new Error(`Unknown type: ${e}`);return n.decode(t)}}class yo{constructor(e){this.instruction=new co(e),this.accounts=new fo(e),this.events=new ho(e),this.types=new po(e)}}class mo{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}var go=mo;class bo extends mo{isCount(){throw new Error("ExternalLayout is abstract")}}class vo extends bo{constructor(e,t,n){if(!(e instanceof mo))throw new TypeError("layout must be a Layout");if(void 0===t)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof wo||this.layout instanceof _o}decode(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}class wo extends mo{constructor(e,t){if(super(e,t),6e&&t instanceof mo),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t){void 0===t&&(t=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let a=r.span;if(o=0a&&(a=r.getSpan(t,n)))}i=n,n+=a}return i+o-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?t=-1:0<=t&&(t+=n.span)}}}class Oo{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class Io extends Oo{constructor(e,t){if(!(e instanceof bo&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class Ro extends mo{constructor(e,t,n){const r=e instanceof wo||e instanceof _o;if(r)e=new Io(new vo(e));else if(e instanceof bo&&e.isCount())e=new Io(e);else if(!(e instanceof Oo))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof mo))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&(i=t.span,0<=i&&r&&(i+=e.layout.span)),super(i,n),this.discriminator=e,this.usesPrefixDiscriminator=r,this.defaultLayout=t,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return o(e)},this.configGetSourceVariant=function(e){o=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;void 0===t&&(t=0);const r=this.discriminator,i=r.decode(e,t);let o=this.registry[i];if(void 0===o){let a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(e,t+a)}else n=o.decode(e,t);return n}encode(e,t,n){void 0===n&&(n=0);const r=this.getSourceVariant(e);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(e[r.property],t,n),o+i.encode(e[i.property],t,n+o)}return r.encode(e,t,n)}addVariant(e,t,n){const r=new To(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return An.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class To extends mo{constructor(e,t,n,r){if(!(e instanceof Ro))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)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 mo))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=n.span&&n.span>e.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=e.span;0>e.span&&(i=n?n.span:0,0<=i&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span)),super(i,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))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(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}class Po extends mo{constructor(e,t){if(!(e instanceof bo&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof bo||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){void 0===t&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof bo&&(r=e.length),!An.isBuffer(e)||r!==e.length)throw new TypeError((i="Blob.encode",(this.property?i+"["+this.property+"]":i)+" requires (length "+r+") Buffer as src"));var i;if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof bo&&this.length.encode(r,t,n),r}}var Co=(e,t,n)=>new vo(e,t,n),No=e=>new wo(4,e),Bo=e=>new ko(e),Mo=(e,t,n)=>new xo(e,t,n),Lo=(e,t,n)=>new Ro(e,t,n),Do=(e,t)=>new Po(e,t);class zo{constructor(e){}encode(e,t){switch(e){case"createAccount":return function({lamports:e,space:t,owner:n}){return Ho({createAccount:{lamports:e,space:t,owner:n.toBuffer()}})}(t);case"assign":return function({owner:e}){return Ho({assign:{owner:e.toBuffer()}})}(t);case"transfer":return function({lamports:e}){return Ho({transfer:{lamports:e}})}(t);case"createAccountWithSeed":return function({base:e,seed:t,lamports:n,space:r,owner:i}){return Ho({createAccountWithSeed:{base:e.toBuffer(),seed:t,lamports:n,space:r,owner:i.toBuffer()}},Wo.getVariant(3).span+t.length)}(t);case"advanceNonceAccount":return function({authorized:e}){return Ho({advanceNonceAccount:{authorized:e.toBuffer()}})}(t);case"withdrawNonceAccount":return function({lamports:e}){return Ho({withdrawNonceAccount:{lamports:e}})}(t);case"initializeNonceAccount":return function({authorized:e}){return Ho({initializeNonceAccount:{authorized:e.toBuffer()}})}(t);case"authorizeNonceAccount":return function({authorized:e}){return Ho({authorizeNonceAccount:{authorized:e.toBuffer()}})}(t);case"allocate":return function({space:e}){return Ho({allocate:{space:e}})}(t);case"allocateWithSeed":return function({base:e,seed:t,space:n,owner:r}){return Ho({allocateWithSeed:{base:e.toBuffer(),seed:t,space:n,owner:r.toBuffer()}},Wo.getVariant(9).span+t.length)}(t);case"assignWithSeed":return function({base:e,seed:t,owner:n}){return Ho({assignWithSeed:{base:e.toBuffer(),seed:t,owner:n.toBuffer()}},Wo.getVariant(10).span+t.length)}(t);case"transferWithSeed":return function({lamports:e,seed:t,owner:n}){return Ho({transferWithSeed:{lamports:e,seed:t,owner:n.toBuffer()}},Wo.getVariant(11).span+t.length)}(t);default:throw new Error(`Invalid instruction: ${e}`)}}encodeState(e,t){throw new Error("System does not have state")}}class jo extends go{constructor(e){super(-1,e),this.property=e,this.layout=Mo([No("length"),No("lengthPadding"),Do(Co(No(),-8),"chars")],this.property)}encode(e,t,n=0){if(null==e)return this.layout.span;const r={chars:An.from(e,"utf8")};return this.layout.encode(r,t,n)}decode(e,t=0){return this.layout.decode(e,t).chars.toString()}getSpan(e,t=0){return No().span+No().span+new(a())(new Uint8Array(e).slice(t,t+4),10,"le").toNumber()}}function Uo(e){return new jo(e)}function Fo(e){return Do(32,e)}const Wo=Lo(No("instruction"));function Ho(e,t){const n=An.alloc(null!=t?t:qo),r=Wo.encode(e,n);return void 0===t?n.slice(0,r):n}Wo.addVariant(0,Mo([Bo("lamports"),Bo("space"),Fo("owner")]),"createAccount"),Wo.addVariant(1,Mo([Fo("owner")]),"assign"),Wo.addVariant(2,Mo([Bo("lamports")]),"transfer"),Wo.addVariant(3,Mo([Fo("base"),Uo("seed"),Bo("lamports"),Bo("space"),Fo("owner")]),"createAccountWithSeed"),Wo.addVariant(4,Mo([Fo("authorized")]),"advanceNonceAccount"),Wo.addVariant(5,Mo([Bo("lamports")]),"withdrawNonceAccount"),Wo.addVariant(6,Mo([Fo("authorized")]),"initializeNonceAccount"),Wo.addVariant(7,Mo([Fo("authorized")]),"authorizeNonceAccount"),Wo.addVariant(8,Mo([Bo("space")]),"allocate"),Wo.addVariant(9,Mo([Fo("base"),Uo("seed"),Bo("space"),Fo("owner")]),"allocateWithSeed"),Wo.addVariant(10,Mo([Fo("base"),Uo("seed"),Fo("owner")]),"assignWithSeed"),Wo.addVariant(11,Mo([Bo("lamports"),Uo("seed"),Fo("owner")]),"transferWithSeed");const qo=Math.max(...Object.values(Wo.registry).map((e=>e.span)));class Ko{constructor(e){this.idl=e}async encode(e,t){if("nonce"===e){const e=An.alloc(i.NONCE_ACCOUNT_LENGTH),n=Vo.encode(t,e);return e.slice(0,n)}throw new Error(`Invalid account name: ${e}`)}decode(e,t){return this.decodeUnchecked(e,t)}decodeUnchecked(e,t){if("nonce"===e)return function(e){return Vo.decode(e)}(t);throw new Error(`Invalid account name: ${e}`)}memcmp(e,t){if("nonce"===e)return{dataSize:i.NONCE_ACCOUNT_LENGTH};throw new Error(`Invalid account name: ${e}`)}size(e){return so.typeSize({defined:{name:e}},this.idl)}}class Go extends go{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}function $o(e){return new Go(Do(32),(e=>new i.PublicKey(e)),(e=>e.toBuffer()),e)}const Vo=Mo([No("version"),No("state"),$o("authorizedPubkey"),$o("nonce"),Mo([new class extends mo{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return Ao(e.readUInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=So(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}("lamportsPerSignature")],"feeCalculator")]);class Zo{constructor(e){}decode(e){throw new Error("System program does not have events")}}class Yo{constructor(e){}encode(e,t){throw new Error("System does not have user-defined types")}decode(e,t){throw new Error("System does not have user-defined types")}}class Jo{constructor(e){this.instruction=new zo(e),this.accounts=new Ko(e),this.events=new Zo(e),this.types=new Yo(e)}}var Xo=Object.freeze({__proto__:null,hash:function(e){return(new TextDecoder).decode((0,f.J)(e))}}),Qo=Object.freeze({__proto__:null,createWithSeedSync:function(e,t,n){const o=r.Buffer.concat([e.toBuffer(),r.Buffer.from(t),n.toBuffer()]);return new i.PublicKey((0,f.J)(o))}});const ea=new i.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),ta=new i.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var na=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:ea,ASSOCIATED_PROGRAM_ID:ta,associatedAddress:function({mint:e,owner:t}){return i.PublicKey.findProgramAddressSync([t.toBuffer(),ea.toBuffer(),e.toBuffer()],ta)[0]}}),ra={exports:{}};!function(e,t){var n="undefined"!=typeof self?self:Ar,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,a="ArrayBuffer"in e;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?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(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;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?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.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 w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function _(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];_.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,n){return new Promise((function(r,o){var a=new v(e,n);if(a.signal&&a.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;r(new _(i,n))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",c)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}S.polyfill=!0,e.fetch||(e.fetch=S,e.Headers=f,e.Request=v,e.Response=_),t.Headers=f,t.Request=v,t.Response=_,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(ra,ra.exports);var ia=kr(ra.exports);async function oa(e,t){const n=await e.getAccountInfo(t);if(null===n)throw new Error("program account not found");const{program:r}=sa(n.data),i=await e.getAccountInfo(r.programdataAddress);if(null===i)throw new Error("program data account not found");const{programData:o}=sa(i.data);return o}const aa=d.rustEnum([d.struct([],"uninitialized"),d.struct([d.option(d.publicKey(),"authorityAddress")],"buffer"),d.struct([d.publicKey("programdataAddress")],"program"),d.struct([d.u64("slot"),d.option(d.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,d.u32());function sa(e){return aa.decode(e)}var ca=Object.freeze({__proto__:null,verifiedBuild:async function(e,t,n=5){const r=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${n}`,[i,o]=await Promise.all([oa(e,t),ia(r)]),a=(await o.json()).filter((e=>!e.aborted&&"Built"===e.state&&"Verified"===e.verified));if(0===a.length)return null;const s=a[0];return i.slot.toNumber()!==s.verified_slot?null:s},fetchData:oa,decodeUpgradeableLoaderState:sa}),ua=Object.freeze({__proto__:null,sha256:Xo,rpc:mr,publicKey:Qo,bytes:Bn,token:na,features:Qi,registry:ca});function la(e,t){var n,r;let i={};const o=e.args?e.args.length:0;if(t.length>o){if(t.length!==o+1)throw new Error(`provided too many arguments ${t} to instruction ${null==e?void 0:e.name} expecting: ${null!==(r=null===(n=e.args)||void 0===n?void 0:n.map((e=>e.name)))&&void 0!==r?r:[]}`);i=t.pop()}return[t,i]}class da{static build(e,t,n){if("_inner"===e.name)throw new eo("the _inner name is reserved");const r=(...o)=>{const[a,s]=la(e,[...o]);Un(e.accounts,s.accounts);const c=r.accounts(s.accounts);return void 0!==s.remainingAccounts&&c.push(...s.remainingAccounts),Xi("debug-logs")&&console.log("Outgoing account metas:",c),new i.TransactionInstruction({keys:c,programId:n,data:t(e.name,jn(e,...a))})};return r.accounts=t=>da.accountsArray(t,e.accounts,n,e.name),r}static accountsArray(e,t,n,r){return e?t.map((t=>{if(Mn(t)){const i=e[t.name];return da.accountsArray(i,t.accounts,n,r).flat()}let i;try{i=Fn(e[t.name])}catch(e){throw new Error(`Wrong input type for account "${t.name}" in the instruction accounts object${void 0!==r?' for instruction "'+r+'"':""}. Expected PublicKey or string.`)}const o=t.optional&&i.equals(n);return{pubkey:i,isWritable:Boolean(t.writable&&!o),isSigner:Boolean(t.signer&&!o)}})).flat():[]}}class fa{static build(e,t){return(...n)=>{var r,o,a;const[,s]=la(e,[...n]),c=new i.Transaction;if(s.preInstructions&&s.instructions)throw new Error("instructions is deprecated, use preInstructions");return null===(r=s.preInstructions)||void 0===r||r.forEach((e=>c.add(e))),null===(o=s.instructions)||void 0===o||o.forEach((e=>c.add(e))),c.add(t(...n)),null===(a=s.postInstructions)||void 0===a||a.forEach((e=>c.add(e))),c}}}class ha{static build(e,t,n,r){return async(...i)=>{var o;const a=t(...i),[,s]=la(e,[...i]);if(void 0===r.sendAndConfirm)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await r.sendAndConfirm(a,null!==(o=s.signers)&&void 0!==o?o:[],s.options)}catch(e){throw io(e,n)}}}}class pa{static build(e,t,n,r){var i;return(null!==(i=e.accounts)&&void 0!==i?i:[]).reduce(((i,o)=>(i[o.name]=new ya(e,o,n,r,t),i)),{})}}class ya{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}constructor(e,t,n,r,i){this._idlAccount=t,this._programId=n,this._provider=null!=r?r:Er(),this._coder=null!=i?i:new yo(e),this._size=this._coder.accounts.size(t.name)}async fetchNullable(e,t){const{data:n}=await this.fetchNullableAndContext(e,t);return n}async fetchNullableAndContext(e,t){const n=await this.getAccountInfoAndContext(e,t),{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(e,t){const{data:n}=await this.fetchNullableAndContext(e,t);if(null===n)throw new Error(`Account does not exist or has no data ${e.toString()}`);return n}async fetchAndContext(e,t){const{data:n,context:r}=await this.fetchNullableAndContext(e,t);if(null===n)throw new Error(`Account does not exist ${e.toString()}`);return{data:n,context:r}}async fetchMultiple(e,t){return(await this.fetchMultipleAndContext(e,t)).map((e=>e?e.data:null))}async fetchMultipleAndContext(e,t){return(await cr(this._provider.connection,e.map((e=>Fn(e))),t)).map((e=>{if(null==e)return null;const{account:t,context:n}=e;return{data:this._coder.accounts.decode(this._idlAccount.name,t.data),context:n}}))}async all(e){const t=this.coder.accounts.memcmp(this._idlAccount.name,e instanceof An?e:void 0),n=[];return null!=(null==t?void 0:t.offset)&&null!=(null==t?void 0:t.bytes)&&n.push({memcmp:{offset:t.offset,bytes:t.bytes}}),null!=(null==t?void 0:t.dataSize)&&n.push({dataSize:t.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(e)?e:[]]})).map((({pubkey:e,account:t})=>({publicKey:e,account:this._coder.accounts.decode(this._idlAccount.name,t.data)})))}subscribe(e,t){const n=ma.get(e.toString());if(n)return n.ee;const r=new(Sn());e=Fn(e);const i=this._provider.connection.onAccountChange(e,(e=>{const t=this._coder.accounts.decode(this._idlAccount.name,e.data);r.emit("change",t)}),t);return ma.set(e.toString(),{ee:r,listener:i}),r}async unsubscribe(e){let t=ma.get(e.toString());t?ma&&await this._provider.connection.removeAccountChangeListener(t.listener).then((()=>{ma.delete(e.toString())})).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(e,t){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:e.publicKey,space:null!=t?t:n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(null!=t?t:n),programId:this._programId})}async getAccountInfo(e,t){return await this._provider.connection.getAccountInfo(Fn(e),t)}async getAccountInfoAndContext(e,t){return await this._provider.connection.getAccountInfoAndContext(Fn(e),t)}}const ma=new Map,ga="Program log: ";class ba{constructor(e,t,n){this._programId=e,this._provider=t,this._eventParser=new va(e,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(e,t){var n;let r=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.set(e,(null!==(n=this._eventListeners.get(e))&&void 0!==n?n:[]).concat(r)),this._eventCallbacks.set(r,[e,t]),void 0!==this._onLogsSubscriptionId||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,((e,t)=>{if(!e.err)for(const n of this._eventParser.parseLogs(e.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,t.slot,e.signature)}}))}}))),r}async removeEventListener(e){const t=this._eventCallbacks.get(e);if(!t)throw new Error(`Event listener ${e} doesn't exist!`);const[n]=t;let r=this._eventListeners.get(n);if(!r)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(e),r=r.filter((t=>t!==e)),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 va{constructor(e,t){this.coder=t,this.programId=e}*parseLogs(e,t=!1){const n=new _a(e),r=new wa;let i=n.next();for(;null!==i;){let[e,o,a]=this.handleLog(r,i,t);e&&(yield e),o&&r.push(o),a&&r.pop(),i=n.next()}}handleLog(e,t,n){return e.stack.length>0&&e.program()===this.programId.toString()?this.handleProgramLog(t,n):[null,...this.handleSystemLog(t)]}handleProgramLog(e,t){if(e.startsWith(ga)||e.startsWith("Program data: ")){const n=e.startsWith(ga)?e.slice(13):e.slice(14),r=this.coder.events.decode(n);if(t&&null===r)throw new Error(`Unable to decode event ${n}`);return[r,null,!1]}return[null,...this.handleSystemLog(e)]}handleSystemLog(e){const t=e.split(":")[0];return null!==t.match(/^Program (.*) success/g)?[null,!0]:t.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:t.includes("invoke")?["cpi",!1]:[null,!1]}}class wa{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(e){this.stack.push(e)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class _a{constructor(e){this.logs=e}next(){if(0===this.logs.length)return null;let e=this.logs[0];return this.logs=this.logs.slice(1),e}}class Ea{static build(e,t,n,r,i,o,a){return async(...s)=>{var c;const u=t(...s),[,l]=la(e,[...s]);let d;if(void 0===r.simulate)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{d=await r.simulate(u,l.signers,null===(c=l.options)||void 0===c?void 0:c.commitment)}catch(e){throw io(e,n)}if(void 0===d)throw new Error("Unable to simulate transaction");const f=d.logs;if(!f)throw new Error("Simulated logs not found");const h=[];if(a.events){let e=new va(o,i);for(const t of e.parseLogs(f))h.push(t)}return{events:h,raw:f}}}}function Sa(e){return new xa(Do(8),(e=>Ia.fromBuffer(e)),(e=>e.toBuffer()),e)}function Aa(e){return new xa(Do(32),(e=>new i.PublicKey(e)),(e=>e.toBuffer()),e)}function ka(e,t){return new Oa(e,t)}class xa extends go{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}class Oa extends go{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=No()}encode(e,t,n=0){return null==e?this.layout.span+this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+4)+4)}decode(e,t=0){const n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(e,t=0){return this.layout.getSpan(e,t+4)+4}}class Ia extends(a()){toBuffer(){const e=super.toArray().reverse(),t=An.from(e);if(8===t.length)return t;if(t.length>=8)throw new Error("u64 too large");const n=An.alloc(8);return t.copy(n),n}static fromBuffer(e){if(8!==e.length)throw new Error(`Invalid buffer length: ${e.length}`);return new Ia([...e].reverse().map((e=>`00${e.toString(16)}`.slice(-2))).join(""),16)}}const Ra=Mo([Aa("mint"),Aa("owner"),Sa("amount"),ka(Aa(),"delegate"),(e=>{const t=Lo(new wo(1,"discriminator"),null,"state");return t.addVariant(0,Mo([]),"uninitialized"),t.addVariant(1,Mo([]),"initialized"),t.addVariant(2,Mo([]),"frozen"),t})(),ka(Sa(),"isNative"),Sa("delegatedAmount"),ka(Aa(),"closeAuthority")]);class Ta{constructor(e,t,n,r,i,o,a,s){this._args=e,this._accounts=t,this._provider=n,this._programId=r,this._idlIx=i,this._idlTypes=a,this._customResolver=s,this._accountStore=new Pa(n,o,r)}args(e){this._args=e}async resolve(){this.resolveEventCpi(this._idlIx.accounts),this.resolveConst(this._idlIx.accounts);let e=0;for(;await this.resolvePdasAndRelations(this._idlIx.accounts)+await this.resolveCustom()>0;)if(e++,16===e)throw new Error("Reached maximum depth for account resolution")}resolveOptionals(e){Object.assign(this._accounts,this.resolveOptionalsHelper(e,this._idlIx.accounts))}get(e){const t=e.reduce(((e,t)=>e&&e[t]),this._accounts);if(t&&t.toBase58)return t}set(e,t){let n=this._accounts;e.forEach(((r,i)=>{var o;i===e.length-1&&(n[r]=t),n[r]=null!==(o=n[r])&&void 0!==o?o:{},n=n[r]}))}resolveOptionalsHelper(e,t){const n={};for(const r of t){const t=r.name,i=e[t];void 0!==i&&(Na(i)?Mn(r)?n[t]=this.resolveOptionalsHelper(i,r.accounts):n[t]=Ba(i,!0):null!==i?n[t]=Fn(i):r.optional&&(n[t]=this._programId))}return n}async resolveCustom(){if(this._customResolver){const{accounts:e,resolved:t}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=e,t}return 0}resolveEventCpi(e,t=[]){for(const n in e){const r=e[n];Mn(r)&&this.resolveEventCpi(r.accounts,[...t,r.name]);const o=+n+1;if(o===e.length)return;const a=e[n].name,s=e[o].name;if("eventAuthority"===a&&"program"===s){const e=[...t,a],n=[...t,s];return this.get(e)||this.set(e,i.PublicKey.findProgramAddressSync([An.from("__event_authority")],this._programId)[0]),void(this.get(n)||this.set(n,this._programId))}}}resolveConst(e,t=[]){for(const n of e){const e=n.name;if(Mn(n))this.resolveConst(n.accounts,[...t,e]);else{const r=n;if((r.signer||r.address)&&!this.get([...t,e])){if(r.signer){if(!this._provider.wallet)throw new Error("This function requires the `Provider` interface implementor to have a `wallet` field.");this.set([...t,e],this._provider.wallet.publicKey)}r.address&&this.set([...t,e],Fn(r.address))}}}}async resolvePdasAndRelations(e,t=[]){let n=0;for(const r of e){const e=r.name;if(Mn(r))n+=await this.resolvePdasAndRelations(r.accounts,[...t,e]);else{const o=r;if((o.pda||o.relations)&&!this.get([...t,e])){n++;try{if(o.pda){const n=await Promise.all(o.pda.seeds.map((e=>this.toBuffer(e,t))));if(n.some((e=>!e)))continue;const r=await this.parseProgramId(o,t),[a]=i.PublicKey.findProgramAddressSync(n,r);this.set([...t,e],a)}}catch{}try{if(o.relations){const n=this.get([...t,o.relations[0]]);if(n){const r=await this._accountStore.fetchAccount({publicKey:n});this.set([...t,e],r[e])}}}catch{}}}}return n}async parseProgramId(e,t=[]){var n;if(!(null===(n=e.pda)||void 0===n?void 0:n.program))return this._programId;const r=await this.toBuffer(e.pda.program,t);if(!r)throw new Error(`Program seed not resolved: ${e.name}`);return new i.PublicKey(r)}async toBuffer(e,t=[]){switch(e.kind){case"const":return this.toBufferConst(e);case"arg":return await this.toBufferArg(e);case"account":return await this.toBufferAccount(e,t);default:throw new Error(`Unexpected seed: ${e}`)}}toBufferConst(e){return this.toBufferValue("bytes",e.value)}async toBufferArg(e){const[t,...n]=e.path.split("."),r=this._idlIx.args.findIndex((e=>e.name===t));if(-1===r)throw new Error(`Unable to find argument for seed: ${t}`);const i=n.reduce(((e,t)=>(null!=e?e:{})[t]),this._args[r]);if(void 0===i)return;const o=this.getType(this._idlIx.args[r].type,n);return this.toBufferValue(o,i)}async toBufferAccount(e,t=[]){const[n,...r]=e.path.split("."),i=this.get([...t,n]);if(!i)return;if(!r.length)return this.toBufferValue("pubkey",i);if(!e.account)throw new Error(`Seed account is required in order to resolve type: ${e.path}`);let o=await this._accountStore.fetchAccount({publicKey:i,name:e.account}),a=r;for(;a.length>0;)o=o[a[0]],a=a.slice(1);if(void 0===o)return;const s=this.getType({defined:{name:e.account}},r);return this.toBufferValue(s,o)}toBufferValue(e,t){switch(e){case"u8":case"i8":return An.from([t]);case"u16":case"i16":return new(a())(t).toArrayLike(An,"le",2);case"u32":case"i32":return new(a())(t).toArrayLike(An,"le",4);case"u64":case"i64":return new(a())(t).toArrayLike(An,"le",8);case"u128":case"i128":return new(a())(t).toArrayLike(An,"le",16);case"u256":case"i256":return new(a())(t).toArrayLike(An,"le",32);case"string":case"bytes":return An.from(t);case"pubkey":return t.toBuffer();default:if(null==e?void 0:e.array)return An.from(t);throw new Error(`Unexpected seed type: ${e}`)}}getType(e,t=[]){var n;const r=null===(n=null==e?void 0:e.defined)||void 0===n?void 0:n.name;if(r){if("tokenAccount"===r)switch(t.at(0)){case"mint":case"owner":return"pubkey";case"amount":case"delagatedAmount":return"u64";default:throw new Error(`Unknown token account path: ${t}`)}const e=this._idlTypes.find((e=>e.name===r));if(!e)throw new Error(`Type not found: ${r}`);const[n,...i]=t,o=e.type.fields.find((e=>e.name===n));if(!o)throw new Error(`Field not found: ${n}`);return this.getType(o.type,i)}return e}}class Pa{constructor(e,t,n){this._provider=e,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=t}async fetchAccount({publicKey:e,name:t}){const n=e.toBase58();if(!this._cache.has(n)){const i=await this._provider.connection.getAccountInfo(e);if(null===i)throw new Error(`Account not found: ${n}`);if("tokenAccount"===t){const e=(r=i.data,Ra.decode(r));this._cache.set(n,e)}else{const e=await this.getAccountsNs(i.owner);if(e){const t=Object.values(e)[0];if(t){const e=t.coder.accounts.decodeAny(i.data);this._cache.set(n,e)}}}}var r;return this._cache.get(n)}async getAccountsNs(e){const t=e.toBase58();if(!this._idls[t]){const n=await za.fetchIdl(e,this._provider);if(n){const e=new za(n,this._provider);this._idls[t]=e.account}}return this._idls[t]}}class Ca{static build(e,t,n,r,i,o,a,s,c,u,l){return(...d)=>new Ma(d,r,i,o,a,s,e,t,n,c,u,l)}}function Na(e){return"object"==typeof e&&null!==e&&!("_bn"in e)}function Ba(e,t){const n={};for(const r in e){const i=e[r];if(null!==i)n[r]=Na(i)?Ba(i,!0):Fn(i);else if(t)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!")}return n}class Ma{constructor(e,t,n,r,i,o,a,s,c,u,l,d){this._args=e,this._ixFn=t,this._txFn=n,this._rpcFn=r,this._simulateFn=i,this._viewFn=o,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._resolveAccounts=!0,this._accountsResolver=new Ta(e,this._accounts,a,s,c,u,l,d)}args(e){this._args=e,this._accountsResolver.args(e)}accounts(e){return this.accountsPartial(e)}accountsPartial(e){return this._resolveAccounts=!0,this._accountsResolver.resolveOptionals(e),this}accountsStrict(e){return this._resolveAccounts=!1,this._accountsResolver.resolveOptionals(e),this}signers(e){return this._signers=this._signers.concat(e),this}remainingAccounts(e){return this._remainingAccounts=this._remainingAccounts.concat(e),this}preInstructions(e,t=!1){return this._preInstructions=t?e.concat(this._preInstructions):this._preInstructions.concat(e),this}postInstructions(e){return this._postInstructions=this._postInstructions.concat(e),this}async pubkeys(){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._accounts}async rpc(e){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async rpcAndKeys(e){return{pubkeys:await this.pubkeys(),signature:await this.rpc(e)}}async view(e){if(this._resolveAccounts&&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:e})}async simulate(e){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async instruction(){return this._resolveAccounts&&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:this._signers}}async transaction(){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class La{static build(e,t,n,r){const i=t.accounts.find((e=>e.writable)),o=!!t.returns;if(!i&&o)return async(...i)=>{let o=await n(...i);const a=`Program return: ${e} `;let s=o.raw.find((e=>e.startsWith(a)));if(!s)throw new Error("View expected return log");let c=Cn(s.slice(a.length)),u=t.returns;if(!u)throw new Error("View expected return type");return so.fieldLayout({type:u},r.types).decode(c)}}}class Da{static build(e,t,n,r,i){const o={},a={},s={},c={},u={},l={},d=zn(e),f=e.accounts?pa.build(e,t,n,r):{};return e.instructions.forEach((h=>{const p=da.build(h,((e,n)=>t.instruction.encode(e,n)),n),y=fa.build(h,p),m=ha.build(h,y,d,r),g=Ea.build(h,y,d,r,t,n,e),b=La.build(n,h,g,e),v=Ca.build(r,n,h,p,y,m,g,b,f,e.types||[],null==i?void 0:i(h)),w=h.name;a[w]=p,s[w]=y,o[w]=m,c[w]=g,u[w]=v,b&&(l[w]=b)})),[o,a,s,f,c,u,l]}}class za{get programId(){return this._programId}get idl(){return this._idl}get rawIdl(){return this._rawIdl}get coder(){return this._coder}get provider(){return this._provider}constructor(e,t=Er(),n,r){const i=function(e){const t=["name","path","account","relations","generic"],n=e=>e.split(".").map(l()).join("."),r=e=>{for(const i in e){const o=e[i];t.includes(i)?e[i]=Array.isArray(o)?o.map(n):n(o):"object"==typeof o&&r(o)}},i=structuredClone(e);return r(i),i}(e);this._idl=i,this._rawIdl=e,this._provider=t,this._programId=Fn(e.address),this._coder=null!=n?n:new yo(i),this._events=new ba(this._programId,t,this._coder);const[o,a,s,c,u,d,f]=Da.build(i,this._coder,this._programId,t,r);this.rpc=o,this.instruction=a,this.transaction=s,this.account=c,this.simulate=u,this.methods=d,this.views=f}static async at(e,t){const n=Fn(e),r=await za.fetchIdl(n,t);if(!r)throw new Error(`IDL not found for program: ${e.toString()}`);return new za(r,t)}static async fetchIdl(e,t){t=null!=t?t:Er();const n=Fn(e),r=await async function(e){const t=(await i.PublicKey.findProgramAddress([],e))[0];return await i.PublicKey.createWithSeed(t,"anchor:idl",e)}(n),o=await t.connection.getAccountInfo(r);if(!o)return null;let a=(s=o.data.slice(8),Ln.decode(s));var s;const c=_n(a.data);return JSON.parse(On(c))}addEventListener(e,t){return this._events.addEventListener(e,t)}async removeEventListener(e){return await this._events.removeEventListener(e)}}new i.PublicKey("11111111111111111111111111111111");const ja={address:"11111111111111111111111111111111",metadata:{name:"systemProgram",version:"0.1.0",spec:"0.1.0"},instructions:[{name:"advanceNonceAccount",discriminator:[4,0,0,0],accounts:[{name:"nonce",writable:!0},{name:"recentBlockhashes"},{name:"authorized",signer:!0}],args:[{name:"authorized",type:"pubkey"}]},{name:"allocate",discriminator:[8,0,0,0],accounts:[{name:"pubkey",writable:!0,signer:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",discriminator:[9,0,0,0],accounts:[{name:"account",writable:!0},{name:"base",signer:!0}],args:[{name:"base",type:"pubkey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"pubkey"}]},{name:"assign",discriminator:[1,0,0,0],accounts:[{name:"pubkey",writable:!0,signer:!0}],args:[{name:"owner",type:"pubkey"}]},{name:"assignWithSeed",discriminator:[10,0,0,0],accounts:[{name:"account",writable:!0},{name:"base",signer:!0}],args:[{name:"base",type:"pubkey"},{name:"seed",type:"string"},{name:"owner",type:"pubkey"}]},{name:"authorizeNonceAccount",discriminator:[7,0,0,0],accounts:[{name:"nonce",writable:!0},{name:"authorized",signer:!0}],args:[{name:"authorized",type:"pubkey"}]},{name:"createAccount",discriminator:[0,0,0,0],accounts:[{name:"from",writable:!0,signer:!0},{name:"to",writable:!0,signer:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"pubkey"}]},{name:"createAccountWithSeed",discriminator:[3,0,0,0],accounts:[{name:"from",writable:!0,signer:!0},{name:"to",writable:!0},{name:"base",signer:!0}],args:[{name:"base",type:"pubkey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"pubkey"}]},{name:"initializeNonceAccount",discriminator:[6,0,0,0],accounts:[{name:"nonce",writable:!0,signer:!0},{name:"recentBlockhashes"},{name:"rent",address:"SysvarRent111111111111111111111111111111111"}],args:[{name:"authorized",type:"pubkey"}]},{name:"transfer",discriminator:[2,0,0,0],accounts:[{name:"from",writable:!0,signer:!0},{name:"to",writable:!0}],args:[{name:"lamports",type:"u64"}]},{name:"transferWithSeed",discriminator:[11,0,0,0],accounts:[{name:"from",writable:!0},{name:"base",signer:!0},{name:"to",writable:!0}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"pubkey"}]},{name:"withdrawNonceAccount",discriminator:[5,0,0,0],accounts:[{name:"nonce",writable:!0},{name:"to",writable:!0},{name:"recentBlockhashes"},{name:"rent",address:"SysvarRent111111111111111111111111111111111"},{name:"authorized",signer:!0}],args:[{name:"lamports",type:"u64"}]}],accounts:[{name:"nonce",discriminator:[]}],types:[{name:"feeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}},{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"pubkey"},{name:"nonce",type:"pubkey"},{name:"feeCalculator",type:{defined:{name:"feeCalculator"}}}]}}]};class Ua{static system(e){return function(e){return new za(ja,e,new Jo(ja))}(e)}}},5970:function(e,t,n){"use strict";var r=n(8764).Buffer,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i256=t.u256=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;const o=n(698),a=n(7581),s=i(n(3550));var c=n(698);Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return c.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return c.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return c.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return c.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return c.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return c.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return c.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return c.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return c.struct}});class u extends o.Layout{constructor(e,t,n){super(e,n),this.blob=(0,o.blob)(e),this.signed=t}decode(e,t=0){const n=new s.default(this.blob.decode(e,t),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(e,t,n=0){return this.signed&&(e=e.toTwos(8*this.span)),this.blob.encode(e.toArrayLike(r,"le",this.span),t,n)}}function l(e){return new u(8,!1,e)}t.u64=l,t.i64=function(e){return new u(8,!0,e)},t.u128=function(e){return new u(16,!1,e)},t.i128=function(e){return new u(16,!0,e)},t.u256=function(e){return new u(32,!1,e)},t.i256=function(e){return new u(32,!0,e)};class d extends o.Layout{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}t.publicKey=function(e){return new d((0,o.blob)(32),(e=>new a.PublicKey(e)),(e=>e.toBuffer()),e)};class f extends o.Layout{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=(0,o.u8)()}encode(e,t,n=0){return null==e?this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+1)+1)}decode(e,t=0){const n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+1);throw new Error("Invalid option "+this.property)}getSpan(e,t=0){const n=this.discriminator.decode(e,t);if(0===n)return 1;if(1===n)return this.layout.getSpan(e,t+1)+1;throw new Error("Invalid option "+this.property)}}function h(e){if(0===e)return!1;if(1===e)return!0;throw new Error("Invalid bool: "+e)}function p(e){return e?1:0}function y(e){const t=(0,o.u32)("length"),n=(0,o.struct)([t,(0,o.blob)((0,o.offset)(t,-t.span),"data")]);return new d(n,(({data:e})=>e),(e=>({data:e})),e)}t.option=function(e,t){return new f(e,t)},t.bool=function(e){return new d((0,o.u8)(),h,p,e)},t.vec=function(e,t){const n=(0,o.u32)("length"),r=(0,o.struct)([n,(0,o.seq)(e,(0,o.offset)(n,-n.span),"values")]);return new d(r,(({values:e})=>e),(e=>({values:e})),t)},t.tagged=function(e,t,n){const r=(0,o.struct)([l("tag"),t.replicate("data")]);return new d(r,(function({tag:t,data:n}){if(!t.eq(e))throw new Error("Invalid tag, expected: "+e.toString("hex")+", got: "+t.toString("hex"));return n}),(t=>({tag:e,data:t})),n)},t.vecU8=y,t.str=function(e){return new d(y(),(e=>e.toString("utf-8")),(e=>r.from(e,"utf-8")),e)},t.rustEnum=function(e,t,n){const r=(0,o.union)(null!=n?n:(0,o.u8)(),t);return e.forEach(((e,t)=>r.addVariant(t,e,e.property))),r},t.array=function(e,t,n){const r=(0,o.struct)([(0,o.seq)(e,t,"values")]);return new d(r,(({values:e})=>e),(e=>({values:e})),n)};class m extends o.Layout{constructor(e,t,n){super(e.span+t.span,n),this.keyLayout=e,this.valueLayout=t}decode(e,t){return t=t||0,[this.keyLayout.decode(e,t),this.valueLayout.decode(e,t+this.keyLayout.getSpan(e,t))]}encode(e,t,n){n=n||0;const r=this.keyLayout.encode(e[0],t,n);return r+this.valueLayout.encode(e[1],t,n+r)}getSpan(e,t){return this.keyLayout.getSpan(e,t)+this.valueLayout.getSpan(e,t)}}t.map=function(e,t,n){const r=(0,o.u32)("length"),i=(0,o.struct)([r,(0,o.seq)(new m(e,t),(0,o.offset)(r,-r.span),"values")]);return new d(i,(({values:e})=>new Map(e)),(e=>({values:Array.from(e.entries())})),n)}},4926:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createAllowUndelegationInstruction=t.allowUndelegateInstructionDiscriminator=t.allowUndelegationStruct=void 0;var a=o(n(5783)),s=o(n(7581)),c=n(5789);t.allowUndelegationStruct=new a.BeetArgsStruct([["instructionDiscriminator",a.uniformFixedSizeArray(a.u8,8)]],"allowUndelegationInstructionArgs"),t.allowUndelegateInstructionDiscriminator=[255,66,82,208,247,5,210,126],t.createAllowUndelegationInstruction=function(e){var n=t.allowUndelegationStruct.serialize({instructionDiscriminator:t.allowUndelegateInstructionDiscriminator})[0],r=(0,c.DelegateAccounts)(e.delegatedAccount,e.ownerProgram),i=r.delegationPda,o=r.delegationMetadata,a=r.bufferPda,u=[{pubkey:e.delegatedAccount,isWritable:!1,isSigner:!1},{pubkey:i,isWritable:!1,isSigner:!1},{pubkey:o,isWritable:!0,isSigner:!1},{pubkey:a,isWritable:!1,isSigner:!1},{pubkey:new s.PublicKey(c.DELEGATION_PROGRAM_ID),isWritable:!0,isSigner:!1}],l=e.ownerProgram;return new s.TransactionInstruction({programId:l,keys:u,data:n})}},85:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createDelegateInstruction=t.delegateInstructionDiscriminator=t.delegateStruct=void 0;var a=o(n(5783)),s=o(n(7581)),c=n(5789);t.delegateStruct=new a.FixableBeetArgsStruct([["instructionDiscriminator",a.uniformFixedSizeArray(a.u8,8)],["validUntil",a.i64],["commitFrequencyMs",a.u32]],"DelegateInstructionArgs"),t.delegateInstructionDiscriminator=[90,147,75,178,85,88,4,137],t.createDelegateInstruction=function(e,n,r,i){var o,a,u,l,d;void 0===n&&(n=0),void 0===r&&(r=3e4),void 0===i&&(i=e.ownerProgram);var f=t.delegateStruct.serialize({instructionDiscriminator:t.delegateInstructionDiscriminator,validUntil:n,commitFrequencyMs:r})[0],h=(0,c.DelegateAccounts)(e.account,e.ownerProgram),p=h.delegationPda,y=h.delegationMetadata,m=h.bufferPda,g=[{pubkey:e.payer,isWritable:!1,isSigner:!0},{pubkey:e.entity,isWritable:!1,isSigner:!1},{pubkey:e.account,isWritable:!0,isSigner:!1},{pubkey:e.ownerProgram,isWritable:!1,isSigner:!1},{pubkey:null!==(o=e.buffer)&&void 0!==o?o:m,isWritable:!0,isSigner:!1},{pubkey:null!==(a=e.delegationRecord)&&void 0!==a?a:p,isWritable:!0,isSigner:!1},{pubkey:null!==(u=e.delegationMetadata)&&void 0!==u?u:y,isWritable:!0,isSigner:!1},{pubkey:null!==(l=e.delegationProgram)&&void 0!==l?l:new s.PublicKey(c.DELEGATION_PROGRAM_ID),isWritable:!1,isSigner:!1},{pubkey:null!==(d=e.systemProgram)&&void 0!==d?d:s.SystemProgram.programId,isWritable:!1,isSigner:!1}];return new s.TransactionInstruction({programId:i,keys:g,data:f})}},5049:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]5)throw new Error("Not implemented for component counts outside 1-".concat(5));var c,l={authority:null!=t?t:u.PROGRAM_ID,boltSystem:n,instructionSysvarAccount:a.SYSVAR_INSTRUCTIONS_PUBKEY,anchorRemainingAccounts:i},d=0;return r.forEach((function(e){e.components.forEach((function(t){var n,r,i=(0,a.FindComponentPda)({componentId:t.componentId,entity:e.entity,seed:t.seed});l[(n=d,r=s,1===r?"componentProgram":"componentProgram".concat(n+1))]=t.componentId,l[function(e,t){return 1===t?"boltComponent":"boltComponent".concat(e+1)}(d,s)]=i,d++}))})),{createApplyInstruction:a.createApplyInstruction,createApply2Instruction:a.createApply2Instruction,createApply3Instruction:a.createApply3Instruction,createApply4Instruction:a.createApply4Instruction,createApply5Instruction:a.createApply5Instruction}[1===(c=s)?"createApplyInstruction":"createApply".concat(c,"Instruction")](l,{args:(0,a.SerializeArgs)(o)})}({authority:t,systemId:n,entities:o,extraAccounts:s,args:l}),[2,{transaction:(new c.Transaction).add(e)}]}))}))}},9872:(e,t,n)=>{"use strict";var r=n(8764).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.UndelegateAccounts=t.DelegateAccounts=void 0;var i=n(7581),o=n(5485),a=n(4739);function s(e,t,n){void 0===n&&(n=!0);var s=e.toBytes();return{delegationPda:i.PublicKey.findProgramAddressSync([r.from(o.SEED_DELEGATION),s],new i.PublicKey(a.DELEGATION_PROGRAM_ID))[0],delegationMetadata:i.PublicKey.findProgramAddressSync([r.from(o.SEED_DELEGATION_METADATA),s],new i.PublicKey(a.DELEGATION_PROGRAM_ID))[0],bufferPda:i.PublicKey.findProgramAddressSync([r.from(o.SEED_BUFFER_PDA),s],n?new i.PublicKey(t):new i.PublicKey(a.DELEGATION_PROGRAM_ID))[0],commitStateRecordPda:i.PublicKey.findProgramAddressSync([r.from(o.SEED_COMMIT_STATE_RECORD_PDA),s],new i.PublicKey(a.DELEGATION_PROGRAM_ID))[0],commitStatePda:i.PublicKey.findProgramAddressSync([r.from(o.SEED_STATE_DIFF_PDA),s],new i.PublicKey(a.DELEGATION_PROGRAM_ID))[0]}}t.DelegateAccounts=function(e,t){return s(e,t,!0)},t.UndelegateAccounts=function(e,t){return s(e,t,!1)}},4739:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAGIC_PROGRAM_ID=t.DELEGATION_PROGRAM_ID=void 0,t.DELEGATION_PROGRAM_ID="DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh",t.MAGIC_PROGRAM_ID="Magic11111111111111111111111111111111111111"},5789:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(5485),t),i(n(4739),t),i(n(5648),t),i(n(6175),t),i(n(9872),t)},6175:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createCommitInstruction=t.commitInstructionDiscriminator=t.commitStruct=void 0;var a=o(n(5783)),s=o(n(7581)),c=n(7581),u=n(4739);t.commitStruct=new a.FixableBeetArgsStruct([["instructionDiscriminator",a.uniformFixedSizeArray(a.u8,4)]],"CommitInstructionArgs"),t.commitInstructionDiscriminator=[1,0,0,0],t.createCommitInstruction=function(e,n){void 0===n&&(n=new c.PublicKey(u.MAGIC_PROGRAM_ID));var r=t.commitStruct.serialize({instructionDiscriminator:t.commitInstructionDiscriminator})[0],i=[{pubkey:e.payer,isWritable:!1,isSigner:!0},{pubkey:e.delegatedAccount,isWritable:!0,isSigner:!1}];return new s.TransactionInstruction({programId:n,keys:i,data:r})}},5648:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createUndelegateInstruction=t.undelegateInstructionDiscriminator=t.undelegateStruct=void 0;var a=o(n(5783)),s=o(n(7581)),c=n(9872),u=n(7581),l=n(4739);t.undelegateStruct=new a.FixableBeetArgsStruct([["instructionDiscriminator",a.uniformFixedSizeArray(a.u8,8)]],"UndelegateInstructionArgs"),t.undelegateInstructionDiscriminator=[3,0,0,0,0,0,0,0],t.createUndelegateInstruction=function(e,n){var r,i,o,a,d,f;void 0===n&&(n=new u.PublicKey(l.DELEGATION_PROGRAM_ID));var h=t.undelegateStruct.serialize({instructionDiscriminator:t.undelegateInstructionDiscriminator})[0],p=(0,c.UndelegateAccounts)(e.delegatedAccount,e.ownerProgram),y=p.delegationPda,m=p.delegationMetadata,g=p.bufferPda,b=p.commitStateRecordPda,v=p.commitStatePda,w=[{pubkey:e.payer,isWritable:!1,isSigner:!0},{pubkey:e.delegatedAccount,isWritable:!0,isSigner:!1},{pubkey:e.ownerProgram,isWritable:!1,isSigner:!1},{pubkey:null!==(r=e.buffer)&&void 0!==r?r:g,isWritable:!0,isSigner:!1},{pubkey:null!==(i=e.commitStatePda)&&void 0!==i?i:v,isWritable:!0,isSigner:!1},{pubkey:null!==(o=e.commitStateRecordPda)&&void 0!==o?o:b,isWritable:!0,isSigner:!1},{pubkey:null!==(a=e.delegationRecord)&&void 0!==a?a:y,isWritable:!0,isSigner:!1},{pubkey:null!==(d=e.delegationMetadata)&&void 0!==d?d:m,isWritable:!0,isSigner:!1},{pubkey:e.reimbursement,isWritable:!1,isSigner:!1},{pubkey:null!==(f=e.systemProgram)&&void 0!==f?f:s.SystemProgram.programId,isWritable:!1,isSigner:!1}];return new s.TransactionInstruction({programId:n,keys:w,data:h})}},5485:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SEED_STATE_DIFF_PDA=t.SEED_COMMIT_STATE_RECORD_PDA=t.SEED_DELEGATION_METADATA=t.SEED_DELEGATION=t.SEED_BUFFER_PDA=t.SEED_TEST_PDA=void 0,t.SEED_TEST_PDA="test-pda",t.SEED_BUFFER_PDA="buffer",t.SEED_DELEGATION="delegation",t.SEED_DELEGATION_METADATA="delegation-metadata",t.SEED_COMMIT_STATE_RECORD_PDA="commit-state-record",t.SEED_STATE_DIFF_PDA="state-diff"},2863:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.supportedTypeMap=void 0;const o=n(2943);i(n(2943),t),i(n(1366),t),t.supportedTypeMap=o.keysTypeMap},1366:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GpaBuilder=void 0;const r=n(5783),i=n(9282),o=n(1829),a=n(3313);class s{constructor(e,t,n){this.programId=e,this.beets=t,this.accountSize=n,this.config={}}_addFilter(e){return null==this.config.filters&&(this.config.filters=[]),this.config.filters.push(e),this}_addInnerFilter(e,t,n){(0,o.logTrace)(`gpa.addInnerFilter: ${e}.${t}`);const s=this.beets.get(e);(0,i.strict)(null!=s,"Outer filter key needs to be an existing field name");const c=s.beet;let u=s.offset;const l=(0,r.isFixedSizeBeet)(c)?c:c.toFixedFromValue(n);let d;for(const[e,n]of l.fields){if(e===t){d=n;break}u+=n.byteSize}(0,i.strict)(null!=d,`${t} is not a field of the ${e} struct`);const f=(0,a.encodeFixedBeet)(d,n);return this._addFilter({memcmp:{offset:u,bytes:f}}),this}addInnerFilter(e,t){const n=e.split(".");i.strict.equal(n.length,2,"inner filters can go only one level deep, i.e. 'outer.inner' is ok, but 'outer.inner.deep' is not");const[r,o]=n;return this._addInnerFilter(r,o,t)}addFilter(e,t){const n=this.beets.get(e);(0,i.strict)(null!=n,"Filter key needs to be an existing field name");const o=(0,r.isFixedSizeBeet)(n.beet)?n.beet:n.beet.toFixedFromValue(t),s=(0,a.encodeFixedBeet)(o,t);return this._addFilter({memcmp:{offset:n.offset,bytes:s}}),this}dataSize(e){return e=null!=e?e:this.accountSize,(0,i.strict)(null!=e,"for accounts of dynamic size the dataSize arg needs to be provided"),this._addFilter({dataSize:e})}run(e){return e.getProgramAccounts(this.programId,this.config)}static fromBeetFields(e,t){const n=new Map;let i=0,o=!1;for(const[e,a]of t){if(n.set(e,{beet:a,offset:i}),!(0,r.isFixedSizeBeet)(a)){o=!0;break}i+=a.byteSize}return new s(e,n,o?void 0:i)}static fromStruct(e,t){return s.fromBeetFields(e,t.fields)}}t.GpaBuilder=s},3313:function(e,t,n){"use strict";var r=n(8764).Buffer,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.encodeFixedBeet=void 0;const o=i(n(5992));t.encodeFixedBeet=function(e,t){const n=r.alloc(e.byteSize);return e.write(n,0,t),o.default.encode(n)}},2943:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.keysTypeMap=t.publicKey=void 0;const r=n(7581),i=(0,n(5783).fixedSizeUint8Array)(32);t.publicKey={write:function(e,t,n){const r=n.toBytes();i.write(e,t,r)},read:function(e,t){const n=i.read(e,t);return new r.PublicKey(n)},byteSize:i.byteSize,description:"PublicKey"},t.keysTypeMap={publicKey:{beet:"publicKey",isFixable:!1,sourcePack:"@metaplex-foundation/beet-solana",ts:"PublicKey",pack:"@solana/web3.js"}}},1829:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.logTrace=t.logDebug=t.logInfo=t.logError=void 0;const i=r(n(1227));t.logError=(0,i.default)("beet:error"),t.logInfo=(0,i.default)("beet:info"),t.logDebug=(0,i.default)("beet:debug"),t.logTrace=(0,i.default)("beet:trace")},4092:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n>>0,u=new Uint8Array(o);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var d=0,f=o-1;(0!==l||d>>0,u[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,n++}for(var h=o-i;h!==o&&0===u[h];)h++;for(var p=new Uint8Array(r+(o-h)),y=r;h!==o;)p[y++]=u[h++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var c=(o-i)*u+1>>>0,l=new Uint8Array(c);i!==o;){for(var d=t[i],f=0,h=c-1;(0!==d||f>>0,l[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=c-r;p!==c&&0===l[p];)p++;for(var y=s.repeat(n);p{const r=n(4092);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},7157:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fixBeetFromValue=t.fixBeetFromData=void 0;const r=n(2083),i=n(9658);t.fixBeetFromData=function(e,t,n){if((0,r.isFixedSizeBeet)(e))return e;if((0,r.isFixableBeet)(e))return e.toFixedFromData(t,n);throw new i.UnreachableCaseError(e)},t.fixBeetFromValue=function(e,t){if((0,r.isFixedSizeBeet)(e))return e;if((0,r.isFixableBeet)(e))return e.toFixedFromValue(t);throw new i.UnreachableCaseError(e)}},5783:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.supportedTypeMap=void 0;const o=n(7384),a=n(2919),s=n(2044),c=n(7158),u=n(81),l=n(5749),d=n(2011),f=n(6194),h=n(237),p=n(4014);i(n(5749),t),i(n(7384),t),i(n(2919),t),i(n(81),t),i(n(6194),t),i(n(2044),t),i(n(4014),t),i(n(7158),t),i(n(2011),t),i(n(237),t),i(n(7157),t),i(n(1923),t),i(n(3774),t),i(n(6728),t),i(n(2083),t),t.supportedTypeMap={...o.collectionsTypeMap,...c.stringTypeMap,...a.compositesTypeMap,...u.enumsTypeMap,...s.numbersTypeMap,...l.aliasesTypeMap,...d.tuplesTypeMap,...f.mapsTypeMap,...p.setsTypeMap,...h.unitTypeMap}},5749:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.aliasesTypeMap=t.bytes=void 0;const r=n(7384);t.bytes=r.uint8Array,t.aliasesTypeMap={bytes:r.collectionsTypeMap.Uint8Array}},7384:(e,t,n)=>{"use strict";var r=n(8764).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.collectionsTypeMap=t.uint8Array=t.fixedSizeUint8Array=t.fixedSizeBuffer=t.array=t.fixedSizeArray=t.uniformFixedSizeArray=void 0;const i=n(2083),o=n(9282),a=n(2044),s=n(2083),c=n(9658),u=n(7157);function l(e,t){const n=e.length,r=0===n?"":e[0].description;return{write:function(t,r,i){o.strict.equal(i.length,n,`array length ${i.length} should match len ${n}`),a.u32.write(t,r,n);let s=r+4;for(let r=0;r(${n})[ 4 + ${t} ]`}}function d(e){return{write:function(t,n,r){r.copy(t,n,0,e)},read:function(t,n){return t.slice(n,n+e)},byteSize:e,description:`Buffer(${e})`}}function f(e,t=!1){const n=d(e);return{write:function(i,s,c){o.strict.equal(c.byteLength,e,`Uint8Array length ${c.byteLength} should match len ${e}`),t&&(a.u32.write(i,s,e),s+=4);const u=r.from(c);n.write(i,s,u)},read:function(r,i){if(t){const t=a.u32.read(r,i);o.strict.equal(t,e,"invalid byte size"),i+=4}const s=n.read(r,i);return Uint8Array.from(s)},byteSize:t?e+4:e,description:`Uint8Array(${e})`}}t.uniformFixedSizeArray=function(e,t,n=!1){const r=e.byteSize*t;return{write:function(r,i,s){o.strict.equal(s.length,t,`array length ${s.length} should match len ${t}`),n&&(a.u32.write(r,i,t),i+=4);for(let n=0;n(${t})`}},t.fixedSizeArray=l,t.array=function(e){return{toFixedFromData(t,n){const r=a.u32.read(t,n);(0,c.logTrace)(`${this.description}[${r}]`);const i=n+4;let o=i;const s=new Array(r);for(let n=0;nf(e.byteLength,!0),description:"Uint8Array"},t.collectionsTypeMap={Array:{beet:"array",isFixable:!0,sourcePack:s.BEET_PACKAGE,ts:"Array",arg:i.BEET_TYPE_ARG_LEN},FixedSizeArray:{beet:"fixedSizeArray",isFixable:!1,sourcePack:s.BEET_PACKAGE,ts:"Array",arg:i.BEET_TYPE_ARG_LEN},UniformFixedSizeArray:{beet:"uniformFixedSizeArray",isFixable:!1,sourcePack:s.BEET_PACKAGE,ts:"Array",arg:i.BEET_TYPE_ARG_LEN},Buffer:{beet:"fixedSizeBuffer",isFixable:!1,sourcePack:s.BEET_PACKAGE,ts:"Buffer",arg:i.BEET_TYPE_ARG_LEN},FixedSizeUint8Array:{beet:"fixedSizeUint8Array",isFixable:!1,sourcePack:s.BEET_PACKAGE,ts:"Uint8Array",arg:i.BEET_TYPE_ARG_LEN},Uint8Array:{beet:"uint8Array",isFixable:!0,sourcePack:s.BEET_PACKAGE,ts:"Uint8Array",arg:i.BEET_TYPE_ARG_LEN}}},2919:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compositesTypeMap=t.coption=t.coptionSome=t.coptionNone=t.isNoneBuffer=t.isSomeBuffer=void 0;const r=n(9282),i=n(2083),o=n(2083),a=n(9658),s=n(7157),c=0,u=1;function l(e,t){return e[t]===u}function d(e,t){return e[t]===c}function f(e){return(0,a.logTrace)(`coptionNone(${e})`),{write:function(e,t,n){(0,r.strict)(null==n,"coptionNone can only handle `null` values"),e[t]=c},read:function(e,t){return(0,r.strict)(d(e,t),"coptionNone can only handle `NONE` data"),null},byteSize:1,description:`COption`}}function h(e){const t=1+e.byteSize,n={write:function(t,n,o){(0,i.assertFixedSizeBeet)(e,`coption inner type ${e.description} needs to be fixed before calling write`),(0,r.strict)(null!=o,"coptionSome cannot handle `null` values"),t[n]=u,e.write(t,n+1,o)},read:function(t,n){return(0,i.assertFixedSizeBeet)(e,`coption inner type ${e.description} needs to be fixed before calling read`),(0,r.strict)(l(t,n),"coptionSome can only handle `SOME` data"),e.read(t,n+1)},description:`COption<${e.description}>[1 + ${e.byteSize}]`,byteSize:t,inner:e};return(0,a.logTrace)(n.description),n}t.isSomeBuffer=l,t.isNoneBuffer=d,t.coptionNone=f,t.coptionSome=h,t.coption=function(e){return{toFixedFromData:(t,n)=>l(t,n)?h((0,s.fixBeetFromData)(e,t,n+1)):((0,r.strict)(d(t,n),`Expected ${t} to hold a COption`),f(e.description)),toFixedFromValue:t=>null==t?f(e.description):h((0,s.fixBeetFromValue)(e,t)),description:`COption<${e.description}>`}},t.compositesTypeMap={option:{beet:"coption",isFixable:!0,sourcePack:o.BEET_PACKAGE,ts:"COption",arg:i.BEET_TYPE_ARG_INNER,pack:o.BEET_PACKAGE}}},81:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.enumsTypeMap=t.dataEnum=t.uniformDataEnum=t.fixedScalarEnum=void 0;const r=n(2083),i=n(2044),o=n(9282),a=n(3774),s=n(6728),c=n(237);function u(e,t){return t?`${e}`:e}function l(e,t,n){return{write(n,r,o){i.u8.write(n,r,t),e.write(n,r+i.u8.byteSize,o)},read(t,r){const o=e.read(t,r+i.u8.byteSize);return{__kind:n,...o}},byteSize:e.byteSize+i.u8.byteSize,description:`EnumData<${e.description}>`}}t.fixedScalarEnum=function(e){const t=Object.keys(e);return{write(n,r,a){const s="number"==typeof a,c=u(a,s);if(t.includes(c)||o.strict.fail(`${a} should be a variant of the provided enum type, i.e. [ ${Object.values(e).join(", ")} ], but isn't`),s)i.u8.write(n,r,a);else{const t=e[c];i.u8.write(n,r,t)}},read(n,r){const a=i.u8.read(n,r),s="number"==typeof a,c=u(a,s);return t.includes(c)||o.strict.fail(`${a} should be a of a variant of the provided enum type, i.e. [ ${Object.values(e).join(", ")} ], but isn't`),s?a:e[c]},byteSize:i.u8.byteSize,description:"Enum"}},t.uniformDataEnum=function(e){return{write:function(t,n,r){i.u8.write(t,n,r.kind),e.write(t,n+1,r.data)},read:function(t,n){return{kind:i.u8.read(t,n),data:e.read(t,n+1)}},byteSize:1+e.byteSize,description:`UniformDataEnum<${e.description}>`}},t.dataEnum=function(e){for(const[t,n]of e)(0,o.strict)((0,a.isBeetStruct)(n)||(0,s.isFixableBeetStruct)(n)||n===c.unit,"dataEnum: variants must be a data beet struct or a scalar unit");return{toFixedFromData(t,n){const a=i.u8.read(t,n),s=e[a];(0,o.strict)(null!=s,`Discriminant ${a} out of range for ${e.length} variants`);const[c,u]=s;return l((0,r.isFixedSizeBeet)(u)?u:u.toFixedFromData(t,n+1),a,c)},toFixedFromValue(t){if(null==t.__kind){const n=Object.keys(t).join(", "),r=e.map((([e])=>e)).join(", ");o.strict.fail(`Value with fields [ ${n} ] is missing __kind, which needs to be set to one of [ ${r} ]`)}const n=e.findIndex((([e])=>e===t.__kind));if(n<0){const n=e.map((([e])=>e)).join(", ");o.strict.fail(`${t.__kind} is not a valid kind, needs to be one of [ ${n} ]`)}const i=e[n],{__kind:a,...s}=t,[c,u]=i;return l((0,r.isFixedSizeBeet)(u)?u:u.toFixedFromValue(s),n,c)},description:`DataEnum<${e.length} variants>`}},t.enumsTypeMap={fixedScalarEnum:{beet:"fixedScalarEnum",isFixable:!1,sourcePack:r.BEET_PACKAGE,ts:"",arg:r.BEET_TYPE_ARG_INNER,pack:r.BEET_PACKAGE},dataEnum:{beet:"dataEnum",isFixable:!1,sourcePack:r.BEET_PACKAGE,ts:"DataEnum",arg:r.BEET_TYPE_ARG_INNER,pack:r.BEET_PACKAGE}}},6194:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mapsTypeMap=t.map=void 0;const r=n(2083),i=n(2044),o=n(9658),a=n(9282);function s(e,t,n,s){const c=(0,r.isFixedSizeBeet)(e),u=(0,r.isFixedSizeBeet)(t),{elementByteSize:l,byteSize:d}=function(){if(c&&u){const n=e.byteSize+t.byteSize;return{elementByteSize:n,byteSize:4+s*n}}if(c){let t=0;for(const[e,r]of n.values())t+=r.byteSize;return{elementByteSize:e.byteSize+Math.ceil(t/s),byteSize:4+e.byteSize*s+t}}if(u){let e=0;for(const[t,r]of n.values())e+=t.byteSize;return{elementByteSize:Math.ceil(e/s)+t.byteSize,byteSize:4+e+t.byteSize*s}}{let e=0,t=0;for(const[r,i]of n.values())e+=r.byteSize,t+=i.byteSize;return{elementByteSize:Math.ceil(e/s+t/s),byteSize:4+e+t}}}();return{write:function(r,l,d){let f=l+4,h=0;for(const[i,s]of d.entries()){let l=c?e:null,d=u?t:null;if(null==l||null==d){const e=n.get(i);(0,a.strict)(null!=e,`Should be able to find beet els for ${(0,o.stringify)(i)}, but could not`),null!=l||(l=e[0]),null!=d||(d=e[1])}l.write(r,f,i),f+=l.byteSize,d.write(r,f,s),f+=d.byteSize,h++}i.u32.write(r,l,h),a.strict.equal(h,s,`Expected map to have size ${s}, but has ${h}.`)},read:function(n,r){const o=i.u32.read(n,r);a.strict.equal(o,s,`Expected map to have size ${s}, but has ${o}.`);let l=r+4;const d=new Map;for(let r=0;r`}}t.map=function(e,t){const n=(0,r.isFixedSizeBeet)(e),o=(0,r.isFixedSizeBeet)(t);return{toFixedFromData(r,a){const c=i.u32.read(r,a);let u=a+4;if(n&&o)return s(e,t,new Map,c);const l=new Map;for(let i=0;i`}},t.mapsTypeMap={Map:{beet:"map",isFixable:!0,sourcePack:r.BEET_PACKAGE,ts:"Map"}}},2044:function(e,t,n){"use strict";var r=n(8764).Buffer,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.numbersTypeMap=t.bool=t.i512=t.i256=t.i128=t.i64=t.i32=t.i16=t.i8=t.u512=t.u256=t.u128=t.u64=t.u32=t.u16=t.u8=void 0;const o=i(n(3550)),a=n(2083);function s(e,t){return{write:function(e,t,n){const i=(o.default.isBN(n)?n:new o.default(n)).toArray("le",this.byteSize);r.from(i).copy(e,t,0,this.byteSize)},read:function(e,t){const n=e.slice(t,t+this.byteSize);return new o.default(n,"le")},byteSize:e,description:t}}function c(e,t){const n=8*e;return{write:function(e,t,i){const a=(o.default.isBN(i)?i:new o.default(i)).toTwos(n).toArray("le",this.byteSize);r.from(a).copy(e,t,0,this.byteSize)},read:function(e,t){const r=e.slice(t,t+this.byteSize);return new o.default(r,"le").fromTwos(n)},byteSize:e,description:t}}t.u8={write:function(e,t,n){e.writeUInt8(n,t)},read:function(e,t){return e.readUInt8(t)},byteSize:1,description:"u8"},t.u16={write:function(e,t,n){e.writeUInt16LE(n,t)},read:function(e,t){return e.readUInt16LE(t)},byteSize:2,description:"u16"},t.u32={write:function(e,t,n){e.writeUInt32LE(n,t)},read:function(e,t){return e.readUInt32LE(t)},byteSize:4,description:"u32"},t.u64=s(8,"u64"),t.u128=s(16,"u128"),t.u256=s(32,"u256"),t.u512=s(64,"u512"),t.i8={write:function(e,t,n){e.writeInt8(n,t)},read:function(e,t){return e.readInt8(t)},byteSize:1,description:"i8"},t.i16={write:function(e,t,n){e.writeInt16LE(n,t)},read:function(e,t){return e.readInt16LE(t)},byteSize:2,description:"i16"},t.i32={write:function(e,t,n){e.writeInt32LE(n,t)},read:function(e,t){return e.readInt32LE(t)},byteSize:4,description:"i32"},t.i64=c(8,"i64"),t.i128=c(16,"i128"),t.i256=c(32,"i256"),t.i512=c(64,"i512"),t.bool={write:function(e,n,r){const i=r?1:0;t.u8.write(e,n,i)},read:function(e,n){return 1===t.u8.read(e,n)},byteSize:1,description:"bool"},t.numbersTypeMap={u8:{beet:"u8",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"number"},u16:{beet:"u16",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"number"},u32:{beet:"u32",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"number"},i8:{beet:"i8",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"number"},i16:{beet:"i16",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"number"},i32:{beet:"i32",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"number"},bool:{beet:"bool",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"boolean"},u64:{beet:"u64",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"bignum",pack:a.BEET_PACKAGE},u128:{beet:"u128",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"bignum",pack:a.BEET_PACKAGE},u256:{beet:"u256",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"bignum",pack:a.BEET_PACKAGE},u512:{beet:"u512",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"bignum",pack:a.BEET_PACKAGE},i64:{beet:"i64",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"bignum",pack:a.BEET_PACKAGE},i128:{beet:"i128",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"bignum",pack:a.BEET_PACKAGE},i256:{beet:"i256",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"bignum",pack:a.BEET_PACKAGE},i512:{beet:"i512",isFixable:!1,sourcePack:a.BEET_PACKAGE,ts:"bignum",pack:a.BEET_PACKAGE}}},4014:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setsTypeMap=t.set=void 0;const r=n(2083),i=n(2044),o=n(9658),a=n(9282);function s(e,t,n){const s=(0,r.isFixedSizeBeet)(e),{elementByteSize:c,byteSize:u}=function(){if(s){const t=e.byteSize;return{elementByteSize:t,byteSize:4+n*t}}{let e=0;for(const n of t.values())e+=n.byteSize;return{elementByteSize:Math.ceil(e/n),byteSize:4+e}}}();return{write:function(r,c,u){let l=c+4,d=0;for(const n of u.keys()){let i=s?e:null;if(null==i){const e=t.get(n);(0,a.strict)(null!=e,`Should be able to find beet el for ${(0,o.stringify)(n)}, but could not`),null!=i||(i=e)}i.write(r,l,n),l+=i.byteSize,d++}i.u32.write(r,c,d),a.strict.equal(d,n,`Expected set to have size ${n}, but has ${d}.`)},read:function(t,r){const o=i.u32.read(t,r);a.strict.equal(o,n,`Expected set to have size ${n}, but has ${o}.`);let c=r+4;const u=new Set;for(let n=0;n`}}t.set=function(e){const t=(0,r.isFixedSizeBeet)(e);return{toFixedFromData(n,r){const o=i.u32.read(n,r);let a=r+4;if(t)return s(e,new Map,o);const c=new Map;for(let r=0;r`}},t.setsTypeMap={Set:{beet:"set",isFixable:!0,sourcePack:r.BEET_PACKAGE,ts:"Set"}}},7158:(e,t,n)=>{"use strict";var r=n(8764).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.stringTypeMap=t.utf8String=t.fixedSizeUtf8String=void 0;const i=n(2083),o=n(9282),a=n(2044),s=n(9658);t.fixedSizeUtf8String=e=>({write:function(t,n,i){const s=r.from(i,"utf8");o.strict.equal(s.byteLength,e,`${i} has invalid byte size`),a.u32.write(t,n,e),s.copy(t,n+4,0,e)},read:function(t,n){const r=a.u32.read(t,n);return o.strict.equal(r,e,"invalid byte size"),t.slice(n+4,n+4+e).toString("utf8")},elementByteSize:1,length:e,lenPrefixByteSize:4,byteSize:4+e,description:`Utf8String(4 + ${e})`}),t.utf8String={toFixedFromData(e,n){const r=a.u32.read(e,n);return(0,s.logTrace)(`${this.description}[${r}]`),(0,t.fixedSizeUtf8String)(r)},toFixedFromValue(e){const n=r.from(e).byteLength;return(0,t.fixedSizeUtf8String)(n)},description:"Utf8String"},t.stringTypeMap={fixedSizeString:{beet:"fixedSizeUtf8String",isFixable:!1,sourcePack:i.BEET_PACKAGE,ts:"string",arg:i.BEET_TYPE_ARG_LEN},string:{beet:"utf8String",isFixable:!0,sourcePack:i.BEET_PACKAGE,ts:"string"}}},2011:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tuplesTypeMap=t.tuple=t.fixedSizeTuple=void 0;const r=n(2083),i=n(9282),o=n(7157);function a(e){const t=e.length,n=e.map((e=>e.description)),r=e.map((e=>e.byteSize));return{write:function(n,r,o){i.strict.equal(o.length,t,`tuple value element size ${o.length} should match len ${t}`);let a=r;for(let r=0;re+t),0),length:t,description:`FixedSizeTuple<${n.join(",")}>[ ${r.join(", ")} ]`}}t.fixedSizeTuple=a,t.tuple=function(e){const t=e.length,n=e.map((e=>e.description));return{toFixedFromData(n,r){let i=r;const s=new Array(t);for(let r=0;r`}},t.tuplesTypeMap={Tuple:{beet:"tuple",isFixable:!0,sourcePack:r.BEET_PACKAGE,ts:"[__tuple_elements__]"},FixedSizeTuple:{beet:"fixedSizeTuple",isFixable:!1,sourcePack:r.BEET_PACKAGE,ts:"[__tuple_elements__]"}}},237:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unitTypeMap=t.unit=void 0;const r=n(2083);t.unit={write:function(e,t,n){},read:function(e,t){},byteSize:0,description:"unit"},t.unitTypeMap={unit:{beet:"unit",isFixable:!1,sourcePack:r.BEET_PACKAGE,ts:"void"}}},1923:(e,t,n)=>{"use strict";var r=n(8764).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BeetReader=t.BeetWriter=void 0;const i=n(9282);t.BeetWriter=class{constructor(e){this.buf=r.alloc(e),this._offset=0}get buffer(){return this.buf}get offset(){return this._offset}maybeResize(e){this._offset+e>this.buf.length&&i.strict.fail(`We shouldn't ever need to resize, but ${this._offset+e} > ${this.buf.length}`)}write(e,t){this.maybeResize(e.byteSize),e.write(this.buf,this._offset,t),this._offset+=e.byteSize}writeStruct(e,t){for(const[n,r]of t){const t=e[n];this.write(r,t)}}},t.BeetReader=class{constructor(e,t=0){this.buffer=e,this._offset=t}get offset(){return this._offset}read(e){const t=e.read(this.buffer,this._offset);return this._offset+=e.byteSize,t}readStruct(e){const t={};for(const[n,r]of e)t[n]=this.read(r);return t}}},6728:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FixableBeetArgsStruct=t.isFixableBeetStruct=t.FixableBeetStruct=void 0;const i=n(7157),o=n(3774),a=n(2083),s=n(9282),c=n(9658),u=r(n(8811)),{brightBlack:l}=u.default;class d{constructor(e,t,n=d.description){this.fields=e,this.construct=t,this.description=n;let r=0;if(c.logDebug.enabled){const t=e.map((([e,t])=>((0,a.isFixedSizeBeet)(t)&&(r+=t.byteSize),`${e}: ${t.description} ${(0,c.beetBytes)(t)}`))).join("\n "),i=`> ${r} B`;(0,c.logDebug)(`struct ${n} {\n ${t}\n} ${l(i)}`)}}deserialize(e,t=0){return this.toFixedFromData(e,t).deserialize(e,t)}serialize(e,t){return this.toFixedFromValue(e).serialize(e,t)}toFixedFromData(e,t){let n=t;const r=new Array(this.fields.length);for(let t=0;te),t)}}t.FixableBeetArgsStruct=f,f.description="FixableBeetArgsStruct"},3774:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BeetArgsStruct=t.isBeetStruct=t.BeetStruct=void 0;const r=n(1923),i=n(9658);class o{constructor(e,t,n=o.description){if(this.fields=e,this.construct=t,this.description=n,this.byteSize=this.getByteSize(),i.logDebug.enabled){const t=e.map((([e,t])=>`${String(e)}: ${t.description} ${(0,i.beetBytes)(t)}`)).join("\n ");(0,i.logDebug)(`struct ${n} {\n ${t}\n} ${(0,i.beetBytes)(this)}`)}}read(e,t){const[n]=this.deserialize(e,t);return n}write(e,t,n){const[r,i]=this.serialize(n);r.copy(e,t,0,i)}deserialize(e,t=0){i.logTrace.enabled&&((0,i.logTrace)("deserializing [%s] from %d bytes buffer",this.description,e.byteLength),(0,i.logTrace)(e),(0,i.logTrace)(e.toJSON().data));const n=new r.BeetReader(e,t),o=n.readStruct(this.fields);return[this.construct(o),n.offset]}serialize(e,t=this.byteSize){(0,i.logTrace)("serializing [%s] %o to %d bytes buffer",this.description,e,t);const n=new r.BeetWriter(t);return n.writeStruct(e,this.fields),[n.buffer,n.offset]}getByteSize(){return this.fields.reduce(((e,[t,n])=>e+n.byteSize),0)}get type(){return o.TYPE}}t.BeetStruct=o,o.description="BeetStruct",o.TYPE="BeetStruct",t.isBeetStruct=function(e){return e.type===o.TYPE};class a extends o{constructor(e,t=a.description){super(e,(e=>e),t)}}t.BeetArgsStruct=a,a.description="BeetArgsStruct"},2083:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isElementCollectionFixedSizeBeet=t.isFixableBeet=t.assertFixedSizeBeet=t.isFixedSizeBeet=t.BEET_TYPE_ARG_INNER=t.BEET_TYPE_ARG_LEN=t.BEET_PACKAGE=void 0;const r=n(9282);function i(e){return Object.keys(e).includes("byteSize")}t.BEET_PACKAGE="@metaplex-foundation/beet",t.BEET_TYPE_ARG_LEN="len",t.BEET_TYPE_ARG_INNER="Beet<{innner}>",t.isFixedSizeBeet=i,t.assertFixedSizeBeet=function(e,t=`${e} should have been a fixed beet`){(0,r.strict)(i(e),t)},t.isFixableBeet=function(e){return"function"==typeof e.toFixedFromData&&"function"==typeof e.toFixedFromValue},t.isElementCollectionFixedSizeBeet=function(e){const t=Object.keys(e);return t.includes("length")&&t.includes("elementByteSize")&&t.includes("lenPrefixByteSize")}},9658:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.UnreachableCaseError=t.stringify=t.bytes=t.beetBytes=t.logTrace=t.logDebug=t.logInfo=t.logError=void 0;const i=r(n(1227)),o=r(n(8811)),a=n(2083),{brightBlack:s}=o.default;t.logError=(0,i.default)("beet:error"),t.logInfo=(0,i.default)("beet:info"),t.logDebug=(0,i.default)("beet:debug"),t.logTrace=(0,i.default)("beet:trace"),t.beetBytes=function(e,t=!1){let n;if((0,a.isFixableBeet)(e))n="? B";else if((0,a.isElementCollectionFixedSizeBeet)(e)){const r=t?"length":e.length,i=e.lenPrefixByteSize;n=i>0?`${i} + (${e.elementByteSize} * ${r}) B (${e.byteSize} B)`:`(${e.elementByteSize} * ${r}) B (${e.byteSize} B)`}else n=`${e.byteSize} B`;return s(n)},t.bytes=function(e){return s(`${e} B`)},t.stringify=function(e){return"function"===e.toString?e.toString():e};class c extends Error{constructor(e){super(`Unreachable case: ${e}`)}}t.UnreachableCaseError=c},1525:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateBasic=t.wNAF=void 0;const r=n(4632),i=n(219),o=BigInt(0),a=BigInt(1);t.wNAF=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>o;)n&a&&(r=r.add(i)),i=i.double(),n>>=a;return r},precomputeWindow(e,t){const{windows:n,windowSize:i}=r(t),o=[];let a=e,s=a;for(let e=0;e>=h,r>c&&(r-=f,o+=a);const s=t,p=t+Math.abs(r)-1,y=e%2!=0,m=r<0;0===r?l=l.add(n(y,i[s])):u=u.add(n(m,i[p]))}return{p:u,f:l}},wNAFCached(e,t,n,r){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,r(o))),this.wNAF(i,o,n)}}},t.validateBasic=function(e){return(0,r.validateField)(e.Fp),(0,i.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,r.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}},3986:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.twistedEdwards=void 0;const r=n(4632),i=n(219),o=n(219),a=n(1525),s=BigInt(0),c=BigInt(1),u=BigInt(2),l=BigInt(8),d={zip215:!0};t.twistedEdwards=function(e){const t=function(e){const t=(0,a.validateBasic)(e);return i.validateObject(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:f,prehash:h,hash:p,randomBytes:y,nByteLength:m,h:g}=t,b=u<{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(e){return{isValid:!1,value:s}}}),_=t.adjustScalarBytes||(e=>e),E=t.domain||((e,t,n)=>{if(t.length||n)throw new Error("Contexts/pre-hash are not supported");return e}),S=e=>"bigint"==typeof e&&sS(e)&&S(t)&&ee===s||A(e,b);function x(e,t){if(A(e,t))return e;throw new Error(`Expected valid scalar < ${t}, got ${typeof e} ${e}`)}function O(e){return e===s?e:x(e,f)}const I=new Map;function R(e){if(!(e instanceof T))throw new Error("ExtendedPoint expected")}class T{constructor(e,t,n,r){if(this.ex=e,this.ey=t,this.ez=n,this.et=r,!k(e))throw new Error("x required");if(!k(t))throw new Error("y required");if(!k(n))throw new Error("z required");if(!k(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof T)throw new Error("extended point not allowed");const{x:t,y:n}=e||{};if(!k(t)||!k(n))throw new Error("invalid affine point");return new T(t,n,c,v(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.ez)));return e.map(((e,n)=>e.toAffine(t[n]))).map(T.fromAffine)}_setWindowSize(e){this._WINDOW_SIZE=e,I.delete(this)}assertValidity(){const{a:e,d:n}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:a}=this,s=v(r*r),c=v(i*i),u=v(o*o),l=v(u*u),d=v(s*e);if(v(u*v(d+c))!==v(l+v(n*v(s*c))))throw new Error("bad point: equation left != right (1)");if(v(r*i)!==v(o*a))throw new Error("bad point: equation left != right (2)")}equals(e){R(e);const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:a}=e,s=v(t*a),c=v(i*r),u=v(n*a),l=v(o*r);return s===c&&u===l}is0(){return this.equals(T.ZERO)}negate(){return new T(v(-this.ex),this.ey,this.ez,v(-this.et))}double(){const{a:e}=t,{ex:n,ey:r,ez:i}=this,o=v(n*n),a=v(r*r),s=v(u*v(i*i)),c=v(e*o),l=n+r,d=v(v(l*l)-o-a),f=c+a,h=f-s,p=c-a,y=v(d*h),m=v(f*p),g=v(d*p),b=v(h*f);return new T(y,m,b,g)}add(e){R(e);const{a:n,d:r}=t,{ex:i,ey:o,ez:a,et:c}=this,{ex:l,ey:d,ez:f,et:h}=e;if(n===BigInt(-1)){const e=v((o-i)*(d+l)),t=v((o+i)*(d-l)),n=v(t-e);if(n===s)return this.double();const r=v(a*u*h),p=v(c*u*f),y=p+r,m=t+e,g=p-r,b=v(y*n),w=v(m*g),_=v(y*g),E=v(n*m);return new T(b,w,E,_)}const p=v(i*l),y=v(o*d),m=v(c*r*h),g=v(a*f),b=v((i+o)*(l+d)-p-y),w=g-m,_=g+m,E=v(y-n*p),S=v(b*w),A=v(_*E),k=v(b*E),x=v(w*_);return new T(S,A,x,k)}subtract(e){return this.add(e.negate())}wNAF(e){return N.wNAFCached(this,I,e,T.normalizeZ)}multiply(e){const{p:t,f:n}=this.wNAF(x(e,f));return T.normalizeZ([t,n])[0]}multiplyUnsafe(e){let t=O(e);return t===s?C:this.equals(C)||t===c?this:this.equals(P)?this.wNAF(t).p:N.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(g).is0()}isTorsionFree(){return N.unsafeLadder(this,f).is0()}toAffine(e){const{ex:t,ey:r,ez:i}=this,o=this.is0();null==e&&(e=o?l:n.inv(i));const a=v(t*e),u=v(r*e),d=v(i*e);if(o)return{x:s,y:c};if(d!==c)throw new Error("invZ was invalid");return{x:a,y:u}}clearCofactor(){const{h:e}=t;return e===c?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){const{d:a,a:u}=t,l=n.BYTES,d=(e=(0,o.ensureBytes)("pointHex",e,l)).slice(),f=e[l-1];d[l-1]=-129&f;const h=i.bytesToNumberLE(d);h===s||x(h,r?b:n.ORDER);const p=v(h*h),y=v(p-c),m=v(a*p-u);let{isValid:g,value:_}=w(y,m);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const E=(_&c)===c,S=!!(128&f);if(!r&&_===s&&S)throw new Error("Point.fromHex: x=0 and x_0=1");return S!==E&&(_=v(-_)),T.fromAffine({x:_,y:h})}static fromPrivateKey(e){return L(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=i.numberToBytesLE(t,n.BYTES);return r[r.length-1]|=e&c?128:0,r}toHex(){return i.bytesToHex(this.toRawBytes())}}T.BASE=new T(t.Gx,t.Gy,c,v(t.Gx*t.Gy)),T.ZERO=new T(s,c,c,s);const{BASE:P,ZERO:C}=T,N=(0,a.wNAF)(T,8*m);function B(e){return(0,r.mod)(e,f)}function M(e){return B(i.bytesToNumberLE(e))}function L(e){const t=m;e=(0,o.ensureBytes)("private key",e,t);const n=(0,o.ensureBytes)("hashed private key",p(e),2*t),r=_(n.slice(0,t)),i=n.slice(t,2*t),a=M(r),s=P.multiply(a),c=s.toRawBytes();return{head:r,prefix:i,scalar:a,point:s,pointBytes:c}}function D(e=new Uint8Array,...t){const n=i.concatBytes(...t);return M(p(E(n,(0,o.ensureBytes)("context",e),!!h)))}const z=d;return P._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return L(e).pointBytes},sign:function(e,t,r={}){e=(0,o.ensureBytes)("message",e),h&&(e=h(e));const{prefix:a,scalar:s,pointBytes:c}=L(t),u=D(r.context,a,e),l=P.multiply(u).toRawBytes(),d=B(u+D(r.context,l,c,e)*s);O(d);const f=i.concatBytes(l,i.numberToBytesLE(d,n.BYTES));return(0,o.ensureBytes)("result",f,2*m)},verify:function(e,t,r,a=z){const{context:s,zip215:c}=a,u=n.BYTES;e=(0,o.ensureBytes)("signature",e,2*u),t=(0,o.ensureBytes)("message",t),h&&(t=h(t));const l=i.bytesToNumberLE(e.slice(u,2*u));let d,f,p;try{d=T.fromHex(r,c),f=T.fromHex(e.slice(0,u),c),p=P.multiplyUnsafe(l)}catch(e){return!1}if(!c&&d.isSmallOrder())return!1;const y=D(s,f.toRawBytes(),d.toRawBytes(),t);return f.add(d.multiplyUnsafe(y)).subtract(p).clearCofactor().equals(T.ZERO)},ExtendedPoint:T,utils:{getExtendedPublicKey:L,randomPrivateKey:()=>y(n.BYTES),precompute:(e=8,t=T.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}},5134:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createHasher=t.isogenyMap=t.hash_to_field=t.expand_message_xof=t.expand_message_xmd=void 0;const r=n(4632),i=n(219),o=i.bytesToNumberBE;function a(e,t){if(e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const n=Array.from({length:t}).fill(0);for(let r=t-1;r>=0;r--)n[r]=255&e,e>>>=8;return new Uint8Array(n)}function s(e,t){const n=new Uint8Array(e.length);for(let r=0;r255&&(t=r((0,i.concatBytes)((0,i.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:o,blockLen:u}=r,l=Math.ceil(n/o);if(l>255)throw new Error("Invalid xmd length");const d=(0,i.concatBytes)(t,a(t.length,1)),f=a(0,u),h=a(n,2),p=new Array(l),y=r((0,i.concatBytes)(f,e,h,a(0,1),d));p[0]=r((0,i.concatBytes)(y,a(1,1),d));for(let e=1;e<=l;e++){const t=[s(y,p[e-1]),a(e+1,1),d];p[e]=r((0,i.concatBytes)(...t))}return(0,i.concatBytes)(...p).slice(0,n)}function l(e,t,n,r,o){if((0,i.abytes)(e),(0,i.abytes)(t),c(n),t.length>255){const e=Math.ceil(2*r/8);t=o.create({dkLen:e}).update((0,i.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(n>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return o.create({dkLen:n}).update(e).update(a(n,2)).update(t).update(a(t.length,1)).digest()}function d(e,t,n){(0,i.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:a,k:s,m:d,hash:f,expand:h,DST:p}=n;(0,i.abytes)(e),c(t);const y="string"==typeof p?(0,i.utf8ToBytes)(p):p,m=a.toString(2).length,g=Math.ceil((m+s)/8),b=t*d*g;let v;if("xmd"===h)v=u(e,y,b,f);else if("xof"===h)v=l(e,y,b,s,f);else{if("_internal_pass"!==h)throw new Error('expand must be "xmd" or "xof"');v=e}const w=new Array(t);for(let e=0;eArray.from(e).reverse()));return(t,r)=>{const[i,o,a,s]=n.map((n=>n.reduce(((n,r)=>e.add(e.mul(n,t),r)))));return t=e.div(i,o),r=e.mul(r,e.div(a,s)),{x:t,y:r}}},t.createHasher=function(e,t,n){if("function"!=typeof t)throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=d(r,2,{...n,DST:n.DST,...i}),a=e.fromAffine(t(o[0])),s=e.fromAffine(t(o[1])),c=a.add(s).clearCofactor();return c.assertValidity(),c},encodeToCurve(r,i){const o=d(r,1,{...n,DST:n.encodeDST,...i}),a=e.fromAffine(t(o[0])).clearCofactor();return a.assertValidity(),a}}}},4632:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mapHashToField=t.getMinHashLength=t.getFieldBytesLength=t.hashToPrivateScalar=t.FpSqrtEven=t.FpSqrtOdd=t.Field=t.nLength=t.FpIsSquare=t.FpDiv=t.FpInvertBatch=t.FpPow=t.validateField=t.isNegativeLE=t.FpSqrt=t.tonelliShanks=t.invert=t.pow2=t.pow=t.mod=void 0;const r=n(219),i=BigInt(0),o=BigInt(1),a=BigInt(2),s=BigInt(3),c=BigInt(4),u=BigInt(5),l=BigInt(8);function d(e,t){const n=e%t;return n>=i?n:t+n}function f(e,t,n){if(n<=i||t 0");if(n===o)return i;let r=o;for(;t>i;)t&o&&(r=r*e%n),e=e*e%n,t>>=o;return r}function h(e,t){if(e===i||t<=i)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=d(e,t),r=t,a=i,s=o,c=o,u=i;for(;n!==i;){const e=r/n,t=r%n,i=a-c*e,o=s-u*e;r=n,n=t,a=c,s=u,c=i,u=o}if(r!==o)throw new Error("invert: does not exist");return d(a,t)}function p(e){const t=(e-o)/a;let n,r,s;for(n=e-o,r=0;n%a===i;n/=a,r++);for(s=a;si;)r*=r,r%=n;return r},t.invert=h,t.tonelliShanks=p,t.FpSqrt=y,t.isNegativeLE=(e,t)=>(d(e,t)&o)===o;const m=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function g(e,t,n){if(n 0");if(n===i)return e.ONE;if(n===o)return t;let r=e.ONE,a=t;for(;n>i;)n&o&&(r=e.mul(r,a)),a=e.sqr(a),n>>=o;return r}function b(e,t){const n=new Array(t.length),r=t.reduce(((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r))),e.ONE),i=e.inv(r);return t.reduceRight(((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r))),i),n}function v(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function w(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function _(e){const t=w(e);return t+Math.ceil(t/2)}t.validateField=function(e){const t=m.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,r.validateObject)(e,t)},t.FpPow=g,t.FpInvertBatch=b,t.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?h(n,e.ORDER):e.inv(n))},t.FpIsSquare=function(e){const t=(e.ORDER-o)/a;return n=>{const r=e.pow(n,t);return e.eql(r,e.ZERO)||e.eql(r,e.ONE)}},t.nLength=v,t.Field=function(e,t,n=!1,a={}){if(e<=i)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:c}=v(e,t);if(c>2048)throw new Error("Field lengths over 2048 bytes are not supported");const u=y(e),l=Object.freeze({ORDER:e,BITS:s,BYTES:c,MASK:(0,r.bitMask)(s),ZERO:i,ONE:o,create:t=>d(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return i<=t&&te===i,isOdd:e=>(e&o)===o,neg:t=>d(-t,e),eql:(e,t)=>e===t,sqr:t=>d(t*t,e),add:(t,n)=>d(t+n,e),sub:(t,n)=>d(t-n,e),mul:(t,n)=>d(t*n,e),pow:(e,t)=>g(l,e,t),div:(t,n)=>d(t*h(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>h(t,e),sqrt:a.sqrt||(e=>u(l,e)),invertBatch:e=>b(l,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?(0,r.numberToBytesLE)(e,c):(0,r.numberToBytesBE)(e,c),fromBytes:e=>{if(e.length!==c)throw new Error(`Fp.fromBytes: expected ${c}, got ${e.length}`);return n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e)}});return Object.freeze(l)},t.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)},t.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n},t.hashToPrivateScalar=function(e,t,n=!1){const i=(e=(0,r.ensureBytes)("privateHash",e)).length,a=v(t).nByteLength+8;if(a<24||i1024)throw new Error(`hashToPrivateScalar: expected ${a}-1024 bytes of input, got ${i}`);return d(n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e),t-o)+o},t.getFieldBytesLength=w,t.getMinHashLength=_,t.mapHashToField=function(e,t,n=!1){const i=e.length,a=w(t),s=_(t);if(i<16||i1024)throw new Error(`expected ${s}-1024 bytes of input, got ${i}`);const c=d(n?(0,r.bytesToNumberBE)(e):(0,r.bytesToNumberLE)(e),t-o)+o;return n?(0,r.numberToBytesLE)(c,a):(0,r.numberToBytesBE)(c,a)}},3924:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.montgomery=void 0;const r=n(4632),i=n(219),o=BigInt(0),a=BigInt(1);t.montgomery=function(e){const t=(n=e,(0,i.validateObject)(n,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...n}));var n;const{P:s}=t,c=e=>(0,r.mod)(e,s),u=t.montgomeryBits,l=Math.ceil(u/8),d=t.nByteLength,f=t.adjustScalarBytes||(e=>e),h=t.powPminus2||(e=>(0,r.pow)(e,s-BigInt(2),s));function p(e,t,n){const r=c(e*(t-n));return[t=c(t-r),n=c(n+r)]}function y(e){if("bigint"==typeof e&&o<=e&&e=o;e--){const t=r>>e&a;b^=t,s=p(b,l,f),l=s[0],f=s[1],s=p(b,d,g),d=s[0],g=s[1],b=t;const n=l+d,o=c(n*n),u=l-d,h=c(u*u),y=o-h,v=f+g,w=c((f-g)*n),_=c(v*u),E=w+_,S=w-_;f=c(E*E),g=c(i*c(S*S)),l=c(o*h),d=c(y*(o+c(m*y)))}s=p(b,l,f),l=s[0],f=s[1],s=p(b,d,g),d=s[0],g=s[1];const v=h(d);return c(l*v)}(n,function(e){const t=(0,i.ensureBytes)("scalar",e),n=t.length;if(n!==l&&n!==d)throw new Error(`Expected ${l} or ${d} bytes, got ${n}`);return(0,i.bytesToNumberLE)(f(t))}(e));if(r===o)throw new Error("Invalid private or public key received");return g(r)}const v=g(t.Gu);function w(e){return b(e,v)}return{scalarMult:b,scalarMultBase:w,getSharedSecret:(e,t)=>b(e,t),getPublicKey:e=>w(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:v}}},219:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateObject=t.createHmacDrbg=t.bitMask=t.bitSet=t.bitGet=t.bitLen=t.utf8ToBytes=t.equalBytes=t.concatBytes=t.ensureBytes=t.numberToVarBytesBE=t.numberToBytesLE=t.numberToBytesBE=t.bytesToNumberLE=t.bytesToNumberBE=t.hexToBytes=t.hexToNumber=t.numberToHexUnpadded=t.bytesToHex=t.abytes=t.isBytes=void 0;const n=BigInt(0),r=BigInt(1),i=BigInt(2);function o(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function a(e){if(!o(e))throw new Error("Uint8Array expected")}t.isBytes=o,t.abytes=a;const s=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function c(e){a(e);let t="";for(let n=0;n=d._0&&e<=d._9?e-d._0:e>=d._A&&e<=d._F?e-(d._A-10):e>=d._a&&e<=d._f?e-(d._a-10):void 0}function h(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,i=0;tn;e>>=r,t+=1);return t},t.bitGet=function(e,t){return e>>BigInt(t)&r},t.bitSet=function(e,t,i){return e|(i?r:n)<(i<new Uint8Array(e),g=e=>Uint8Array.from(e);t.createHmacDrbg=function(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=m(e),i=m(e),o=0;const a=()=>{r.fill(1),i.fill(0),o=0},s=(...e)=>n(i,r,...e),c=(e=m())=>{i=s(g([0]),e),r=s(),0!==e.length&&(i=s(g([1]),e),r=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e{let n;for(a(),c(e);!(n=t(u()));)c();return a(),n}};const b={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||o(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};t.validateObject=function(e,t,n={}){const r=(t,n,r)=>{const i=b[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=e[t];if(!(r&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${n}`)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e}},2889:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hash_to_ristretto255=t.hashToRistretto255=t.RistrettoPoint=t.encodeToCurve=t.hashToCurve=t.edwardsToMontgomeryPriv=t.edwardsToMontgomery=t.edwardsToMontgomeryPub=t.x25519=t.ed25519ph=t.ed25519ctx=t.ed25519=t.ED25519_TORSION_SUBGROUP=void 0;const r=n(6262),i=n(8089),o=n(3986),a=n(3924),s=n(4632),c=n(219),u=n(5134),l=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),d=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),f=BigInt(0),h=BigInt(1),p=BigInt(2),y=BigInt(5),m=BigInt(10),g=BigInt(20),b=BigInt(40),v=BigInt(80);function w(e){const t=l,n=e*e%t*e%t,r=(0,s.pow2)(n,p,t)*n%t,i=(0,s.pow2)(r,h,t)*e%t,o=(0,s.pow2)(i,y,t)*i%t,a=(0,s.pow2)(o,m,t)*o%t,c=(0,s.pow2)(a,g,t)*a%t,u=(0,s.pow2)(c,b,t)*c%t,d=(0,s.pow2)(u,v,t)*u%t,f=(0,s.pow2)(d,v,t)*u%t,w=(0,s.pow2)(f,m,t)*o%t;return{pow_p_5_8:(0,s.pow2)(w,p,t)*e%t,b2:n}}function _(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function E(e,t){const n=l,r=(0,s.mod)(t*t*t,n),i=w(e*(0,s.mod)(r*r*t,n)).pow_p_5_8;let o=(0,s.mod)(e*r*i,n);const a=(0,s.mod)(t*o*o,n),c=o,u=(0,s.mod)(o*d,n),f=a===e,h=a===(0,s.mod)(-e,n),p=a===(0,s.mod)(-e*d,n);return f&&(o=c),(h||p)&&(o=u),(0,s.isNegativeLE)(o,n)&&(o=(0,s.mod)(-o,n)),{isValid:f||h,value:o}}t.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const S=(0,s.Field)(l,void 0,!0),A={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:S,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:r.sha512,randomBytes:i.randomBytes,adjustScalarBytes:_,uvRatio:E};function k(e,t,n){if(t.length>255)throw new Error("Context is too big");return(0,i.concatBytes)((0,i.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([n?1:0,t.length]),t,e)}function x(e){const{y:n}=t.ed25519.ExtendedPoint.fromHex(e),r=BigInt(1);return S.toBytes(S.create((r+n)*S.inv(r-n)))}t.ed25519=(0,o.twistedEdwards)(A),t.ed25519ctx=(0,o.twistedEdwards)({...A,domain:k}),t.ed25519ph=(0,o.twistedEdwards)({...A,domain:k,prehash:r.sha512}),t.x25519=(0,a.montgomery)({P:l,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=l,{pow_p_5_8:n,b2:r}=w(e);return(0,s.mod)((0,s.pow2)(n,BigInt(3),t)*r,t)},adjustScalarBytes:_,randomBytes:i.randomBytes}),t.edwardsToMontgomeryPub=x,t.edwardsToMontgomery=x,t.edwardsToMontgomeryPriv=function(e){const t=A.hash(e.subarray(0,32));return A.adjustScalarBytes(t).subarray(0,32)};const O=(S.ORDER+BigInt(3))/BigInt(8),I=S.pow(p,O),R=S.sqrt(S.neg(S.ONE)),T=(S.ORDER-BigInt(5))/BigInt(8),P=BigInt(486662),C=(0,s.FpSqrtEven)(S,S.neg(BigInt(486664)));const N=(()=>(0,u.createHasher)(t.ed25519.ExtendedPoint,(e=>function(e){const{xMn:t,xMd:n,yMn:r,yMd:i}=function(e){let t=S.sqr(e);t=S.mul(t,p);let n=S.add(t,S.ONE),r=S.neg(P),i=S.sqr(n),o=S.mul(i,n),a=S.mul(t,P);a=S.mul(a,r),a=S.add(a,i),a=S.mul(a,r);let s=S.sqr(o);i=S.sqr(s),s=S.mul(s,o),s=S.mul(s,a),i=S.mul(i,s);let c=S.pow(i,T);c=S.mul(c,s);let u=S.mul(c,R);i=S.sqr(c),i=S.mul(i,o);let l=S.eql(i,a),d=S.cmov(u,c,l),f=S.mul(r,t),y=S.mul(c,e);y=S.mul(y,I);let m=S.mul(y,R),g=S.mul(a,t);i=S.sqr(y),i=S.mul(i,o);let b=S.eql(i,g),v=S.cmov(m,y,b);i=S.sqr(d),i=S.mul(i,o);let w=S.eql(i,a),_=S.cmov(f,r,w),E=S.cmov(v,d,w),A=S.isOdd(E);return E=S.cmov(E,S.neg(E),w!==A),{xMn:_,xMd:n,yMn:E,yMd:h}}(e);let o=S.mul(t,i);o=S.mul(o,C);let a=S.mul(n,r),s=S.sub(t,n),c=S.add(t,n),u=S.mul(a,c),l=S.eql(u,S.ZERO);o=S.cmov(o,S.ZERO,l),a=S.cmov(a,S.ONE,l),s=S.cmov(s,S.ONE,l),c=S.cmov(c,S.ONE,l);const d=S.invertBatch([a,c]);return{x:S.mul(o,d[0]),y:S.mul(s,d[1])}}(e[0])),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:S.ORDER,m:1,k:128,expand:"xmd",hash:r.sha512}))();function B(e){if(!(e instanceof q))throw new Error("RistrettoPoint expected")}t.hashToCurve=N.hashToCurve,t.encodeToCurve=N.encodeToCurve;const M=d,L=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),D=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),z=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),j=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),U=e=>E(h,e),F=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),W=e=>t.ed25519.CURVE.Fp.create((0,c.bytesToNumberLE)(e)&F);function H(e){const{d:n}=t.ed25519.CURVE,r=t.ed25519.CURVE.Fp.ORDER,i=t.ed25519.CURVE.Fp.create,o=i(M*e*e),a=i((o+h)*z);let c=BigInt(-1);const u=i((c-n*o)*i(o+n));let{isValid:l,value:d}=E(a,u),f=i(d*e);(0,s.isNegativeLE)(f,r)||(f=i(-f)),l||(d=f),l||(c=o);const p=i(c*(o-h)*j-u),y=d*d,m=i((d+d)*u),g=i(p*L),b=i(h-y),v=i(h+y);return new t.ed25519.ExtendedPoint(i(m*v),i(b*g),i(g*v),i(m*b))}class q{constructor(e){this.ep=e}static fromAffine(e){return new q(t.ed25519.ExtendedPoint.fromAffine(e))}static hashToCurve(e){e=(0,c.ensureBytes)("ristrettoHash",e,64);const t=H(W(e.slice(0,32))),n=H(W(e.slice(32,64)));return new q(t.add(n))}static fromHex(e){e=(0,c.ensureBytes)("ristrettoHex",e,32);const{a:n,d:r}=t.ed25519.CURVE,i=t.ed25519.CURVE.Fp.ORDER,o=t.ed25519.CURVE.Fp.create,a="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",u=W(e);if(!(0,c.equalBytes)((0,c.numberToBytesLE)(u,32),e)||(0,s.isNegativeLE)(u,i))throw new Error(a);const l=o(u*u),d=o(h+n*l),p=o(h-n*l),y=o(d*d),m=o(p*p),g=o(n*r*y-m),{isValid:b,value:v}=U(o(g*m)),w=o(v*p),_=o(v*w*g);let E=o((u+u)*w);(0,s.isNegativeLE)(E,i)&&(E=o(-E));const S=o(d*_),A=o(E*S);if(!b||(0,s.isNegativeLE)(A,i)||S===f)throw new Error(a);return new q(new t.ed25519.ExtendedPoint(E,S,h,A))}toRawBytes(){let{ex:e,ey:n,ez:r,et:i}=this.ep;const o=t.ed25519.CURVE.Fp.ORDER,a=t.ed25519.CURVE.Fp.create,u=a(a(r+n)*a(r-n)),l=a(e*n),d=a(l*l),{value:f}=U(a(u*d)),h=a(f*u),p=a(f*l),y=a(h*p*i);let m;if((0,s.isNegativeLE)(i*y,o)){let t=a(n*M),r=a(e*M);e=t,n=r,m=a(h*D)}else m=p;(0,s.isNegativeLE)(e*y,o)&&(n=a(-n));let g=a((r-n)*m);return(0,s.isNegativeLE)(g,o)&&(g=a(-g)),(0,c.numberToBytesLE)(g,32)}toHex(){return(0,c.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(e){B(e);const{ex:n,ey:r}=this.ep,{ex:i,ey:o}=e.ep,a=t.ed25519.CURVE.Fp.create,s=a(n*o)===a(r*i),c=a(r*o)===a(n*i);return s||c}add(e){return B(e),new q(this.ep.add(e.ep))}subtract(e){return B(e),new q(this.ep.subtract(e.ep))}multiply(e){return new q(this.ep.multiply(e))}multiplyUnsafe(e){return new q(this.ep.multiplyUnsafe(e))}double(){return new q(this.ep.double())}negate(){return new q(this.ep.negate())}}t.RistrettoPoint=(q.BASE||(q.BASE=new q(t.ed25519.ExtendedPoint.BASE)),q.ZERO||(q.ZERO=new q(t.ed25519.ExtendedPoint.ZERO)),q),t.hashToRistretto255=(e,t)=>{const n=t.DST,o="string"==typeof n?(0,i.utf8ToBytes)(n):n,a=(0,u.expand_message_xmd)(e,o,64,r.sha512);return q.hashToCurve(a)},t.hash_to_ristretto255=t.hashToRistretto255},7320:(e,t)=>{"use strict";function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function r(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function i(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function o(e,...t){if(!i(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function a(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");n(e.outputLen),n(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function c(e,t){o(e);const n=t.outputLen;if(e.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HashMD=t.Maj=t.Chi=void 0;const r=n(7320),i=n(8089);t.Chi=(e,t,n)=>e&t^~e&n,t.Maj=(e,t,n)=>e&t^e&n^t&n;class o extends i.Hash{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,i.createView)(this.buffer)}update(e){(0,r.exists)(this);const{view:t,buffer:n,blockLen:o}=this,a=(e=(0,i.toBytes)(e)).length;for(let r=0;ro-s&&(this.process(n,0),s=0);for(let e=s;e>i&o),s=Number(n&o),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,s,r)}(n,o-8,BigInt(8*this.length),a),this.process(n,0);const c=(0,i.createView)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add5L=t.add5H=t.add4H=t.add4L=t.add3H=t.add3L=t.add=t.rotlBL=t.rotlBH=t.rotlSL=t.rotlSH=t.rotr32L=t.rotr32H=t.rotrBL=t.rotrBH=t.rotrSL=t.rotrSH=t.shrSL=t.shrSH=t.toBig=t.split=t.fromBig=void 0;const n=BigInt(2**32-1),r=BigInt(32);function i(e,t=!1){return t?{h:Number(e&n),l:Number(e>>r&n)}:{h:0|Number(e>>r&n),l:0|Number(e&n)}}function o(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;oBigInt(e>>>0)<>>0);t.toBig=a;const s=(e,t,n)=>e>>>n;t.shrSH=s;const c=(e,t,n)=>e<<32-n|t>>>n;t.shrSL=c;const u=(e,t,n)=>e>>>n|t<<32-n;t.rotrSH=u;const l=(e,t,n)=>e<<32-n|t>>>n;t.rotrSL=l;const d=(e,t,n)=>e<<64-n|t>>>n-32;t.rotrBH=d;const f=(e,t,n)=>e>>>n-32|t<<64-n;t.rotrBL=f;const h=(e,t)=>t;t.rotr32H=h;const p=(e,t)=>e;t.rotr32L=p;const y=(e,t,n)=>e<>>32-n;t.rotlSH=y;const m=(e,t,n)=>t<>>32-n;t.rotlSL=m;const g=(e,t,n)=>t<>>64-n;t.rotlBH=g;const b=(e,t,n)=>e<>>64-n;function v(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}t.rotlBL=b,t.add=v;const w=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);t.add3L=w;const _=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;t.add3H=_;const E=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);t.add4L=E;const S=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;t.add4H=S;const A=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);t.add5L=A;const k=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0;t.add5H=k;const x={fromBig:i,split:o,toBig:a,shrSH:s,shrSL:c,rotrSH:u,rotrSL:l,rotrBH:d,rotrBL:f,rotr32H:h,rotr32L:p,rotlSH:y,rotlSL:m,rotlBH:g,rotlBL:b,add:v,add3L:w,add3H:_,add4L:E,add4H:S,add5H:k,add5L:A};t.default=x},1945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},6262:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha384=t.sha512_256=t.sha512_224=t.sha512=t.SHA512=void 0;const r=n(5457),i=n(6873),o=n(8089),[a,s]=(()=>i.default.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((e=>BigInt(e)))))(),c=new Uint32Array(80),u=new Uint32Array(80);class l extends r.HashMD{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:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:a,Dl:s,Eh:c,El:u,Fh:l,Fl:d,Gh:f,Gl:h,Hh:p,Hl:y}=this;return[e,t,n,r,i,o,a,s,c,u,l,d,f,h,p,y]}set(e,t,n,r,i,o,a,s,c,u,l,d,f,h,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|d,this.Gh=0|f,this.Gl=0|h,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let n=0;n<16;n++,t+=4)c[n]=e.getUint32(t),u[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|c[e-15],n=0|u[e-15],r=i.default.rotrSH(t,n,1)^i.default.rotrSH(t,n,8)^i.default.shrSH(t,n,7),o=i.default.rotrSL(t,n,1)^i.default.rotrSL(t,n,8)^i.default.shrSL(t,n,7),a=0|c[e-2],s=0|u[e-2],l=i.default.rotrSH(a,s,19)^i.default.rotrBH(a,s,61)^i.default.shrSH(a,s,6),d=i.default.rotrSL(a,s,19)^i.default.rotrBL(a,s,61)^i.default.shrSL(a,s,6),f=i.default.add4L(o,d,u[e-7],u[e-16]),h=i.default.add4H(f,r,l,c[e-7],c[e-16]);c[e]=0|h,u[e]=0|f}let{Ah:n,Al:r,Bh:o,Bl:l,Ch:d,Cl:f,Dh:h,Dl:p,Eh:y,El:m,Fh:g,Fl:b,Gh:v,Gl:w,Hh:_,Hl:E}=this;for(let e=0;e<80;e++){const t=i.default.rotrSH(y,m,14)^i.default.rotrSH(y,m,18)^i.default.rotrBH(y,m,41),S=i.default.rotrSL(y,m,14)^i.default.rotrSL(y,m,18)^i.default.rotrBL(y,m,41),A=y&g^~y&v,k=m&b^~m&w,x=i.default.add5L(E,S,k,s[e],u[e]),O=i.default.add5H(x,_,t,A,a[e],c[e]),I=0|x,R=i.default.rotrSH(n,r,28)^i.default.rotrBH(n,r,34)^i.default.rotrBH(n,r,39),T=i.default.rotrSL(n,r,28)^i.default.rotrBL(n,r,34)^i.default.rotrBL(n,r,39),P=n&o^n&d^o&d,C=r&l^r&f^l&f;_=0|v,E=0|w,v=0|g,w=0|b,g=0|y,b=0|m,({h:y,l:m}=i.default.add(0|h,0|p,0|O,0|I)),h=0|d,p=0|f,d=0|o,f=0|l,o=0|n,l=0|r;const N=i.default.add3L(I,T,C);n=i.default.add3H(N,O,R,P),r=0|N}({h:n,l:r}=i.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:o,l}=i.default.add(0|this.Bh,0|this.Bl,0|o,0|l)),({h:d,l:f}=i.default.add(0|this.Ch,0|this.Cl,0|d,0|f)),({h,l:p}=i.default.add(0|this.Dh,0|this.Dl,0|h,0|p)),({h:y,l:m}=i.default.add(0|this.Eh,0|this.El,0|y,0|m)),({h:g,l:b}=i.default.add(0|this.Fh,0|this.Fl,0|g,0|b)),({h:v,l:w}=i.default.add(0|this.Gh,0|this.Gl,0|v,0|w)),({h:_,l:E}=i.default.add(0|this.Hh,0|this.Hl,0|_,0|E)),this.set(n,r,o,l,d,f,h,p,y,m,g,b,v,w,_,E)}roundClean(){c.fill(0),u.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)}}t.SHA512=l;class d extends l{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class f extends l{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class h extends l{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}t.sha512=(0,o.wrapConstructor)((()=>new l)),t.sha512_224=(0,o.wrapConstructor)((()=>new d)),t.sha512_256=(0,o.wrapConstructor)((()=>new f)),t.sha384=(0,o.wrapConstructor)((()=>new h))},8089:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.byteSwap32=t.byteSwapIfBE=t.byteSwap=t.isLE=t.rotl=t.rotr=t.createView=t.u32=t.u8=t.isBytes=void 0;const r=n(1945),i=n(7320);t.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name},t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.rotl=(e,t)=>e<>>32-t>>>0,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,t.byteSwapIfBE=t.isLE?e=>e:e=>(0,t.byteSwap)(e),t.byteSwap32=function(e){for(let n=0;nt.toString(16).padStart(2,"0")));t.bytesToHex=function(e){(0,i.bytes)(e);let t="";for(let n=0;n=a&&e<=s?e-a:e>=c&&e<=u?e-(c-10):e>=l&&e<=d?e-(l-10):void 0}function h(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function p(e){return"string"==typeof e&&(e=h(e)),(0,i.bytes)(e),e}t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,i=0;t{},t.asyncLoop=async function(e,n,r){let i=Date.now();for(let o=0;o=0&&ee().update(p(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(p(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(p(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(r.crypto&&"function"==typeof r.crypto.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},7665:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n>>0,u=new Uint8Array(o);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var d=0,f=o-1;(0!==l||d>>0,u[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,n++}for(var h=o-i;h!==o&&0===u[h];)h++;for(var p=new Uint8Array(r+(o-h)),y=r;h!==o;)p[y++]=u[h++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var c=(o-i)*u+1>>>0,l=new Uint8Array(c);i!==o;){for(var d=t[i],f=0,h=c-1;(0!==d||f>>0,l[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=c-r;p!==c&&0===l[p];)p++;for(var y=s.repeat(n);p{const r=n(7665);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},9386:(e,t,n)=>{"use strict";t._O=t.Jq=t.KB=t.u8=t.cv=void 0,t.Ik=t.A9=t.n_=t.gM=void 0;const r=n(8764);function i(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function o(e){return i(e),r.Buffer.from(e.buffer,e.byteOffset,e.length)}class a{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function s(e,t){return t.property?e+"["+t.property+"]":e}class c extends a{isCount(){throw new Error("ExternalLayout is abstract")}}class u extends c{constructor(e,t=0,n){if(!(e instanceof a))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof l||this.layout instanceof d}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,n=0){return this.layout.encode(e,t,n+this.offset)}}class l extends a{constructor(e,t){if(super(e,t),6e+r.encode(i,t,n+e)),0);return this.count instanceof c&&this.count.encode(e.length,t,n),i}}class b extends a{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof a),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t=0){i(e);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n=0){const r=n;let i=0,o=0;for(const r of this.fields){let a=r.span;if(o=0a&&(a=r.getSpan(t,n)))}i=n,n+=a}return i+o-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?t=-1:0<=t&&(t+=n.span)}}}class v extends a{constructor(e,t){if(!(e instanceof c&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof c||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t=0){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),o(e).slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof c&&(r=e.length),!(e instanceof Uint8Array&&r===e.length))throw new TypeError(s("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>t.length)throw new RangeError("encoding overruns Uint8Array");const i=o(e);return o(t).write(i.toString("hex"),n,r,"hex"),this.length instanceof c&&this.length.encode(r,t,n),r}}t.cv=(e,t,n)=>new u(e,t,n),t.u8=e=>new l(1,e),t.KB=e=>new l(2,e),t.Jq=e=>new l(4,e),t._O=e=>new y(e),t.gM=e=>new m(e),t.n_=(e,t,n)=>new b(e,t,n),t.A9=(e,t,n)=>new g(e,t,n),t.Ik=(e,t)=>new v(e,t)},7581:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Account:()=>un,AddressLookupTableAccount:()=>_r,AddressLookupTableInstruction:()=>mo,AddressLookupTableProgram:()=>go,Authorized:()=>Io,BLOCKHASH_CACHE_TIMEOUT_MS:()=>Or,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>ln,BPF_LOADER_PROGRAM_ID:()=>lr,BpfLoader:()=>dr,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>vo,ComputeBudgetInstruction:()=>bo,ComputeBudgetProgram:()=>wo,Connection:()=>ho,Ed25519Program:()=>Eo,Enum:()=>tn,EpochSchedule:()=>br,FeeCalculatorLayout:()=>er,Keypair:()=>po,LAMPORTS_PER_SOL:()=>Jo,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>yo,Loader:()=>ur,Lockup:()=>Ro,MAX_SEED_LENGTH:()=>on,Message:()=>Rn,MessageAccountKeys:()=>gn,MessageV0:()=>Tn,NONCE_ACCOUNT_LENGTH:()=>nr,NonceAccount:()=>rr,PACKET_DATA_SIZE:()=>dn,PUBLIC_KEY_LENGTH:()=>an,PublicKey:()=>cn,SIGNATURE_LENGTH_IN_BYTES:()=>hn,SOLANA_SCHEMA:()=>nn,STAKE_CONFIG_ID:()=>Oo,STAKE_INSTRUCTION_LAYOUTS:()=>Po,SYSTEM_INSTRUCTION_LAYOUTS:()=>ar,SYSVAR_CLOCK_PUBKEY:()=>zn,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>jn,SYSVAR_INSTRUCTIONS_PUBKEY:()=>Un,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>Fn,SYSVAR_RENT_PUBKEY:()=>Wn,SYSVAR_REWARDS_PUBKEY:()=>Hn,SYSVAR_SLOT_HASHES_PUBKEY:()=>qn,SYSVAR_SLOT_HISTORY_PUBKEY:()=>Kn,SYSVAR_STAKE_HISTORY_PUBKEY:()=>Gn,Secp256k1Program:()=>ko,SendTransactionError:()=>$n,SolanaJSONRPCError:()=>Zn,SolanaJSONRPCErrorCode:()=>Vn,StakeAuthorizationLayout:()=>Co,StakeInstruction:()=>To,StakeProgram:()=>No,Struct:()=>en,SystemInstruction:()=>or,SystemProgram:()=>sr,Transaction:()=>Mn,TransactionExpiredBlockheightExceededError:()=>pn,TransactionExpiredNonceInvalidError:()=>mn,TransactionExpiredTimeoutError:()=>yn,TransactionInstruction:()=>Bn,TransactionMessage:()=>Ln,TransactionStatus:()=>Cn,VALIDATOR_INFO_KEY:()=>jo,VERSION_PREFIX_MASK:()=>fn,VOTE_PROGRAM_ID:()=>Wo,ValidatorInfo:()=>Fo,VersionedMessage:()=>Pn,VersionedTransaction:()=>Dn,VoteAccount:()=>qo,VoteAuthorizationLayout:()=>Do,VoteInit:()=>Bo,VoteInstruction:()=>Mo,VoteProgram:()=>zo,clusterApiUrl:()=>Zo,sendAndConfirmRawTransaction:()=>Yo,sendAndConfirmTransaction:()=>Yn});var r={};n.r(r),n.d(r,{gk:()=>k,dQ:()=>z,ci:()=>O,bytesToNumberBE:()=>C,ty:()=>N,eV:()=>D,n$:()=>F,ql:()=>L,hexToBytes:()=>P,_t:()=>A,tL:()=>B,S5:()=>M,FF:()=>H});var i=n(8764),o=n(4359);const a=BigInt(2**32-1),s=BigInt(32);function c(e,t=!1){return t?{h:Number(e&a),l:Number(e>>s&a)}:{h:0|Number(e>>s&a),l:0|Number(e&a)}}function u(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;ie<>>32-n,d=(e,t,n)=>t<>>32-n,f=(e,t,n)=>t<>>64-n,h=(e,t,n)=>e<>>64-n,p={fromBig:c,split:u,toBig:(e,t)=>BigInt(e>>>0)<>>0),shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:l,rotlSL:d,rotlBH:f,rotlBL:h,add:function(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}},add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5H:(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,add5L:(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0)};var y=n(3486);const[m,g]=(()=>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((e=>BigInt(e)))))(),b=new Uint32Array(80),v=new Uint32Array(80);class w 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:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:a,Dl:s,Eh:c,El:u,Fh:l,Fl:d,Gh:f,Gl:h,Hh:p,Hl:y}=this;return[e,t,n,r,i,o,a,s,c,u,l,d,f,h,p,y]}set(e,t,n,r,i,o,a,s,c,u,l,d,f,h,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|d,this.Gh=0|f,this.Gl=0|h,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let n=0;n<16;n++,t+=4)b[n]=e.getUint32(t),v[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|b[e-15],n=0|v[e-15],r=p.rotrSH(t,n,1)^p.rotrSH(t,n,8)^p.shrSH(t,n,7),i=p.rotrSL(t,n,1)^p.rotrSL(t,n,8)^p.shrSL(t,n,7),o=0|b[e-2],a=0|v[e-2],s=p.rotrSH(o,a,19)^p.rotrBH(o,a,61)^p.shrSH(o,a,6),c=p.rotrSL(o,a,19)^p.rotrBL(o,a,61)^p.shrSL(o,a,6),u=p.add4L(i,c,v[e-7],v[e-16]),l=p.add4H(u,r,s,b[e-7],b[e-16]);b[e]=0|l,v[e]=0|u}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:a,Cl:s,Dh:c,Dl:u,Eh:l,El:d,Fh:f,Fl:h,Gh:y,Gl:w,Hh:_,Hl:E}=this;for(let e=0;e<80;e++){const t=p.rotrSH(l,d,14)^p.rotrSH(l,d,18)^p.rotrBH(l,d,41),S=p.rotrSL(l,d,14)^p.rotrSL(l,d,18)^p.rotrBL(l,d,41),A=l&f^~l&y,k=d&h^~d&w,x=p.add5L(E,S,k,g[e],v[e]),O=p.add5H(x,_,t,A,m[e],b[e]),I=0|x,R=p.rotrSH(n,r,28)^p.rotrBH(n,r,34)^p.rotrBH(n,r,39),T=p.rotrSL(n,r,28)^p.rotrBL(n,r,34)^p.rotrBL(n,r,39),P=n&i^n&a^i&a,C=r&o^r&s^o&s;_=0|y,E=0|w,y=0|f,w=0|h,f=0|l,h=0|d,({h:l,l:d}=p.add(0|c,0|u,0|O,0|I)),c=0|a,u=0|s,a=0|i,s=0|o,i=0|n,o=0|r;const N=p.add3L(I,T,C);n=p.add3H(N,O,R,P),r=0|N}({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:a,l:s}=p.add(0|this.Ch,0|this.Cl,0|a,0|s)),({h:c,l:u}=p.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:d}=p.add(0|this.Eh,0|this.El,0|l,0|d)),({h:f,l:h}=p.add(0|this.Fh,0|this.Fl,0|f,0|h)),({h:y,l:w}=p.add(0|this.Gh,0|this.Gl,0|y,0|w)),({h:_,l:E}=p.add(0|this.Hh,0|this.Hl,0|_,0|E)),this.set(n,r,i,o,a,s,c,u,l,d,f,h,y,w,_,E)}roundClean(){b.fill(0),v.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 _=(0,y.hE)((()=>new w)),E=(BigInt(0),BigInt(1)),S=BigInt(2);function A(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function k(e){if(!A(e))throw new Error("Uint8Array expected")}const x=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function O(e){k(e);let t="";for(let n=0;n=R._0&&e<=R._9?e-R._0:e>=R._A&&e<=R._F?e-(R._A-10):e>=R._a&&e<=R._f?e-(R._a-10):void 0}function P(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,i=0;t(S<new Uint8Array(e),U=e=>Uint8Array.from(e);function F(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=j(e),i=j(e),o=0;const a=()=>{r.fill(1),i.fill(0),o=0},s=(...e)=>n(i,r,...e),c=(e=j())=>{i=s(U([0]),e),r=s(),0!==e.length&&(i=s(U([1]),e),r=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e{let n;for(a(),c(e);!(n=t(u()));)c();return a(),n}}const W={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||A(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function H(e,t,n={}){const r=(t,n,r)=>{const i=W[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=e[t];if(!(r&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${n}`)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e}const q=BigInt(0),K=BigInt(1),G=BigInt(2),$=BigInt(3),V=BigInt(4),Z=BigInt(5),Y=BigInt(8);function J(e,t){const n=e%t;return n>=q?n:t+n}function X(e,t,n){if(n<=q||t 0");if(n===K)return q;let r=K;for(;t>q;)t&K&&(r=r*e%n),e=e*e%n,t>>=K;return r}function Q(e,t,n){let r=e;for(;t-- >q;)r*=r,r%=n;return r}function ee(e,t){if(e===q||t<=q)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=J(e,t),r=t,i=q,o=K,a=K,s=q;for(;n!==q;){const e=r/n,t=r%n,c=i-a*e,u=o-s*e;r=n,n=t,i=a,o=s,a=c,s=u}if(r!==K)throw new Error("invert: does not exist");return J(i,t)}BigInt(9),BigInt(16);const te=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ne(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function re(e,t,n=!1,r={}){if(e<=q)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=ne(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=function(e){if(e%V===$){const t=(e+K)/V;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%Y===Z){const t=(e-Z)/Y;return function(e,n){const r=e.mul(n,G),i=e.pow(r,t),o=e.mul(n,i),a=e.mul(e.mul(o,G),i),s=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),n))throw new Error("Cannot find square root");return s}}return function(e){const t=(e-K)/G;let n,r,i;for(n=e-K,r=0;n%G===q;n/=G,r++);for(i=G;iJ(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return q<=t&&te===q,isOdd:e=>(e&K)===K,neg:t=>J(-t,e),eql:(e,t)=>e===t,sqr:t=>J(t*t,e),add:(t,n)=>J(t+n,e),sub:(t,n)=>J(t-n,e),mul:(t,n)=>J(t*n,e),pow:(e,t)=>function(e,t,n){if(n 0");if(n===q)return e.ONE;if(n===K)return t;let r=e.ONE,i=t;for(;n>q;)n&K&&(r=e.mul(r,i)),i=e.sqr(i),n>>=K;return r}(s,e,t),div:(t,n)=>J(t*ee(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>ee(t,e),sqrt:r.sqrt||(e=>a(s,e)),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce(((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r))),e.ONE),i=e.inv(r);return t.reduceRight(((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r))),i),n}(s,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?M(e,o):B(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?N(e):C(e)}});return Object.freeze(s)}function ie(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function oe(e){const t=ie(e);return t+Math.ceil(t/2)}const ae=BigInt(0),se=BigInt(1);function ce(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>ae;)n&se&&(r=r.add(i)),i=i.double(),n>>=se;return r},precomputeWindow(e,t){const{windows:n,windowSize:i}=r(t),o=[];let a=e,s=a;for(let e=0;e>=f,r>s&&(r-=d,o+=se);const a=t,h=t+Math.abs(r)-1,p=e%2!=0,y=r<0;0===r?u=u.add(n(p,i[a])):c=c.add(n(y,i[h]))}return{p:c,f:u}},wNAFCached(e,t,n,r){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,r(o))),this.wNAF(i,o,n)}}}function ue(e){return H(e.Fp,te.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),H(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ne(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const le=BigInt(0),de=BigInt(1),fe=BigInt(2),he=BigInt(8),pe={zip215:!0};function ye(e){const t=function(e){const t=ue(e);return H(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:r,prehash:i,hash:o,randomBytes:a,nByteLength:s,h:c}=t,u=fe<{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(e){return{isValid:!1,value:le}}}),f=t.adjustScalarBytes||(e=>e),h=t.domain||((e,t,n)=>{if(t.length||n)throw new Error("Contexts/pre-hash are not supported");return e}),p=e=>"bigint"==typeof e&&lep(e)&&p(t)&&ee===le||y(e,u);function g(e,t){if(y(e,t))return e;throw new Error(`Expected valid scalar < ${t}, got ${typeof e} ${e}`)}function b(e){return e===le?e:g(e,r)}const v=new Map;function w(e){if(!(e instanceof _))throw new Error("ExtendedPoint expected")}class _{constructor(e,t,n,r){if(this.ex=e,this.ey=t,this.ez=n,this.et=r,!m(e))throw new Error("x required");if(!m(t))throw new Error("y required");if(!m(n))throw new Error("z required");if(!m(r))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof _)throw new Error("extended point not allowed");const{x:t,y:n}=e||{};if(!m(t)||!m(n))throw new Error("invalid affine point");return new _(t,n,de,l(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.ez)));return e.map(((e,n)=>e.toAffine(t[n]))).map(_.fromAffine)}_setWindowSize(e){this._WINDOW_SIZE=e,v.delete(this)}assertValidity(){const{a:e,d:n}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:a}=this,s=l(r*r),c=l(i*i),u=l(o*o),d=l(u*u),f=l(s*e);if(l(u*l(f+c))!==l(d+l(n*l(s*c))))throw new Error("bad point: equation left != right (1)");if(l(r*i)!==l(o*a))throw new Error("bad point: equation left != right (2)")}equals(e){w(e);const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:a}=e,s=l(t*a),c=l(i*r),u=l(n*a),d=l(o*r);return s===c&&u===d}is0(){return this.equals(_.ZERO)}negate(){return new _(l(-this.ex),this.ey,this.ez,l(-this.et))}double(){const{a:e}=t,{ex:n,ey:r,ez:i}=this,o=l(n*n),a=l(r*r),s=l(fe*l(i*i)),c=l(e*o),u=n+r,d=l(l(u*u)-o-a),f=c+a,h=f-s,p=c-a,y=l(d*h),m=l(f*p),g=l(d*p),b=l(h*f);return new _(y,m,b,g)}add(e){w(e);const{a:n,d:r}=t,{ex:i,ey:o,ez:a,et:s}=this,{ex:c,ey:u,ez:d,et:f}=e;if(n===BigInt(-1)){const e=l((o-i)*(u+c)),t=l((o+i)*(u-c)),n=l(t-e);if(n===le)return this.double();const r=l(a*fe*f),h=l(s*fe*d),p=h+r,y=t+e,m=h-r,g=l(p*n),b=l(y*m),v=l(p*m),w=l(n*y);return new _(g,b,w,v)}const h=l(i*c),p=l(o*u),y=l(s*r*f),m=l(a*d),g=l((i+o)*(c+u)-h-p),b=m-y,v=m+y,E=l(p-n*h),S=l(g*b),A=l(v*E),k=l(g*E),x=l(b*v);return new _(S,A,x,k)}subtract(e){return this.add(e.negate())}wNAF(e){return A.wNAFCached(this,v,e,_.normalizeZ)}multiply(e){const{p:t,f:n}=this.wNAF(g(e,r));return _.normalizeZ([t,n])[0]}multiplyUnsafe(e){let t=b(e);return t===le?S:this.equals(S)||t===de?this:this.equals(E)?this.wNAF(t).p:A.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(e){const{ex:t,ey:r,ez:i}=this,o=this.is0();null==e&&(e=o?he:n.inv(i));const a=l(t*e),s=l(r*e),c=l(i*e);if(o)return{x:le,y:de};if(c!==de)throw new Error("invZ was invalid");return{x:a,y:s}}clearCofactor(){const{h:e}=t;return e===de?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){const{d:i,a:o}=t,a=n.BYTES,s=(e=L("pointHex",e,a)).slice(),c=e[a-1];s[a-1]=-129&c;const f=N(s);f===le||g(f,r?u:n.ORDER);const h=l(f*f),p=l(h-de),y=l(i*h-o);let{isValid:m,value:b}=d(p,y);if(!m)throw new Error("Point.fromHex: invalid y coordinate");const v=(b&de)===de,w=!!(128&c);if(!r&&b===le&&w)throw new Error("Point.fromHex: x=0 and x_0=1");return w!==v&&(b=l(-b)),_.fromAffine({x:b,y:f})}static fromPrivateKey(e){return I(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=M(t,n.BYTES);return r[r.length-1]|=e&de?128:0,r}toHex(){return O(this.toRawBytes())}}_.BASE=new _(t.Gx,t.Gy,de,l(t.Gx*t.Gy)),_.ZERO=new _(le,de,de,le);const{BASE:E,ZERO:S}=_,A=ce(_,8*s);function k(e){return J(e,r)}function x(e){return k(N(e))}function I(e){const t=s;e=L("private key",e,t);const n=L("hashed private key",o(e),2*t),r=f(n.slice(0,t)),i=n.slice(t,2*t),a=x(r),c=E.multiply(a),u=c.toRawBytes();return{head:r,prefix:i,scalar:a,point:c,pointBytes:u}}function R(e=new Uint8Array,...t){const n=D(...t);return x(o(h(n,L("context",e),!!i)))}const T=pe;return E._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return I(e).pointBytes},sign:function(e,t,r={}){e=L("message",e),i&&(e=i(e));const{prefix:o,scalar:a,pointBytes:c}=I(t),u=R(r.context,o,e),l=E.multiply(u).toRawBytes(),d=k(u+R(r.context,l,c,e)*a);return b(d),L("result",D(l,M(d,n.BYTES)),2*s)},verify:function(e,t,r,o=T){const{context:a,zip215:s}=o,c=n.BYTES;e=L("signature",e,2*c),t=L("message",t),i&&(t=i(t));const u=N(e.slice(c,2*c));let l,d,f;try{l=_.fromHex(r,s),d=_.fromHex(e.slice(0,c),s),f=E.multiplyUnsafe(u)}catch(e){return!1}if(!s&&l.isSmallOrder())return!1;const h=R(a,d.toRawBytes(),l.toRawBytes(),t);return d.add(l.multiplyUnsafe(h)).subtract(f).clearCofactor().equals(_.ZERO)},ExtendedPoint:_,utils:{getExtendedPublicKey:I,randomPrivateKey:()=>a(n.BYTES),precompute:(e=8,t=_.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}const me=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ge=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),be=(BigInt(0),BigInt(1)),ve=BigInt(2),we=BigInt(5),_e=BigInt(10),Ee=BigInt(20),Se=BigInt(40),Ae=BigInt(80);const ke=re(me,void 0,!0),xe=ye({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ke,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:_,randomBytes:y.O6,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:function(e,t){const n=me,r=J(t*t*t,n),i=J(r*r*t,n);let o=J(e*r*function(e){const t=me,n=e*e%t*e%t,r=Q(n,ve,t)*n%t,i=Q(r,be,t)*e%t,o=Q(i,we,t)*i%t,a=Q(o,_e,t)*o%t,s=Q(a,Ee,t)*a%t,c=Q(s,Se,t)*s%t,u=Q(c,Ae,t)*c%t,l=Q(u,Ae,t)*c%t,d=Q(l,_e,t)*o%t;return{pow_p_5_8:Q(d,ve,t)*e%t,b2:n}}(e*i).pow_p_5_8,n);const a=J(t*o*o,n),s=o,c=J(o*ge,n),u=a===e,l=a===J(-e,n),d=a===J(-e*ge,n);return u&&(o=s),(l||d)&&(o=c),(J(o,n)&K)===K&&(o=J(-o,n)),{isValid:u||l,value:o}}});const Oe=(ke.ORDER+BigInt(3))/BigInt(8);ke.pow(ve,Oe),ke.sqrt(ke.neg(ke.ONE)),ke.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);e.isOdd(n)&&e.neg(n)}(ke,ke.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Ie=n(3550),Re=n.n(Ie),Te=n(7191),Pe=n.n(Te),Ce=n(7748),Ne=n(5532),Be=n(9386),Me=n(475);class Le extends TypeError{constructor(e,t){let n;const{message:r,explanation:i,...o}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function De(e){return"object"==typeof e&&null!=e}function ze(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function je(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${ze(r)}\``}=e;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*Ue(e,t,n,r){var i;De(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const i of e){const e=je(i,t,n,r);e&&(yield e)}}function*Fe(e,t,n={}){const{path:r=[],branch:i=[e],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&De(t.schema)&&De(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=Fe(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?i:[...i,l],coerce:o,mask:a,message:n.message});for(const n of t)n[0]?(c=null!=n[0].refinement?"not_refined":"not_valid",yield[n[0],void 0]):o&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):De(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class We{constructor(e){const{type:t,schema:n,validator:r,refiner:i,coercer:o=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(e,t)=>Ue(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>Ue(i(e,t),t,this,e):()=>[]}assert(e,t){return He(e,this,t)}create(e,t){return qe(e,this,t)}is(e){return Ke(e,this)}mask(e,t){return function(e,t,n){const r=Ge(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return Ge(e,this,t)}}function He(e,t,n){const r=Ge(e,t,{message:n});if(r[0])throw r[0]}function qe(e,t,n){const r=Ge(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function Ke(e,t){return!Ge(e,t)[0]}function Ge(e,t,n={}){const r=Fe(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);return i[0]?[new Le(i[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]:[void 0,i[1]]}function $e(e,t){return new We({type:e,schema:null,validator:t})}function Ve(e){return new We({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${ze(e)}`})}function Ze(){return $e("boolean",(e=>"boolean"==typeof e))}function Ye(e){return $e("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ze(t)}`))}function Je(e){const t=ze(e),n=typeof e;return new We({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${ze(n)}`})}function Xe(e){return new We({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function Qe(){return $e("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${ze(e)}`))}function et(e){return new We({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function tt(e,t){return new We({type:"record",schema:null,*entries(n){if(De(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>De(e)||`Expected an object, but received: ${ze(e)}`})}function nt(){return $e("string",(e=>"string"==typeof e||`Expected a string, but received: ${ze(e)}`))}function rt(e){const t=$e("never",(()=>!1));return new We({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let i=0;iArray.isArray(e)||`Expected an array, but received: ${ze(e)}`})}function it(e){const t=Object.keys(e);return new We({type:"type",schema:e,*entries(n){if(De(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>De(e)||`Expected an object, but received: ${ze(e)}`,coercer:e=>De(e)?{...e}:e})}function ot(e){const t=e.map((e=>e.type)).join(" | ");return new We({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const i=[];for(const t of e){const[...e]=Fe(n,t,r),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ze(n)}`,...i]}})}function at(){return $e("unknown",(()=>!0))}function st(e,t,n){return new We({...e,coercer:(r,i)=>Ke(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}var ct=n(1198),ut=n.n(ct),lt=n(4790),dt=class extends lt{socket;constructor(e,t,n){super(),this.socket=new window.WebSocket(e,n),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,n){const r=n||t;try{this.socket.send(e),r()}catch(e){r(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,n){this.socket.addEventListener(e,t,n)}};var ft=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},ht=class extends lt{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(e,t="ws://localhost:8080",{autoconnect:n=!0,reconnect:r=!0,reconnect_interval:i=1e3,max_reconnects:o=5,...a}={},s,c){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=n,this.ready=!1,this.reconnect=r,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=o,this.rest_options=a,this.current_reconnects=0,this.generate_request_id=s||(()=>++this.rpc_id),this.dataPack=c||new ft,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(e,t,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 a=this.generate_request_id(e,t),s={jsonrpc:"2.0",method:e,params:t||void 0,id:a};this.socket.send(this.dataPack.encode(s),r,(e=>{if(e)return o(e);this.queue[a]={promise:[i,o]},n&&(this.queue[a].timeout=setTimeout((()=>{delete this.queue[a],o(new Error("reply timeout"))}),n))}))}))}async login(e){const t=await this.call("rpc.login",e);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise(((n,r)=>{if(!this.ready)return r(new Error("socket not ready"));const i={jsonrpc:"2.0",method:e,params:t};this.socket.send(this.dataPack.encode(i),(e=>{if(e)return r(e);n()}))}))}async subscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",(()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0})),this.socket.addEventListener("message",(({data:e})=>{e instanceof ArrayBuffer&&(e=i.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch(e){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);const t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let n=0;n{this.emit.apply(this,t)}))}if(!this.queue[e.id])return e.method?Promise.resolve().then((()=>{this.emit(e.method,e?.params)})):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]})),this.socket.addEventListener("error",(e=>this.emit("error",e))),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(e,t)),this.reconnect_interval)))}))}},pt=n(3527);const yt=[],mt=[],gt=[],bt=BigInt(0),vt=BigInt(1),wt=BigInt(2),_t=BigInt(7),Et=BigInt(256),St=BigInt(113);for(let e=0,t=vt,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],yt.push(2*(5*r+n)),mt.push((e+1)*(e+2)/2%64);let i=bt;for(let e=0;e<7;e++)t=(t<>_t)*St)%Et,t&wt&&(i^=vt<<(vt<n>32?f(e,t,n):l(e,t,n),Ot=(e,t,n)=>n>32?h(e,t,n):d(e,t,n);class It extends y.kb{constructor(e,t,n,r=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,pt.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,y.Jq)(this.state)}keccak(){y.iA||(0,y.l1)(this.state32),function(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,i=(t+2)%10,o=n[i],a=n[i+1],s=xt(o,a,1)^n[r],c=Ot(o,a,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=mt[n],o=xt(t,i,r),a=Ot(t,i,r),s=yt[n];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=At[r],e[1]^=kt[r]}n.fill(0)}(this.state32,this.rounds),y.iA||(0,y.l1)(this.state32),this.posOut=0,this.pos=0}update(e){(0,pt.Gg)(this);const{blockLen:t,state:n}=this,r=(e=(0,y.O0)(e)).length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,pt.Rx)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,pt.J8)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new It(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Rt=((e,t,n)=>(0,y.hE)((()=>new It(t,e,n))))(1,136,32);class Tt extends y.kb{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,pt.vp)(e);const n=(0,y.O0)(t);if(this.iHash=e.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?e.create().update(n).digest():n);for(let e=0;enew Tt(e,t).update(n).digest();Pt.create=(e,t)=>new Tt(e,t);const{bytesToNumberBE:Ct,hexToBytes:Nt}=r,Bt={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=Bt;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(128&r[0])throw new t("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Ct(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=Bt,n="string"==typeof e?Nt(e):e;k(n);let r=n.length;if(r<2||48!=n[0])throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=Bt._parseInt(n.subarray(2)),{d:a,l:s}=Bt._parseInt(o);if(s.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,n=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},r=t(n(e.s)),i=t(n(e.r)),o=r.length/2,a=i.length/2,s=n(o),c=n(a);return`30${n(a+o+4)}02${c}${i}02${s}${r}`}},Mt=BigInt(0),Lt=BigInt(1),Dt=(BigInt(2),BigInt(3));function zt(e){const t=function(e){const t=ue(e);return H(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r}=t,i=n.BYTES+1,o=2*n.BYTES+1;function a(e){return J(e,r)}function s(e){return ee(e,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:d}=function(e){const t=function(e){const t=ue(e);H(t,{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}=t;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({...t})}(e),{Fp:n}=t,r=t.toBytes||((e,t,r)=>{const i=t.toAffine();return D(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function o(e){const{a:r,b:i}=t,o=n.sqr(e),a=n.mul(o,e);return n.add(n.add(a,n.mul(e,r)),i)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){return"bigint"==typeof e&&Mtn.eql(e,n.ZERO);return i(t)&&i(r)?d.ZERO:new d(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(d.fromAffine)}static fromHex(e){const t=d.fromAffine(i(L("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:r}=this.toAffine();if(!n.isValid(e)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),a=o(e);if(!n.eql(i,a))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:r,pz:i}=this,{px:o,py:a,pz:s}=e,c=n.eql(n.mul(t,s),n.mul(o,i)),u=n.eql(n.mul(r,s),n.mul(a,i));return c&&u}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,i=n.mul(r,Dt),{px:o,py:a,pz:s}=this;let c=n.ZERO,u=n.ZERO,l=n.ZERO,f=n.mul(o,o),h=n.mul(a,a),p=n.mul(s,s),y=n.mul(o,a);return y=n.add(y,y),l=n.mul(o,s),l=n.add(l,l),c=n.mul(e,l),u=n.mul(i,p),u=n.add(c,u),c=n.sub(h,u),u=n.add(h,u),u=n.mul(c,u),c=n.mul(y,c),l=n.mul(i,l),p=n.mul(e,p),y=n.sub(f,p),y=n.mul(e,y),y=n.add(y,l),l=n.add(f,f),f=n.add(l,f),f=n.add(f,p),f=n.mul(f,y),u=n.add(u,f),p=n.mul(a,s),p=n.add(p,p),f=n.mul(p,y),c=n.sub(c,f),l=n.mul(p,h),l=n.add(l,l),l=n.add(l,l),new d(c,u,l)}add(e){l(e);const{px:r,py:i,pz:o}=this,{px:a,py:s,pz:c}=e;let u=n.ZERO,f=n.ZERO,h=n.ZERO;const p=t.a,y=n.mul(t.b,Dt);let m=n.mul(r,a),g=n.mul(i,s),b=n.mul(o,c),v=n.add(r,i),w=n.add(a,s);v=n.mul(v,w),w=n.add(m,g),v=n.sub(v,w),w=n.add(r,o);let _=n.add(a,c);return w=n.mul(w,_),_=n.add(m,b),w=n.sub(w,_),_=n.add(i,o),u=n.add(s,c),_=n.mul(_,u),u=n.add(g,b),_=n.sub(_,u),h=n.mul(p,w),u=n.mul(y,b),h=n.add(u,h),u=n.sub(g,h),h=n.add(g,h),f=n.mul(u,h),g=n.add(m,m),g=n.add(g,m),b=n.mul(p,b),w=n.mul(y,w),g=n.add(g,b),b=n.sub(m,b),b=n.mul(p,b),w=n.add(w,b),m=n.mul(g,w),f=n.add(f,m),m=n.mul(_,w),u=n.mul(v,u),u=n.sub(u,m),m=n.mul(v,g),h=n.mul(_,h),h=n.add(h,m),new d(u,f,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return h.wNAFCached(this,u,e,(e=>{const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(d.fromAffine)}))}multiplyUnsafe(e){const r=d.ZERO;if(e===Mt)return r;if(s(e),e===Lt)return this;const{endo:i}=t;if(!i)return h.unsafeLadder(this,e);let{k1neg:o,k1:a,k2neg:c,k2:u}=i.splitScalar(e),l=r,f=r,p=this;for(;a>Mt||u>Mt;)a&Lt&&(l=l.add(p)),u&Lt&&(f=f.add(p)),p=p.double(),a>>=Lt,u>>=Lt;return o&&(l=l.negate()),c&&(f=f.negate()),f=new d(n.mul(f.px,i.beta),f.py,f.pz),l.add(f)}multiply(e){s(e);let r,i,o=e;const{endo:a}=t;if(a){const{k1neg:e,k1:t,k2neg:s,k2:c}=a.splitScalar(o);let{p:u,f:l}=this.wNAF(t),{p:f,f:p}=this.wNAF(c);u=h.constTimeNegate(e,u),f=h.constTimeNegate(s,f),f=new d(n.mul(f.px,a.beta),f.py,f.pz),r=u.add(f),i=l.add(p)}else{const{p:e,f:t}=this.wNAF(o);r=e,i=t}return d.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(e,t,n){const r=d.BASE,i=(e,t)=>t!==Mt&&t!==Lt&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,n));return o.is0()?void 0:o}toAffine(e){const{px:t,py:r,pz:i}=this,o=this.is0();null==e&&(e=o?n.ONE:n.inv(i));const a=n.mul(t,e),s=n.mul(r,e),c=n.mul(i,e);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===Lt)return!0;if(n)return n(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===Lt?this:n?n(d,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),r(d,this,e)}toHex(e=!0){return O(this.toRawBytes(e))}}d.BASE=new d(t.Gx,t.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);const f=t.nBitLength,h=ce(d,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}({...t,toBytes(e,t,r){const i=t.toAffine(),o=n.toBytes(i.x),a=D;return r?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(e){const t=e.length,r=e[0],a=e.subarray(1);if(t!==i||2!==r&&3!==r){if(t===o&&4===r)return{x:n.fromBytes(a.subarray(0,n.BYTES)),y:n.fromBytes(a.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=C(a);if(!(Mt<(s=e)&&sO(B(e,t.nByteLength));function h(e){return e>r>>Lt}const p=(e,t,n)=>C(e.slice(t,n));class y{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=L("compactSignature",e,2*n),new y(p(e,0,n),p(e,n,2*n))}static fromDER(e){const{r:t,s:n}=Bt.toSig(L("DER",e));return new y(t,n)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new y(this.r,this.s,e)}recoverPublicKey(e){const{r,s:i,recovery:o}=this,u=v(L("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const l=2===o||3===o?r+t.n:r;if(l>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=1&o?"03":"02",h=c.fromHex(d+f(l)),p=s(l),y=a(-u*p),m=a(i*p),g=c.BASE.multiplyAndAddUnsafe(h,y,m);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return P(this.toDERHex())}toDERHex(){return Bt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return P(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const m={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=oe(t.n);return function(e,t,n=!1){const r=e.length,i=ie(t),o=oe(t);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const a=J(n?C(e):N(e),t-K)+K;return n?M(a,i):B(a,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function g(e){const t=A(e),n="string"==typeof e,r=(t||n)&&e.length;return t?r===i||r===o:n?r===2*i||r===2*o:e instanceof c}const b=t.bits2int||function(e){const n=C(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},v=t.bits2int_modN||function(e){return a(b(e))},w=z(t.nBitLength);function _(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(Mt<=e&&ee in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=t;let{lowS:f,prehash:p,extraEntropy:m}=i;null==f&&(f=!0),e=L("msgHash",e),p&&(e=L("prehashed msgHash",o(e)));const g=v(e),w=u(r),S=[_(w),_(g)];if(null!=m&&!1!==m){const e=!0===m?l(n.BYTES):m;S.push(L("extraEntropy",e))}const A=D(...S),k=g;return{seed:A,k2sig:function(e){const t=b(e);if(!d(t))return;const n=s(t),r=c.BASE.multiply(t).toAffine(),i=a(r.x);if(i===Mt)return;const o=a(n*a(k+i*w));if(o===Mt)return;let u=(r.x===i?0:2)|Number(r.y&Lt),l=o;return f&&h(o)&&(l=function(e){return h(e)?a(-e):e}(o),u^=1),new y(i,l,u)}}}(e,r,i),f=t;return F(f.hash.outputLen,f.nByteLength,f.hmac)(o,l)},verify:function(e,n,r,i=S){const o=e;if(n=L("msgHash",n),r=L("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=i;let d,f;try{if("string"==typeof o||A(o))try{d=y.fromDER(o)}catch(e){if(!(e instanceof Bt.Err))throw e;d=y.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;d=new y(e,t)}}f=c.fromHex(r)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&d.hasHighS())return!1;l&&(n=t.hash(n));const{r:h,s:p}=d,m=v(n),g=s(p),b=a(m*g),w=a(h*g),_=c.BASE.multiplyAndAddUnsafe(f,b,w)?.toAffine();return!!_&&a(_.x)===h},ProjectivePoint:c,Signature:y,utils:m}}function jt(e){return{hash:e,hmac:(t,...n)=>Pt(e,t,(0,y.eV)(...n)),randomBytes:y.O6}}BigInt(4);const Ut=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ft=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Wt=BigInt(1),Ht=BigInt(2),qt=(e,t)=>(e+t/Ht)/t;const Kt=re(Ut,void 0,void 0,{sqrt:function(e){const t=Ut,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,d=Q(l,n,t)*l%t,f=Q(d,n,t)*l%t,h=Q(f,Ht,t)*u%t,p=Q(h,i,t)*h%t,y=Q(p,o,t)*p%t,m=Q(y,s,t)*y%t,g=Q(m,c,t)*m%t,b=Q(g,s,t)*y%t,v=Q(b,n,t)*l%t,w=Q(v,a,t)*p%t,_=Q(w,r,t)*u%t,E=Q(_,Ht,t);if(!Kt.eql(Kt.sqr(E),e))throw new Error("Cannot find square root");return E}}),Gt=function(e,t){const n=t=>zt({...e,...jt(t)});return Object.freeze({...n(t),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Kt,n:Ft,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Ft,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Wt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,a=BigInt("0x100000000000000000000000000000000"),s=qt(o*e,t),c=qt(-r*e,t);let u=J(e-s*n-c*i,t),l=J(-s*r-c*o,t);const d=u>a,f=l>a;if(d&&(u=t-u),f&&(l=t-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}}},Ce.J);BigInt(0),Gt.ProjectivePoint;const $t=xe.utils.randomPrivateKey,Vt=()=>{const e=xe.utils.randomPrivateKey(),t=Zt(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),{publicKey:t,secretKey:n}},Zt=xe.getPublicKey;function Yt(e){try{return xe.ExtendedPoint.fromHex(e),!0}catch{return!1}}const Jt=(e,t)=>xe.sign(e,t.slice(0,32)),Xt=xe.verify,Qt=e=>i.Buffer.isBuffer(e)?e:e instanceof Uint8Array?i.Buffer.from(e.buffer,e.byteOffset,e.byteLength):i.Buffer.from(e);class en{constructor(e){Object.assign(this,e)}encode(){return i.Buffer.from((0,Ne.serialize)(nn,this))}static decode(e){return(0,Ne.deserialize)(nn,this,e)}static decodeUnchecked(e){return(0,Ne.deserializeUnchecked)(nn,this,e)}}class tn extends en{constructor(e){if(super(e),this.enum="",1!==Object.keys(e).length)throw new Error("Enum can only take single value");Object.keys(e).map((e=>{this.enum=e}))}}const nn=new Map;var rn;const on=32,an=32;let sn=1;class cn extends en{constructor(e){if(super({}),this._bn=void 0,function(e){return void 0!==e._bn}(e))this._bn=e._bn;else{if("string"==typeof e){const t=Pe().decode(e);if(t.length!=an)throw new Error("Invalid public key input");this._bn=new(Re())(t)}else this._bn=new(Re())(e);if(this._bn.byteLength()>an)throw new Error("Invalid public key input")}}static unique(){const e=new cn(sn);return sn+=1,new cn(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return Pe().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(i.Buffer);if(e.length===an)return e;const t=i.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,n){const r=i.Buffer.concat([e.toBuffer(),i.Buffer.from(t),n.toBuffer()]),o=(0,Ce.J)(r);return new cn(o)}static createProgramAddressSync(e,t){let n=i.Buffer.alloc(0);e.forEach((function(e){if(e.length>on)throw new TypeError("Max seed length exceeded");n=i.Buffer.concat([n,Qt(e)])})),n=i.Buffer.concat([n,t.toBuffer(),i.Buffer.from("ProgramDerivedAddress")]);const r=(0,Ce.J)(n);if(Yt(r))throw new Error("Invalid seeds, address must fall off the curve");return new cn(r)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let n,r=255;for(;0!=r;){try{const o=e.concat(i.Buffer.from([r]));n=this.createProgramAddressSync(o,t)}catch(e){if(e instanceof TypeError)throw e;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return Yt(new cn(e).toBytes())}}rn=cn,cn.default=new rn("11111111111111111111111111111111"),nn.set(cn,{kind:"struct",fields:[["_bn","u256"]]});class un{constructor(e){if(this._publicKey=void 0,this._secretKey=void 0,e){const t=Qt(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=t.slice(32,64),this._secretKey=t.slice(0,32)}else this._secretKey=Qt($t()),this._publicKey=Qt(Zt(this._secretKey))}get publicKey(){return new cn(this._publicKey)}get secretKey(){return i.Buffer.concat([this._secretKey,this._publicKey],64)}}const ln=new cn("BPFLoader1111111111111111111111111111111111"),dn=1232,fn=127,hn=64;class pn extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(pn.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class yn extends Error{constructor(e,t){super(`Transaction was not confirmed in ${t.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=e}}Object.defineProperty(yn.prototype,"name",{value:"TransactionExpiredTimeoutError"});class mn extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(mn.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class gn{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e256)throw new Error("Account index overflow encountered during compilation");const t=new Map;this.keySegments().flat().forEach(((e,n)=>{t.set(e.toBase58(),n)}));const n=e=>{const n=t.get(e.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return e.map((e=>({programIdIndex:n(e.programId),accountKeyIndexes:e.keys.map((e=>n(e.pubkey))),data:e.data})))}}const bn=(e="publicKey")=>Be.Ik(32,e),vn=(e="signature")=>Be.Ik(64,e),wn=(e="string")=>{const t=Be.n_([Be.Jq("length"),Be.Jq("lengthPadding"),Be.Ik(Be.cv(Be.Jq(),-8),"chars")],e),n=t.decode.bind(t),r=t.encode.bind(t),o=t;return o.decode=(e,t)=>n(e,t).chars.toString(),o.encode=(e,t,n)=>{const o={chars:i.Buffer.from(e,"utf8")};return r(o,t,n)},o.alloc=e=>Be.Jq().span+Be.Jq().span+i.Buffer.from(e,"utf8").length,o};function _n(e,t){const n=e=>{if(e.span>=0)return e.span;if("function"==typeof e.alloc)return e.alloc(t[e.property]);if("count"in e&&"elementLayout"in e){const r=t[e.property];if(Array.isArray(r))return r.length*n(e.elementLayout)}else if("fields"in e)return _n({layout:e},t[e.property]);return 0};let r=0;return e.layout.fields.forEach((e=>{r+=n(e)})),r}function En(e){let t=0,n=0;for(;;){let r=e.shift();if(t|=(127&r)<<7*n,n+=1,!(128&r))break}return t}function Sn(e,t){let n=t;for(;;){let t=127&n;if(n>>=7,0==n){e.push(t);break}t|=128,e.push(t)}}function An(e,t){if(!e)throw new Error(t||"Assertion failed")}class kn{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const n=new Map,r=e=>{const t=e.toBase58();let r=n.get(t);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(t,r)),r},i=r(t);i.isSigner=!0,i.isWritable=!0;for(const t of e){r(t.programId).isInvoked=!0;for(const e of t.keys){const t=r(e.pubkey);t.isSigner||=e.isSigner,t.isWritable||=e.isWritable}}return new kn(t,n)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];An(e.length<=256,"Max static account keys length exceeded");const t=e.filter((([,e])=>e.isSigner&&e.isWritable)),n=e.filter((([,e])=>e.isSigner&&!e.isWritable)),r=e.filter((([,e])=>!e.isSigner&&e.isWritable)),i=e.filter((([,e])=>!e.isSigner&&!e.isWritable)),o={numRequiredSignatures:t.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{An(t.length>0,"Expected at least one writable signer key");const[e]=t[0];An(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...t.map((([e])=>new cn(e))),...n.map((([e])=>new cn(e))),...r.map((([e])=>new cn(e))),...i.map((([e])=>new cn(e)))]]}extractTableLookup(e){const[t,n]=this.drainKeysFoundInLookupTable(e.state.addresses,(e=>!e.isSigner&&!e.isInvoked&&e.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(e.state.addresses,(e=>!e.isSigner&&!e.isInvoked&&!e.isWritable));if(0!==t.length||0!==r.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(e,t){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(t(o)){const t=new cn(i),o=e.findIndex((e=>e.equals(t)));o>=0&&(An(o<256,"Max lookup table index exceeded"),n.push(o),r.push(t),this.keyMetaMap.delete(i))}return[n,r]}}const xn="Reached end of buffer unexpectedly";function On(e){if(0===e.length)throw new Error(xn);return e.shift()}function In(e,...t){const[n]=t;if(2===t.length?n+(t[1]??0)>e.length:n>=e.length)throw new Error(xn);return e.splice(...t)}class Rn{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((e=>new cn(e))),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Pe().decode(e.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new gn(this.staticAccountKeys)}static compile(e){const t=kn.compile(e.instructions,e.payerKey),[n,r]=t.getMessageComponents(),i=new gn(r).compileInstructions(e.instructions).map((e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:Pe().encode(e.data)})));return new Rn({header:n,accountKeys:r,recentBlockhash:e.recentBlockhash,instructions:i})}isAccountSigner(e){return e=this.header.numRequiredSignatures?e-t!this.isProgramId(t)))}serialize(){const e=this.accountKeys.length;let t=[];Sn(t,e);const n=this.instructions.map((e=>{const{accounts:t,programIdIndex:n}=e,r=Array.from(Pe().decode(e.data));let o=[];Sn(o,t.length);let a=[];return Sn(a,r.length),{programIdIndex:n,keyIndicesCount:i.Buffer.from(o),keyIndices:t,dataLength:i.Buffer.from(a),data:r}}));let r=[];Sn(r,n.length);let o=i.Buffer.alloc(dn);i.Buffer.from(r).copy(o);let a=r.length;n.forEach((e=>{const t=Be.n_([Be.u8("programIdIndex"),Be.Ik(e.keyIndicesCount.length,"keyIndicesCount"),Be.A9(Be.u8("keyIndex"),e.keyIndices.length,"keyIndices"),Be.Ik(e.dataLength.length,"dataLength"),Be.A9(Be.u8("userdatum"),e.data.length,"data")]).encode(e,o,a);a+=t})),o=o.slice(0,a);const s=Be.n_([Be.Ik(1,"numRequiredSignatures"),Be.Ik(1,"numReadonlySignedAccounts"),Be.Ik(1,"numReadonlyUnsignedAccounts"),Be.Ik(t.length,"keyCount"),Be.A9(bn("key"),e,"keys"),bn("recentBlockhash")]),c={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(t),keys:this.accountKeys.map((e=>Qt(e.toBytes()))),recentBlockhash:Pe().decode(this.recentBlockhash)};let u=i.Buffer.alloc(2048);const l=s.encode(c,u);return o.copy(u,l),u.slice(0,l+o.length)}static from(e){let t=[...e];const n=On(t);if(n!==(n&fn))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=On(t),o=On(t),a=En(t);let s=[];for(let e=0;e0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new gn(this.staticAccountKeys,t)}isAccountSigner(e){return e=n?e-ne+t.writableIndexes.length),0):e>=this.header.numRequiredSignatures?e-te.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const e of n.writableIndexes){if(!(ee.toBytes())),recentBlockhash:Pe().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},a);return a.slice(0,s)}serializeInstructions(){let e=0;const t=new Uint8Array(dn);for(const n of this.compiledInstructions){const r=Array();Sn(r,n.accountKeyIndexes.length);const i=Array();Sn(i,n.data.length),e+=Be.n_([Be.u8("programIdIndex"),Be.Ik(r.length,"encodedAccountKeyIndexesLength"),Be.A9(Be.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),Be.Ik(i.length,"encodedDataLength"),Be.Ik(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0;const t=new Uint8Array(dn);for(const n of this.addressTableLookups){const r=Array();Sn(r,n.writableIndexes.length);const i=Array();Sn(i,n.readonlyIndexes.length),e+=Be.n_([bn("accountKey"),Be.Ik(r.length,"encodedWritableIndexesLength"),Be.A9(Be.u8(),n.writableIndexes.length,"writableIndexes"),Be.Ik(i.length,"encodedReadonlyIndexesLength"),Be.A9(Be.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e];const n=On(t),r=n&fn;An(n!==r,"Expected versioned message but received legacy message"),An(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:On(t),numReadonlySignedAccounts:On(t),numReadonlyUnsignedAccounts:On(t)},o=[],a=En(t);for(let e=0;e{const t=Pn.deserializeMessageVersion(e);if("legacy"===t)return Rn.from(e);if(0===t)return Tn.deserialize(e);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let Cn=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({});const Nn=i.Buffer.alloc(hn).fill(0);class Bn{constructor(e){this.keys=void 0,this.programId=void 0,this.data=i.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map((({pubkey:e,isSigner:t,isWritable:n})=>({pubkey:e.toJSON(),isSigner:t,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class Mn{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){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,e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:n}=e;this.minNonceContextSlot=t,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:n}=e;this.recentBlockhash=t,this.lastValidBlockHeight=n}else{const{recentBlockhash:t,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=t}}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((e=>e.toJSON())),signers:this.signatures.map((({publicKey:e})=>e.toJSON()))}}add(...e){if(0===e.length)throw new Error("No instructions");return e.forEach((e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new Bn(e))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t,n;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.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 e=0;e{e.keys.forEach((e=>{i.push({...e})}));const t=e.programId.toString();r.includes(t)||r.push(t)})),r.forEach((e=>{i.push({pubkey:new cn(e),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((e=>{const t=e.pubkey.toString(),n=o.findIndex((e=>e.pubkey.toString()===t));n>-1?(o[n].isWritable=o[n].isWritable||e.isWritable,o[n].isSigner=o[n].isSigner||e.isSigner):o.push(e)})),o.sort((function(e,t){return e.isSigner!==t.isSigner?e.isSigner?-1:1:e.isWritable!==t.isWritable?e.isWritable?-1:1:e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const a=o.findIndex((e=>e.pubkey.equals(n)));if(a>-1){const[e]=o.splice(a,1);e.isSigner=!0,e.isWritable=!0,o.unshift(e)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const e of this.signatures){const t=o.findIndex((t=>t.pubkey.equals(e.publicKey)));if(!(t>-1))throw new Error(`unknown signer: ${e.publicKey.toString()}`);o[t].isSigner||(o[t].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 s=0,c=0,u=0;const l=[],d=[];o.forEach((({pubkey:e,isSigner:t,isWritable:n})=>{t?(l.push(e.toString()),s+=1,n||(c+=1)):(d.push(e.toString()),n||(u+=1))}));const f=l.concat(d),h=t.map((e=>{const{data:t,programId:n}=e;return{programIdIndex:f.indexOf(n.toString()),accounts:e.keys.map((e=>f.indexOf(e.pubkey.toString()))),data:Pe().encode(t)}}));return h.forEach((e=>{An(e.programIdIndex>=0),e.accounts.forEach((e=>An(e>=0)))})),new Rn({header:{numRequiredSignatures:s,numReadonlySignedAccounts:c,numReadonlyUnsignedAccounts:u},accountKeys:f,recentBlockhash:e,instructions:h})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every(((e,n)=>t[n].equals(e.publicKey)))||(this.signatures=t.map((e=>({signature:null,publicKey:e})))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(0===e.length)throw new Error("No signers");const t=new Set;this.signatures=e.filter((e=>{const n=e.toString();return!t.has(n)&&(t.add(n),!0)})).map((e=>({signature:null,publicKey:e})))}sign(...e){if(0===e.length)throw new Error("No signers");const t=new Set,n=[];for(const r of e){const e=r.publicKey.toString();t.has(e)||(t.add(e),n.push(r))}this.signatures=n.map((e=>({signature:null,publicKey:e.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...e){if(0===e.length)throw new Error("No signers");const t=new Set,n=[];for(const r of e){const e=r.publicKey.toString();t.has(e)||(t.add(e),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(e,...t){const n=e.serialize();t.forEach((e=>{const t=Jt(n,e.secretKey);this._addSignature(e.publicKey,Qt(t))}))}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){An(64===t.length);const n=this.signatures.findIndex((t=>e.equals(t.publicKey)));if(n<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[n].signature=i.Buffer.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?t&&(n.missing||=[]).push(i):Xt(r,e,i.toBytes())||(n.invalid||=[]).push(i);return n.invalid||n.missing?n:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),r=this.serializeMessage();if(n){const e=this._getMessageSignednessErrors(r,t);if(e){let t="Signature verification failed.";throw e.invalid&&(t+=`\nInvalid signature for public key${1===e.invalid.length?"":"(s)"} [\`${e.invalid.map((e=>e.toBase58())).join("`, `")}\`].`),e.missing&&(t+=`\nMissing signature for public key${1===e.missing.length?"":"(s)"} [\`${e.missing.map((e=>e.toBase58())).join("`, `")}\`].`),new Error(t)}}return this._serialize(r)}_serialize(e){const{signatures:t}=this,n=[];Sn(n,t.length);const r=n.length+64*t.length+e.length,o=i.Buffer.alloc(r);return An(t.length<256),i.Buffer.from(n).copy(o,0),t.forEach((({signature:e},t)=>{null!==e&&(An(64===e.length,"signature has invalid length"),i.Buffer.from(e).copy(o,n.length+64*t))})),e.copy(o,n.length+64*t.length),An(o.length<=dn,`Transaction too large: ${o.length} > ${dn}`),o}get keys(){return An(1===this.instructions.length),this.instructions[0].keys.map((e=>e.pubkey))}get programId(){return An(1===this.instructions.length),this.instructions[0].programId}get data(){return An(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e];const n=En(t);let r=[];for(let e=0;e0&&(n.feePayer=e.accountKeys[0]),t.forEach(((t,r)=>{const i={signature:t==Pe().encode(Nn)?null:Pe().decode(t),publicKey:e.accountKeys[r]};n.signatures.push(i)})),e.instructions.forEach((t=>{const r=t.accounts.map((t=>{const r=e.accountKeys[t];return{pubkey:r,isSigner:n.signatures.some((e=>e.publicKey.toString()===r.toString()))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));n.instructions.push(new Bn({keys:r,programId:e.accountKeys[t.programIdIndex],data:Pe().decode(t.data)}))})),n._message=e,n._json=n.toJSON(),n}}class Ln{constructor(e){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}static decompile(e,t){const{header:n,compiledInstructions:r,recentBlockhash:i}=e,{numRequiredSignatures:o,numReadonlySignedAccounts:a,numReadonlyUnsignedAccounts:s}=n,c=o-a;An(c>0,"Message header is invalid");const u=e.staticAccountKeys.length-o-s;An(u>=0,"Message header is invalid");const l=e.getAccountKeys(t),d=l.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");const f=[];for(const e of r){const t=[];for(const r of e.accountKeyIndexes){const e=l.get(r);if(void 0===e)throw new Error(`Failed to find key for account key index ${r}`);let i;i=re.equals(r.publicKey)));An(e>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[e]=Jt(t,r.secretKey)}}addSignature(e,t){An(64===t.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((t=>t.equals(e)));An(n>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=t}}const zn=new cn("SysvarC1ock11111111111111111111111111111111"),jn=new cn("SysvarEpochSchedu1e111111111111111111111111"),Un=new cn("Sysvar1nstructions1111111111111111111111111"),Fn=new cn("SysvarRecentB1ockHashes11111111111111111111"),Wn=new cn("SysvarRent111111111111111111111111111111111"),Hn=new cn("SysvarRewards111111111111111111111111111111"),qn=new cn("SysvarS1otHashes111111111111111111111111111"),Kn=new cn("SysvarS1otHistory11111111111111111111111111"),Gn=new cn("SysvarStakeHistory1111111111111111111111111");class $n extends Error{constructor({action:e,signature:t,transactionMessage:n,logs:r}){const i=r?`Logs: \n${JSON.stringify(r.slice(-10),null,2)}. `:"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let a;switch(e){case"send":a=`Transaction ${t} resulted in an error. \n${n}. `+i+o;break;case"simulate":a=`Simulation failed. \nMessage: ${n}. \n`+i+o;break;default:a=`Unknown action '${e}'`}super(a),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=t,this.transactionMessage=n,this.transactionLogs=r||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){const e=this.transactionLogs;if(null==e||"object"!=typeof e||!("then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise(((t,n)=>{e.getTransaction(this.signature).then((e=>{if(e&&e.meta&&e.meta.logMessages){const n=e.meta.logMessages;this.transactionLogs=n,t(n)}else n(new Error("Log messages not found"))})).catch(n)}))),await this.transactionLogs}}const Vn={JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016};class Zn extends Error{constructor({code:e,message:t,data:n},r){super(null!=r?`${r}: ${t}`:t),this.code=void 0,this.data=void 0,this.code=e,this.data=n,this.name="SolanaJSONRPCError"}}async function Yn(e,t,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await e.sendTransaction(t,n,i);let a;if(null!=t.recentBlockhash&&null!=t.lastValidBlockHeight)a=(await e.confirmTransaction({abortSignal:r?.abortSignal,signature:o,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=t.minNonceContextSlot&&null!=t.nonceInfo){const{nonceInstruction:n}=t.nonceInfo,i=n.keys[0].pubkey;a=(await e.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:t.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."),a=(await e.confirmTransaction(o,r&&r.commitment)).value;if(a.err){if(null!=o)throw new $n({action:"send",signature:o,transactionMessage:`Status: (${JSON.stringify(a)})`});throw new Error(`Transaction ${o} failed (${JSON.stringify(a)})`)}return o}function Jn(e){return new Promise((t=>setTimeout(t,e)))}function Xn(e,t){const n=e.layout.span>=0?e.layout.span:_n(e,t),r=i.Buffer.alloc(n),o=Object.assign({instruction:e.index},t);return e.layout.encode(o,r),r}function Qn(e,t){let n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.instruction!==e.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${e.index}`);return n}const er=Be._O("lamportsPerSignature"),tr=Be.n_([Be.Jq("version"),Be.Jq("state"),bn("authorizedPubkey"),bn("nonce"),Be.n_([er],"feeCalculator")]),nr=tr.span;class rr{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const t=tr.decode(Qt(e),0);return new rr({authorizedPubkey:new cn(t.authorizedPubkey),nonce:new cn(t.nonce).toString(),feeCalculator:t.feeCalculator})}}const ir=e=>{const t=(0,Be.Ik)(8,e),{encode:n,decode:r}=(e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)}))(t),o=t;return o.decode=(e,t)=>{const n=r(e,t);return(0,Me.oU)(i.Buffer.from(n))},o.encode=(e,t,r)=>{const i=(0,Me.k$)(e,8);return n(i,t,r)},o};class or{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Be.Jq("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(ar))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t,space:n,programId:r}=Qn(ar.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:t,space:n,programId:new cn(r)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t}=Qn(ar.Transfer,e.data);return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}static decodeTransferWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t,seed:n,programId:r}=Qn(ar.TransferWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:t,seed:n,programId:new cn(r)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{space:t}=Qn(ar.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:t}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:n,space:r,programId:i}=Qn(ar.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new cn(t),seed:n,space:r,programId:new cn(i)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{programId:t}=Qn(ar.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new cn(t)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:n,programId:r}=Qn(ar.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new cn(t),seed:n,programId:new cn(r)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{base:t,seed:n,lamports:r,space:i,programId:o}=Qn(ar.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new cn(t),seed:n,lamports:r,space:i,programId:new cn(o)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{authorized:t}=Qn(ar.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new cn(t)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Qn(ar.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static decodeNonceWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=Qn(ar.WithdrawNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}static decodeNonceAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t}=Qn(ar.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new cn(t)}}static checkProgramId(e){if(!e.equals(sr.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,t){if(e.length0?i:1,space:o.length,programId:r}));null!==s&&await Yn(e,s,[t,n],{commitment:"confirmed"})}const a=Be.n_([Be.Jq("instruction"),Be.Jq("offset"),Be.Jq("bytesLength"),Be.Jq("bytesLengthPadding"),Be.A9(Be.u8("byte"),Be.cv(Be.Jq(),-8),"bytes")]),s=ur.chunkSize;let c=0,u=o,l=[];for(;u.length>0;){const o=u.slice(0,s),d=i.Buffer.alloc(s+16);a.encode({instruction:0,offset:c,bytes:o,bytesLength:0,bytesLengthPadding:0},d);const f=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:d});if(l.push(Yn(e,f,[t,n],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")){const e=4;await Jn(1e3/e)}c+=s,u=u.slice(s)}await Promise.all(l);{const o=Be.n_([Be.Jq("instruction")]),a=i.Buffer.alloc(o.span);o.encode({instruction:1},a);const s=(new Mn).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Wn,isSigner:!1,isWritable:!1}],programId:r,data:a}),c="processed",u=await e.sendTransaction(s,[t,n],{preflightCommitment:c}),{context:l,value:d}=await e.confirmTransaction({signature:u,lastValidBlockHeight:s.lastValidBlockHeight,blockhash:s.recentBlockhash},c);if(d.err)throw new Error(`Transaction ${u} failed (${JSON.stringify(d)})`);for(;;){try{if(await e.getSlot({commitment:c})>l.slot)break}catch{}await new Promise((e=>setTimeout(e,Math.round(200))))}}return!0}}ur.chunkSize=cr;const lr=new cn("BPFLoader2111111111111111111111111111111111");class dr{static getMinNumSignatures(e){return ur.getMinNumSignatures(e)}static load(e,t,n,r,i){return ur.load(e,t,n,i,r)}}function fr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hr=Object.prototype.toString,pr=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function yr(e,t){var n,r,i,o,a,s,c;if(!0===e)return"true";if(!1===e)return"false";switch(typeof e){case"object":if(null===e)return null;if(e.toJSON&&"function"==typeof e.toJSON)return yr(e.toJSON(),t);if("[object Array]"===(c=hr.call(e))){for(i="[",r=e.length-1,n=0;n-1&&(i+=yr(e[n],!0)),i+"]"}if("[object Object]"===c){for(r=(o=pr(e).sort()).length,i="",n=0;n1;)e/=2,t++;return t}class br{constructor(e,t,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=e,this.leaderScheduleSlotOffset=t,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32)))-gr(32)-1;return[n,e-(this.getSlotsInEpoch(n)-32)]}{const t=e-this.firstNormalSlot,n=Math.floor(t/this.slotsPerEpoch);return[this.firstNormalEpoch+n,t%this.slotsPerEpoch]}var t}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e{const n=function(e,t){return new dt(e,t)}(e,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...t});return this.underlyingSocket="socket"in n?n.socket:n,n}),e,t,n),this.underlyingSocket=void 0}call(...e){const t=this.underlyingSocket?.readyState;return 1===t?super.call(...e):Promise.reject(new Error("Tried to call a JSON-RPC method `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}notify(...e){const t=this.underlyingSocket?.readyState;return 1===t?super.notify(...e):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}}class _r{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){const e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){const t=function(e,t){let n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.typeIndex!==e.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${e.index}`);return n}(Er,e),n=e.length-56;An(n>=0,"lookup table is invalid"),An(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=Be.n_([Be.A9(bn(),r,"addresses")]).decode(e.slice(56));return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new cn(t.authority[0]):void 0,addresses:i.map((e=>new cn(e)))}}}const Er={index:1,layout:Be.n_([Be.Jq("typeIndex"),ir("deactivationSlot"),Be._O("lastExtendedSlot"),Be.u8("lastExtendedStartIndex"),Be.u8(),Be.A9(bn(),Be.cv(Be.u8(),-1),"authority")])},Sr=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,Ar=st(Ye(cn),nt(),(e=>new cn(e))),kr=rt([nt(),Je("base64")]),xr=st(Ye(i.Buffer),kr,(e=>i.Buffer.from(e[0],"base64"))),Or=3e4;function Ir(e){let t,n;if("string"==typeof e)t=e;else if(e){const{commitment:r,...i}=e;t=r,n=i}return{commitment:t,config:n}}function Rr(e){return ot([it({jsonrpc:Je("2.0"),id:nt(),result:e}),it({jsonrpc:Je("2.0"),id:nt(),error:it({code:at(),message:nt(),data:et($e("any",(()=>!0)))})})])}const Tr=Rr(at());function Pr(e){return st(Rr(e),Tr,(t=>"error"in t?t:{...t,result:qe(t.result,e)}))}function Cr(e){return Pr(it({context:it({slot:Qe()}),value:e}))}function Nr(e){return it({context:it({slot:Qe()}),value:e})}function Br(e,t){return 0===e?new Tn({header:t.header,staticAccountKeys:t.accountKeys.map((e=>new cn(e))),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map((e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Pe().decode(e.data)}))),addressTableLookups:t.addressTableLookups}):new Rn(t)}const Mr=it({foundation:Qe(),foundationTerm:Qe(),initial:Qe(),taper:Qe(),terminal:Qe()}),Lr=Pr(Ve(Xe(it({epoch:Qe(),effectiveSlot:Qe(),amount:Qe(),postBalance:Qe(),commission:et(Xe(Qe()))})))),Dr=Ve(it({slot:Qe(),prioritizationFee:Qe()})),zr=it({total:Qe(),validator:Qe(),foundation:Qe(),epoch:Qe()}),jr=it({epoch:Qe(),slotIndex:Qe(),slotsInEpoch:Qe(),absoluteSlot:Qe(),blockHeight:et(Qe()),transactionCount:et(Qe())}),Ur=it({slotsPerEpoch:Qe(),leaderScheduleSlotOffset:Qe(),warmup:Ze(),firstNormalEpoch:Qe(),firstNormalSlot:Qe()}),Fr=tt(nt(),Ve(Qe())),Wr=Xe(ot([it({}),nt()])),Hr=it({err:Wr}),qr=Je("receivedSignature"),Kr=it({"solana-core":nt(),"feature-set":et(Qe())}),Gr=Cr(it({err:Xe(ot([it({}),nt()])),logs:Xe(Ve(nt())),accounts:et(Xe(Ve(Xe(it({executable:Ze(),owner:nt(),lamports:Qe(),data:Ve(nt()),rentEpoch:et(Qe())}))))),unitsConsumed:et(Qe()),returnData:et(Xe(it({programId:nt(),data:rt([nt(),Je("base64")])})))})),$r=Cr(it({byIdentity:tt(nt(),Ve(Qe())),range:it({firstSlot:Qe(),lastSlot:Qe()})})),Vr=Pr(Mr),Zr=Pr(zr),Yr=Pr(Dr),Jr=Pr(jr),Xr=Pr(Ur),Qr=Pr(Fr),ei=Pr(Qe()),ti=Cr(it({total:Qe(),circulating:Qe(),nonCirculating:Qe(),nonCirculatingAccounts:Ve(Ar)})),ni=it({amount:nt(),uiAmount:Xe(Qe()),decimals:Qe(),uiAmountString:et(nt())}),ri=Cr(Ve(it({address:Ar,amount:nt(),uiAmount:Xe(Qe()),decimals:Qe(),uiAmountString:et(nt())}))),ii=Cr(Ve(it({pubkey:Ar,account:it({executable:Ze(),owner:Ar,lamports:Qe(),data:xr,rentEpoch:Qe()})}))),oi=it({program:nt(),parsed:at(),space:Qe()}),ai=Cr(Ve(it({pubkey:Ar,account:it({executable:Ze(),owner:Ar,lamports:Qe(),data:oi,rentEpoch:Qe()})}))),si=Cr(Ve(it({lamports:Qe(),address:Ar}))),ci=it({executable:Ze(),owner:Ar,lamports:Qe(),data:xr,rentEpoch:Qe()}),ui=it({pubkey:Ar,account:ci}),li=st(ot([Ye(i.Buffer),oi]),ot([kr,oi]),(e=>Array.isArray(e)?qe(e,xr):e)),di=it({executable:Ze(),owner:Ar,lamports:Qe(),data:li,rentEpoch:Qe()}),fi=it({pubkey:Ar,account:di}),hi=it({state:ot([Je("active"),Je("inactive"),Je("activating"),Je("deactivating")]),active:Qe(),inactive:Qe()}),pi=Pr(Ve(it({signature:nt(),slot:Qe(),err:Wr,memo:Xe(nt()),blockTime:et(Xe(Qe()))}))),yi=Pr(Ve(it({signature:nt(),slot:Qe(),err:Wr,memo:Xe(nt()),blockTime:et(Xe(Qe()))}))),mi=it({subscription:Qe(),result:Nr(ci)}),gi=it({pubkey:Ar,account:ci}),bi=it({subscription:Qe(),result:Nr(gi)}),vi=it({parent:Qe(),slot:Qe(),root:Qe()}),wi=it({subscription:Qe(),result:vi}),_i=ot([it({type:ot([Je("firstShredReceived"),Je("completed"),Je("optimisticConfirmation"),Je("root")]),slot:Qe(),timestamp:Qe()}),it({type:Je("createdBank"),parent:Qe(),slot:Qe(),timestamp:Qe()}),it({type:Je("frozen"),slot:Qe(),timestamp:Qe(),stats:it({numTransactionEntries:Qe(),numSuccessfulTransactions:Qe(),numFailedTransactions:Qe(),maxTransactionsPerEntry:Qe()})}),it({type:Je("dead"),slot:Qe(),timestamp:Qe(),err:nt()})]),Ei=it({subscription:Qe(),result:_i}),Si=it({subscription:Qe(),result:Nr(ot([Hr,qr]))}),Ai=it({subscription:Qe(),result:Qe()}),ki=it({pubkey:nt(),gossip:Xe(nt()),tpu:Xe(nt()),rpc:Xe(nt()),version:Xe(nt())}),xi=it({votePubkey:nt(),nodePubkey:nt(),activatedStake:Qe(),epochVoteAccount:Ze(),epochCredits:Ve(rt([Qe(),Qe(),Qe()])),commission:Qe(),lastVote:Qe(),rootSlot:Xe(Qe())}),Oi=Pr(it({current:Ve(xi),delinquent:Ve(xi)})),Ii=ot([Je("processed"),Je("confirmed"),Je("finalized")]),Ri=it({slot:Qe(),confirmations:Xe(Qe()),err:Wr,confirmationStatus:et(Ii)}),Ti=Cr(Ve(Xe(Ri))),Pi=Pr(Qe()),Ci=it({accountKey:Ar,writableIndexes:Ve(Qe()),readonlyIndexes:Ve(Qe())}),Ni=it({signatures:Ve(nt()),message:it({accountKeys:Ve(nt()),header:it({numRequiredSignatures:Qe(),numReadonlySignedAccounts:Qe(),numReadonlyUnsignedAccounts:Qe()}),instructions:Ve(it({accounts:Ve(Qe()),data:nt(),programIdIndex:Qe()})),recentBlockhash:nt(),addressTableLookups:et(Ve(Ci))})}),Bi=it({pubkey:Ar,signer:Ze(),writable:Ze(),source:et(ot([Je("transaction"),Je("lookupTable")]))}),Mi=it({accountKeys:Ve(Bi),signatures:Ve(nt())}),Li=it({parsed:at(),program:nt(),programId:Ar}),Di=it({accounts:Ve(Ar),data:nt(),programId:Ar}),zi=st(ot([Di,Li]),ot([it({parsed:at(),program:nt(),programId:nt()}),it({accounts:Ve(nt()),data:nt(),programId:nt()})]),(e=>qe(e,"accounts"in e?Di:Li))),ji=it({signatures:Ve(nt()),message:it({accountKeys:Ve(Bi),instructions:Ve(zi),recentBlockhash:nt(),addressTableLookups:et(Xe(Ve(Ci)))})}),Ui=it({accountIndex:Qe(),mint:nt(),owner:et(nt()),uiTokenAmount:ni}),Fi=it({writable:Ve(Ar),readonly:Ve(Ar)}),Wi=it({err:Wr,fee:Qe(),innerInstructions:et(Xe(Ve(it({index:Qe(),instructions:Ve(it({accounts:Ve(Qe()),data:nt(),programIdIndex:Qe()}))})))),preBalances:Ve(Qe()),postBalances:Ve(Qe()),logMessages:et(Xe(Ve(nt()))),preTokenBalances:et(Xe(Ve(Ui))),postTokenBalances:et(Xe(Ve(Ui))),loadedAddresses:et(Fi),computeUnitsConsumed:et(Qe())}),Hi=it({err:Wr,fee:Qe(),innerInstructions:et(Xe(Ve(it({index:Qe(),instructions:Ve(zi)})))),preBalances:Ve(Qe()),postBalances:Ve(Qe()),logMessages:et(Xe(Ve(nt()))),preTokenBalances:et(Xe(Ve(Ui))),postTokenBalances:et(Xe(Ve(Ui))),loadedAddresses:et(Fi),computeUnitsConsumed:et(Qe())}),qi=ot([Je(0),Je("legacy")]),Ki=it({pubkey:nt(),lamports:Qe(),postBalance:Xe(Qe()),rewardType:Xe(nt()),commission:et(Xe(Qe()))}),Gi=Pr(Xe(it({blockhash:nt(),previousBlockhash:nt(),parentSlot:Qe(),transactions:Ve(it({transaction:Ni,meta:Xe(Wi),version:et(qi)})),rewards:et(Ve(Ki)),blockTime:Xe(Qe()),blockHeight:Xe(Qe())}))),$i=Pr(Xe(it({blockhash:nt(),previousBlockhash:nt(),parentSlot:Qe(),rewards:et(Ve(Ki)),blockTime:Xe(Qe()),blockHeight:Xe(Qe())}))),Vi=Pr(Xe(it({blockhash:nt(),previousBlockhash:nt(),parentSlot:Qe(),transactions:Ve(it({transaction:Mi,meta:Xe(Wi),version:et(qi)})),rewards:et(Ve(Ki)),blockTime:Xe(Qe()),blockHeight:Xe(Qe())}))),Zi=Pr(Xe(it({blockhash:nt(),previousBlockhash:nt(),parentSlot:Qe(),transactions:Ve(it({transaction:ji,meta:Xe(Hi),version:et(qi)})),rewards:et(Ve(Ki)),blockTime:Xe(Qe()),blockHeight:Xe(Qe())}))),Yi=Pr(Xe(it({blockhash:nt(),previousBlockhash:nt(),parentSlot:Qe(),transactions:Ve(it({transaction:Mi,meta:Xe(Hi),version:et(qi)})),rewards:et(Ve(Ki)),blockTime:Xe(Qe()),blockHeight:Xe(Qe())}))),Ji=Pr(Xe(it({blockhash:nt(),previousBlockhash:nt(),parentSlot:Qe(),rewards:et(Ve(Ki)),blockTime:Xe(Qe()),blockHeight:Xe(Qe())}))),Xi=Pr(Xe(it({blockhash:nt(),previousBlockhash:nt(),parentSlot:Qe(),transactions:Ve(it({transaction:Ni,meta:Xe(Wi)})),rewards:et(Ve(Ki)),blockTime:Xe(Qe())}))),Qi=Pr(Xe(it({blockhash:nt(),previousBlockhash:nt(),parentSlot:Qe(),signatures:Ve(nt()),blockTime:Xe(Qe())}))),eo=Pr(Xe(it({slot:Qe(),meta:Xe(Wi),blockTime:et(Xe(Qe())),transaction:Ni,version:et(qi)}))),to=Pr(Xe(it({slot:Qe(),transaction:ji,meta:Xe(Hi),blockTime:et(Xe(Qe())),version:et(qi)}))),no=Cr(it({blockhash:nt(),feeCalculator:it({lamportsPerSignature:Qe()})})),ro=Cr(it({blockhash:nt(),lastValidBlockHeight:Qe()})),io=Cr(Ze()),oo=Pr(Ve(it({slot:Qe(),numTransactions:Qe(),numSlots:Qe(),samplePeriodSecs:Qe()}))),ao=Cr(Xe(it({feeCalculator:it({lamportsPerSignature:Qe()})}))),so=Pr(nt()),co=Pr(nt()),uo=it({err:Wr,logs:Ve(nt()),signature:nt()}),lo=it({result:Nr(uo),subscription:Qe()}),fo={"solana-client":"js/0.0.0-development"};class ho{constructor(e,t){let n,r,i,o,a,s;var c;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 e={};return async t=>{const{commitment:n,config:r}=Ir(t),i=this._buildArgs([],n,void 0,r),o=mr(i);return e[o]=e[o]??(async()=>{try{const e=qe(await this._rpcRequest("getBlockHeight",i),Pr(Qe()));if("error"in e)throw new Zn(e.error,"failed to get block height information");return e.result}finally{delete e[o]}})(),await e[o]}})(),t&&"string"==typeof t?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,n=t.wsEndpoint,r=t.httpHeaders,i=t.fetch,o=t.fetchMiddleware,a=t.disableRetryOnRateLimit,s=t.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(e),this._rpcWsEndpoint=n||function(e){const t=e.match(Sr);if(null==t)throw TypeError(`Failed to validate endpoint URL \`${e}\``);const[n,r,i,o]=t,a=e.startsWith("https:")?"wss:":"ws:",s=null==i?null:parseInt(i.slice(1),10);return`${a}//${r}${null==s?"":`:${s+1}`}${o}`}(e),this._rpcClient=function(e,t,n,r,i,o){const a=n||vr;let s;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&&(s=async(e,t)=>{const n=await new Promise(((n,i)=>{try{r(e,t,((e,t)=>n([e,t])))}catch(e){i(e)}}));return await a(...n)}),new(ut())((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{},fo)};try{let t,n=5,c=500;for(;t=s?await s(e,o):await a(e,o),429===t.status&&!0!==i&&(n-=1,0!==n);)console.error(`Server responded with ${t.status} ${t.statusText}. Retrying after ${c}ms delay...`),await Jn(c),c*=2;const u=await t.text();t.ok?r(null,u):r(new Error(`${t.status} ${t.statusText}: ${u}`))}catch(e){e instanceof Error&&r(e)}}),{})}(e,r,i,o,a,s),this._rpcRequest=(c=this._rpcClient,(e,t)=>new Promise(((n,r)=>{c.request(e,t,((e,t)=>{e?r(e):n(t)}))}))),this._rpcBatchRequest=function(e){return t=>new Promise(((n,r)=>{0===t.length&&n([]);const i=t.map((t=>e.request(t.methodName,t.args)));e.request(i,((e,t)=>{e?r(e):n(t)}))}))}(this._rpcClient),this._rpcWebSocket=new wr(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(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgs([e.toBase58()],n,void 0,r),o=qe(await this._rpcRequest("getBalance",i),Cr(Qe()));if("error"in o)throw new Zn(o.error,`failed to get balance for ${e.toBase58()}`);return o.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then((e=>e.value)).catch((t=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+t)}))}async getBlockTime(e){const t=qe(await this._rpcRequest("getBlockTime",[e]),Pr(Xe(Qe())));if("error"in t)throw new Zn(t.error,`failed to get block time for slot ${e}`);return t.result}async getMinimumLedgerSlot(){const e=qe(await this._rpcRequest("minimumLedgerSlot",[]),Pr(Qe()));if("error"in e)throw new Zn(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const e=qe(await this._rpcRequest("getFirstAvailableBlock",[]),ei);if("error"in e)throw new Zn(e.error,"failed to get first available block");return e.result}async getSupply(e){let t={};t="string"==typeof e?{commitment:e}:e?{...e,commitment:e&&e.commitment||this.commitment}:{commitment:this.commitment};const n=qe(await this._rpcRequest("getSupply",[t]),ti);if("error"in n)throw new Zn(n.error,"failed to get supply");return n.result}async getTokenSupply(e,t){const n=this._buildArgs([e.toBase58()],t),r=qe(await this._rpcRequest("getTokenSupply",n),Cr(ni));if("error"in r)throw new Zn(r.error,"failed to get token supply");return r.result}async getTokenAccountBalance(e,t){const n=this._buildArgs([e.toBase58()],t),r=qe(await this._rpcRequest("getTokenAccountBalance",n),Cr(ni));if("error"in r)throw new Zn(r.error,"failed to get token account balance");return r.result}async getTokenAccountsByOwner(e,t,n){const{commitment:r,config:i}=Ir(n);let o=[e.toBase58()];"mint"in t?o.push({mint:t.mint.toBase58()}):o.push({programId:t.programId.toBase58()});const a=this._buildArgs(o,r,"base64",i),s=qe(await this._rpcRequest("getTokenAccountsByOwner",a),ii);if("error"in s)throw new Zn(s.error,`failed to get token accounts owned by account ${e.toBase58()}`);return s.result}async getParsedTokenAccountsByOwner(e,t,n){let r=[e.toBase58()];"mint"in t?r.push({mint:t.mint.toBase58()}):r.push({programId:t.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=qe(await this._rpcRequest("getTokenAccountsByOwner",i),ai);if("error"in o)throw new Zn(o.error,`failed to get token accounts owned by account ${e.toBase58()}`);return o.result}async getLargestAccounts(e){const t={...e,commitment:e&&e.commitment||this.commitment},n=t.filter||t.commitment?[t]:[],r=qe(await this._rpcRequest("getLargestAccounts",n),si);if("error"in r)throw new Zn(r.error,"failed to get largest accounts");return r.result}async getTokenLargestAccounts(e,t){const n=this._buildArgs([e.toBase58()],t),r=qe(await this._rpcRequest("getTokenLargestAccounts",n),ri);if("error"in r)throw new Zn(r.error,"failed to get token largest accounts");return r.result}async getAccountInfoAndContext(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgs([e.toBase58()],n,"base64",r),o=qe(await this._rpcRequest("getAccountInfo",i),Cr(Xe(ci)));if("error"in o)throw new Zn(o.error,`failed to get info about account ${e.toBase58()}`);return o.result}async getParsedAccountInfo(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgs([e.toBase58()],n,"jsonParsed",r),o=qe(await this._rpcRequest("getAccountInfo",i),Cr(Xe(di)));if("error"in o)throw new Zn(o.error,`failed to get info about account ${e.toBase58()}`);return o.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(t){throw new Error("failed to get info about account "+e.toBase58()+": "+t)}}async getMultipleParsedAccounts(e,t){const{commitment:n,config:r}=Ir(t),i=e.map((e=>e.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),a=qe(await this._rpcRequest("getMultipleAccounts",o),Cr(Ve(Xe(di))));if("error"in a)throw new Zn(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfoAndContext(e,t){const{commitment:n,config:r}=Ir(t),i=e.map((e=>e.toBase58())),o=this._buildArgs([i],n,"base64",r),a=qe(await this._rpcRequest("getMultipleAccounts",o),Cr(Ve(Xe(ci))));if("error"in a)throw new Zn(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(e,t){return(await this.getMultipleAccountsInfoAndContext(e,t)).value}async getStakeActivation(e,t,n){const{commitment:r,config:i}=Ir(t),o=this._buildArgs([e.toBase58()],r,void 0,{...i,epoch:null!=n?n:i?.epoch}),a=qe(await this._rpcRequest("getStakeActivation",o),Pr(hi));if("error"in a)throw new Zn(a.error,`failed to get Stake Activation ${e.toBase58()}`);return a.result}async getProgramAccounts(e,t){const{commitment:n,config:r}=Ir(t),{encoding:i,...o}=r||{},a=this._buildArgs([e.toBase58()],n,i||"base64",o),s=await this._rpcRequest("getProgramAccounts",a),c=Ve(ui),u=!0===o.withContext?qe(s,Cr(c)):qe(s,Pr(c));if("error"in u)throw new Zn(u.error,`failed to get accounts owned by program ${e.toBase58()}`);return u.result}async getParsedProgramAccounts(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgs([e.toBase58()],n,"jsonParsed",r),o=qe(await this._rpcRequest("getProgramAccounts",i),Pr(Ve(fi)));if("error"in o)throw new Zn(o.error,`failed to get accounts owned by program ${e.toBase58()}`);return o.result}async confirmTransaction(e,t){let n,r;if("string"==typeof e)n=e;else{const t=e;if(t.abortSignal?.aborted)return Promise.reject(t.abortSignal.reason);n=t.signature}try{r=Pe().decode(n)}catch(e){throw new Error("signature must be base58 encoded: "+n)}return An(64===r.length,"signature has invalid length"),"string"==typeof e?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:n}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise(((t,n)=>{null!=e&&(e.aborted?n(e.reason):e.addEventListener("abort",(()=>{n(e.reason)})))}))}getTransactionConfirmationPromise({commitment:e,signature:t}){let n,r,i=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((o,a)=>{try{n=this.onSignature(t,((e,t)=>{n=void 0;const r={context:t,value:e};o({__type:Cn.PROCESSED,response:r})}),e);const s=new Promise((e=>{null==n?e():r=this._onSubscriptionStateChange(n,(t=>{"subscribed"===t&&e()}))}));(async()=>{if(await s,i)return;const n=await this.getSignatureStatus(t);if(i)return;if(null==n)return;const{context:r,value:c}=n;if(null!=c)if(c?.err)a(c.err);else{switch(e){case"confirmed":case"single":case"singleGossip":if("processed"===c.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===c.confirmationStatus||"confirmed"===c.confirmationStatus)return}i=!0,o({__type:Cn.PROCESSED,response:{context:r,value:c}})}})()}catch(e){a(e)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e,strategy:{abortSignal:t,lastValidBlockHeight:n,signature:r}}){let i=!1;const o=new Promise((t=>{const r=async()=>{try{return await this.getBlockHeight(e)}catch(e){return-1}};(async()=>{let e=await r();if(!i){for(;e<=n;){if(await Jn(1e3),i)return;if(e=await r(),i)return}t({__type:Cn.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:a,confirmationPromise:s}=this.getTransactionConfirmationPromise({commitment:e,signature:r}),c=this.getCancellationPromise(t);let u;try{const e=await Promise.race([c,s,o]);if(e.__type!==Cn.PROCESSED)throw new pn(r);u=e.response}finally{i=!0,a()}return u}async confirmTransactionUsingDurableNonceStrategy({commitment:e,strategy:{abortSignal:t,minContextSlot:n,nonceAccountPubkey:r,nonceValue:i,signature:o}}){let a=!1;const s=new Promise((t=>{let o=i,s=null;const c=async()=>{try{const{context:t,value:i}=await this.getNonceAndContext(r,{commitment:e,minContextSlot:n});return s=t.slot,i?.nonce}catch(e){return o}};(async()=>{if(o=await c(),!a)for(;;){if(i!==o)return void t({__type:Cn.NONCE_INVALID,slotInWhichNonceDidAdvance:s});if(await Jn(2e3),a)return;if(o=await c(),a)return}})()})),{abortConfirmation:c,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:e,signature:o}),l=this.getCancellationPromise(t);let d;try{const t=await Promise.race([l,u,s]);if(t.__type===Cn.PROCESSED)d=t.response;else{let r;for(;;){const e=await this.getSignatureStatus(o);if(null==e)break;if(!(e.context.slot<(t.slotInWhichNonceDidAdvance??n))){r=e;break}await Jn(400)}if(!r?.value)throw new mn(o);{const t=e||"finalized",{confirmationStatus:n}=r.value;switch(t){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new mn(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new mn(o);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new mn(o)}d={context:r.context,value:{err:r.value.err}}}}}finally{a=!0,c()}return d}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:e,signature:t}){let n;const r=new Promise((t=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(e){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>t({__type:Cn.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:e,signature:t});let a;try{const e=await Promise.race([o,r]);if(e.__type!==Cn.PROCESSED)throw new yn(t,e.timeoutMs/1e3);a=e.response}finally{clearTimeout(n),i()}return a}async getClusterNodes(){const e=qe(await this._rpcRequest("getClusterNodes",[]),Pr(Ve(ki)));if("error"in e)throw new Zn(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(e){const t=this._buildArgs([],e),n=qe(await this._rpcRequest("getVoteAccounts",t),Oi);if("error"in n)throw new Zn(n.error,"failed to get vote accounts");return n.result}async getSlot(e){const{commitment:t,config:n}=Ir(e),r=this._buildArgs([],t,void 0,n),i=qe(await this._rpcRequest("getSlot",r),Pr(Qe()));if("error"in i)throw new Zn(i.error,"failed to get slot");return i.result}async getSlotLeader(e){const{commitment:t,config:n}=Ir(e),r=this._buildArgs([],t,void 0,n),i=qe(await this._rpcRequest("getSlotLeader",r),Pr(nt()));if("error"in i)throw new Zn(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(e,t){const n=[e,t],r=qe(await this._rpcRequest("getSlotLeaders",n),Pr(Ve(Ar)));if("error"in r)throw new Zn(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(e,t){const{context:n,value:r}=await this.getSignatureStatuses([e],t);return An(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(e,t){const n=[e];t&&n.push(t);const r=qe(await this._rpcRequest("getSignatureStatuses",n),Ti);if("error"in r)throw new Zn(r.error,"failed to get signature status");return r.result}async getTransactionCount(e){const{commitment:t,config:n}=Ir(e),r=this._buildArgs([],t,void 0,n),i=qe(await this._rpcRequest("getTransactionCount",r),Pr(Qe()));if("error"in i)throw new Zn(i.error,"failed to get transaction count");return i.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),n=qe(await this._rpcRequest("getInflationGovernor",t),Vr);if("error"in n)throw new Zn(n.error,"failed to get inflation");return n.result}async getInflationReward(e,t,n){const{commitment:r,config:i}=Ir(n),o=this._buildArgs([e.map((e=>e.toBase58()))],r,void 0,{...i,epoch:null!=t?t:i?.epoch}),a=qe(await this._rpcRequest("getInflationReward",o),Lr);if("error"in a)throw new Zn(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){const e=qe(await this._rpcRequest("getInflationRate",[]),Zr);if("error"in e)throw new Zn(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(e){const{commitment:t,config:n}=Ir(e),r=this._buildArgs([],t,void 0,n),i=qe(await this._rpcRequest("getEpochInfo",r),Jr);if("error"in i)throw new Zn(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const e=qe(await this._rpcRequest("getEpochSchedule",[]),Xr);if("error"in e)throw new Zn(e.error,"failed to get epoch schedule");const t=e.result;return new br(t.slotsPerEpoch,t.leaderScheduleSlotOffset,t.warmup,t.firstNormalEpoch,t.firstNormalSlot)}async getLeaderSchedule(){const e=qe(await this._rpcRequest("getLeaderSchedule",[]),Qr);if("error"in e)throw new Zn(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(e,t){const n=this._buildArgs([e],t),r=qe(await this._rpcRequest("getMinimumBalanceForRentExemption",n),Pi);return"error"in r?(console.warn("Unable to fetch minimum balance for rent exemption"),0):r.result}async getRecentBlockhashAndContext(e){const t=this._buildArgs([],e),n=qe(await this._rpcRequest("getRecentBlockhash",t),no);if("error"in n)throw new Zn(n.error,"failed to get recent blockhash");return n.result}async getRecentPerformanceSamples(e){const t=qe(await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),oo);if("error"in t)throw new Zn(t.error,"failed to get recent performance samples");return t.result}async getFeeCalculatorForBlockhash(e,t){const n=this._buildArgs([e],t),r=qe(await this._rpcRequest("getFeeCalculatorForBlockhash",n),ao);if("error"in r)throw new Zn(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(e,t){const n=Qt(e.serialize()).toString("base64"),r=this._buildArgs([n],t),i=qe(await this._rpcRequest("getFeeForMessage",r),Cr(Xe(Qe())));if("error"in i)throw new Zn(i.error,"failed to get fee for message");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentPrioritizationFees(e){const t=e?.lockedWritableAccounts?.map((e=>e.toBase58())),n=t?.length?[t]:[],r=qe(await this._rpcRequest("getRecentPrioritizationFees",n),Yr);if("error"in r)throw new Zn(r.error,"failed to get recent prioritization fees");return r.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhashAndContext(e){const{commitment:t,config:n}=Ir(e),r=this._buildArgs([],t,void 0,n),i=qe(await this._rpcRequest("getLatestBlockhash",r),ro);if("error"in i)throw new Zn(i.error,"failed to get latest blockhash");return i.result}async isBlockhashValid(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgs([e],n,void 0,r),o=qe(await this._rpcRequest("isBlockhashValid",i),io);if("error"in o)throw new Zn(o.error,"failed to determine if the blockhash `"+e+"`is valid");return o.result}async getVersion(){const e=qe(await this._rpcRequest("getVersion",[]),Pr(Kr));if("error"in e)throw new Zn(e.error,"failed to get version");return e.result}async getGenesisHash(){const e=qe(await this._rpcRequest("getGenesisHash",[]),Pr(nt()));if("error"in e)throw new Zn(e.error,"failed to get genesis hash");return e.result}async getBlock(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgsAtLeastConfirmed([e],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const e=qe(o,Vi);if("error"in e)throw e.error;return e.result}case"none":{const e=qe(o,$i);if("error"in e)throw e.error;return e.result}default:{const e=qe(o,Gi);if("error"in e)throw e.error;const{result:t}=e;return t?{...t,transactions:t.transactions.map((({transaction:e,meta:t,version:n})=>({meta:t,transaction:{...e,message:Br(n,e.message)},version:n})))}:null}}}catch(e){throw new Zn(e,"failed to get confirmed block")}}async getParsedBlock(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(r?.transactionDetails){case"accounts":{const e=qe(o,Yi);if("error"in e)throw e.error;return e.result}case"none":{const e=qe(o,Ji);if("error"in e)throw e.error;return e.result}default:{const e=qe(o,Zi);if("error"in e)throw e.error;return e.result}}}catch(e){throw new Zn(e,"failed to get block")}}async getBlockProduction(e){let t,n;if("string"==typeof e)n=e;else if(e){const{commitment:r,...i}=e;n=r,t=i}const r=this._buildArgs([],n,"base64",t),i=qe(await this._rpcRequest("getBlockProduction",r),$r);if("error"in i)throw new Zn(i.error,"failed to get block production information");return i.result}async getTransaction(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgsAtLeastConfirmed([e],n,void 0,r),o=qe(await this._rpcRequest("getTransaction",i),eo);if("error"in o)throw new Zn(o.error,"failed to get transaction");const a=o.result;return a?{...a,transaction:{...a.transaction,message:Br(a.version,a.transaction.message)}}:a}async getParsedTransaction(e,t){const{commitment:n,config:r}=Ir(t),i=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r),o=qe(await this._rpcRequest("getTransaction",i),to);if("error"in o)throw new Zn(o.error,"failed to get transaction");return o.result}async getParsedTransactions(e,t){const{commitment:n,config:r}=Ir(t),i=e.map((e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((e=>{const t=qe(e,to);if("error"in t)throw new Zn(t.error,"failed to get transactions");return t.result}))}async getTransactions(e,t){const{commitment:n,config:r}=Ir(t),i=e.map((e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((e=>{const t=qe(e,eo);if("error"in t)throw new Zn(t.error,"failed to get transactions");const n=t.result;return n?{...n,transaction:{...n.transaction,message:Br(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(e,t){const n=this._buildArgsAtLeastConfirmed([e],t),r=qe(await this._rpcRequest("getConfirmedBlock",n),Xi);if("error"in r)throw new Zn(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+e+" not found");const o={...i,transactions:i.transactions.map((({transaction:e,meta:t})=>{const n=new Rn(e.message);return{meta:t,transaction:{...e,message:n}}}))};return{...o,transactions:o.transactions.map((({transaction:e,meta:t})=>({meta:t,transaction:Mn.populate(e.message,e.signatures)})))}}async getBlocks(e,t,n){const r=this._buildArgsAtLeastConfirmed(void 0!==t?[e,t]:[e],n),i=qe(await this._rpcRequest("getBlocks",r),Pr(Ve(Qe())));if("error"in i)throw new Zn(i.error,"failed to get blocks");return i.result}async getBlockSignatures(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),r=qe(await this._rpcRequest("getBlock",n),Qi);if("error"in r)throw new Zn(r.error,"failed to get block");const i=r.result;if(!i)throw new Error("Block "+e+" not found");return i}async getConfirmedBlockSignatures(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),r=qe(await this._rpcRequest("getConfirmedBlock",n),Qi);if("error"in r)throw new Zn(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+e+" not found");return i}async getConfirmedTransaction(e,t){const n=this._buildArgsAtLeastConfirmed([e],t),r=qe(await this._rpcRequest("getConfirmedTransaction",n),eo);if("error"in r)throw new Zn(r.error,"failed to get transaction");const i=r.result;if(!i)return i;const o=new Rn(i.transaction.message),a=i.transaction.signatures;return{...i,transaction:Mn.populate(o,a)}}async getParsedConfirmedTransaction(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),r=qe(await this._rpcRequest("getConfirmedTransaction",n),to);if("error"in r)throw new Zn(r.error,"failed to get confirmed transaction");return r.result}async getParsedConfirmedTransactions(e,t){const n=e.map((e=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([e],t,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((e=>{const t=qe(e,to);if("error"in t)throw new Zn(t.error,"failed to get confirmed transactions");return t.result}))}async getConfirmedSignaturesForAddress(e,t,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--t<=0||t0&&(r.until=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const e=await this.getConfirmedBlockSignatures(n);e.signatures.length>0&&(r.before=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}return(await this.getConfirmedSignaturesForAddress2(e,r)).map((e=>e.signature))}async getConfirmedSignaturesForAddress2(e,t,n){const r=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,t),i=qe(await this._rpcRequest("getConfirmedSignaturesForAddress2",r),pi);if("error"in i)throw new Zn(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(e,t,n){const r=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,t),i=qe(await this._rpcRequest("getSignaturesForAddress",r),yi);if("error"in i)throw new Zn(i.error,"failed to get signatures for address");return i.result}async getAddressLookupTable(e,t){const{context:n,value:r}=await this.getAccountInfoAndContext(e,t);let i=null;return null!==r&&(i=new _r({key:e,state:_r.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(e,t){const{context:n,value:r}=await this.getAccountInfoAndContext(e,t);let i=null;return null!==r&&(i=rr.fromAccountData(r.data)),{context:n,value:i}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then((e=>e.value)).catch((t=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}))}async requestAirdrop(e,t){const n=qe(await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),so);if("error"in n)throw new Zn(n.error,`airdrop to ${e.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await Jn(100);const e=Date.now()-this._blockhashInfo.lastFetch>=Or;if(null!==this._blockhashInfo.latestBlockhash&&!e)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now(),t=this._blockhashInfo.latestBlockhash,n=t?t.blockhash:null;for(let e=0;e<50;e++){const e=await this.getLatestBlockhash("finalized");if(n!==e.blockhash)return this._blockhashInfo={latestBlockhash:e,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e;await Jn(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){const{commitment:t,config:n}=Ir(e),r=this._buildArgs([],t,"base64",n),i=qe(await this._rpcRequest("getStakeMinimumDelegation",r),Cr(Qe()));if("error"in i)throw new Zn(i.error,"failed to get stake minimum delegation");return i.result}async simulateTransaction(e,t,n){if("message"in e){const r=e.serialize(),o=i.Buffer.from(r).toString("base64");if(Array.isArray(t)||void 0!==n)throw new Error("Invalid arguments");const a=t||{};a.encoding="base64","commitment"in a||(a.commitment=this.commitment);const s=[o,a],c=qe(await this._rpcRequest("simulateTransaction",s),Gr);if("error"in c)throw new Error("failed to simulate transaction: "+c.error.message);return c.result}let r;if(e instanceof Mn){let t=e;r=new Mn,r.feePayer=t.feePayer,r.instructions=e.instructions,r.nonceInfo=t.nonceInfo,r.signatures=t.signatures}else r=Mn.populate(e),r._message=r._json=void 0;if(void 0!==t&&!Array.isArray(t))throw new Error("Invalid arguments");const o=t;if(r.nonceInfo&&o)r.sign(...o);else{let e=this._disableBlockhashCaching;for(;;){const t=await this._blockhashWithExpiryBlockHeight(e);if(r.lastValidBlockHeight=t.lastValidBlockHeight,r.recentBlockhash=t.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}e=!0}}const a=r._compile(),s=a.serialize(),c=r._serialize(s).toString("base64"),u={encoding:"base64",commitment:this.commitment};if(n){const e=(Array.isArray(n)?n:a.nonProgramIds()).map((e=>e.toBase58()));u.accounts={encoding:"base64",addresses:e}}o&&(u.sigVerify=!0);const l=[c,u],d=qe(await this._rpcRequest("simulateTransaction",l),Gr);if("error"in d){let e;if("data"in d.error&&(e=d.error.data.logs,e&&Array.isArray(e))){const t="\n ",n=t+e.join(t);console.error(d.error.message,n)}throw new $n({action:"simulate",signature:"",transactionMessage:d.error.message,logs:e})}return d.result}async sendTransaction(e,t,n){if("version"in e){if(t&&Array.isArray(t))throw new Error("Invalid arguments");const n=e.serialize();return await this.sendRawTransaction(n,t)}if(void 0===t||!Array.isArray(t))throw new Error("Invalid arguments");const r=t;if(e.nonceInfo)e.sign(...r);else{let t=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(t);if(e.lastValidBlockHeight=n.lastValidBlockHeight,e.recentBlockhash=n.blockhash,e.sign(...r),!e.signature)throw new Error("!signature");const i=e.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}t=!0}}const i=e.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(e,t){const n=Qt(e).toString("base64");return await this.sendEncodedTransaction(n,t)}async sendEncodedTransaction(e,t){const n={encoding:"base64"},r=t&&t.skipPreflight,i=!0===r?"processed":t&&t.preflightCommitment||this.commitment;t&&null!=t.maxRetries&&(n.maxRetries=t.maxRetries),t&&null!=t.minContextSlot&&(n.minContextSlot=t.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[e,n],a=qe(await this._rpcRequest("sendTransaction",o),co);if("error"in a){let e;throw"data"in a.error&&(e=a.error.data.logs),new $n({action:r?"send":"simulate",signature:"",transactionMessage:a.error.message,logs:e})}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}_wsOnClose(e){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!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([e,t])=>{this._setSubscription(e,{...t,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(e,t){const n=this._subscriptionsByHash[e]?.state;if(this._subscriptionsByHash[e]=t,n!==t.state){const n=this._subscriptionStateChangeCallbacksByHash[e];n&&n.forEach((e=>{try{e(t.state)}catch{}}))}}_onSubscriptionStateChange(e,t){const n=this._subscriptionHashByClientSubscriptionId[e];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(t),()=>{r.delete(t),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(e){e instanceof Error&&console.log(`Error when closing socket connection: ${e.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const e=this._rpcWebSocketGeneration,t=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async e=>{const n=this._subscriptionsByHash[e];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[e],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(e,{...n,state:"subscribing"});const t=await this._rpcWebSocket.call(i,r);this._setSubscription(e,{...n,serverSubscriptionId:t,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[t]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!t())return;this._setSubscription(e,{...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(e,{...n,state:"unsubscribing"}),this._setSubscription(e,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!t())return;return this._setSubscription(e,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(e,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(e,t){const n=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==n&&n.forEach((e=>{try{e(...t)}catch(e){console.error(e)}}))}_wsOnAccountNotification(e){const{result:t,subscription:n}=qe(e,mi);this._handleServerNotification(n,[t.value,t.context])}_makeSubscription(e,t){const n=this._nextClientSubscriptionId++,r=mr([e.method,t]),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...e,args:t,callbacks:new Set([e.callback]),state:"pending"}:i.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const t=this._subscriptionsByHash[r];An(void 0!==t,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),t.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(e,t,n){const{commitment:r,config:i}=Ir(n),o=this._buildArgs([e.toBase58()],r||this._commitment||"finalized","base64",i);return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},o)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){const{result:t,subscription:n}=qe(e,bi);this._handleServerNotification(n,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(e,t,n,r){const{commitment:i,config:o}=Ir(n),a=this._buildArgs([e.toBase58()],i||this._commitment||"finalized","base64",o||(r?{filters:r}:void 0));return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},a)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,t,n){const r=this._buildArgs(["object"==typeof e?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){const{result:t,subscription:n}=qe(e,lo);this._handleServerNotification(n,[t.value,t.context])}_wsOnSlotNotification(e){const{result:t,subscription:n}=qe(e,wi);this._handleServerNotification(n,[t])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){const{result:t,subscription:n}=qe(e,Ei);this._handleServerNotification(n,[t])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,t){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${t}' events could not be found.`)}_buildArgs(e,t,n,r){const i=t||this._commitment;if(i||n||r){let t={};n&&(t.encoding=n),i&&(t.commitment=i),r&&(t=Object.assign(t,r)),e.push(t)}return e}_buildArgsAtLeastConfirmed(e,t,n,r){const i=t||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(e,t,n,r)}_wsOnSignatureNotification(e){const{result:t,subscription:n}=qe(e,Si);"receivedSignature"!==t.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===t.value?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(e,t,n){const r=this._buildArgs([e],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(e,n)=>{if("status"===e.type){t(e.result,n);try{this.removeSignatureListener(i)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(e,t,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([e],r,void 0,i),a=this._makeSubscription({callback:(e,n)=>{t(e,n);try{this.removeSignatureListener(a)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return a}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){const{result:t,subscription:n}=qe(e,Ai);this._handleServerNotification(n,[t])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}}class po{constructor(e){this._keypair=void 0,this._keypair=e??Vt()}static generate(){return new po(Vt())}static fromSecretKey(e,t){if(64!==e.byteLength)throw new Error("bad secret key size");const n=e.slice(32,64);if(!t||!t.skipValidation){const t=e.slice(0,32),r=Zt(t);for(let e=0;e<32;e++)if(n[e]!==r[e])throw new Error("provided secretKey is invalid")}return new po({publicKey:n,secretKey:e})}static fromSeed(e){const t=Zt(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),new po({publicKey:t,secretKey:n})}get publicKey(){return new cn(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const yo=Object.freeze({CreateLookupTable:{index:0,layout:Be.n_([Be.Jq("instruction"),ir("recentSlot"),Be.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:Be.n_([Be.Jq("instruction")])},ExtendLookupTable:{index:2,layout:Be.n_([Be.Jq("instruction"),ir(),Be.A9(bn(),Be.cv(Be.Jq(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Be.n_([Be.Jq("instruction")])},CloseLookupTable:{index:4,layout:Be.n_([Be.Jq("instruction")])}});class mo{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Be.Jq("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(yo))if(r.index==t){n=e;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);const{recentSlot:t}=Qn(yo.CreateLookupTable,e.data);return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(t)}}static decodeExtendLookupTable(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error(`invalid instruction; found ${e.keys.length} keys, expected at least 2`);const{addresses:t}=Qn(yo.ExtendLookupTable,e.data);return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:t.map((e=>new cn(e)))}}static decodeCloseLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}static decodeFreezeLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static decodeDeactivateLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(go.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(e,t){if(e.lengthe.toBytes()))}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:sr.programId,isSigner:!1,isWritable:!1}),new Bn({programId:this.programId,keys:n,data:t})}static deactivateLookupTable(e){const t=Xn(yo.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new Bn({programId:this.programId,keys:n,data:t})}static closeLookupTable(e){const t=Xn(yo.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new Bn({programId:this.programId,keys:n,data:t})}}go.programId=new cn("AddressLookupTab1e1111111111111111111111111");class bo{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Be.u8("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(vo))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(e){this.checkProgramId(e.programId);const{units:t,additionalFee:n}=Qn(vo.RequestUnits,e.data);return{units:t,additionalFee:n}}static decodeRequestHeapFrame(e){this.checkProgramId(e.programId);const{bytes:t}=Qn(vo.RequestHeapFrame,e.data);return{bytes:t}}static decodeSetComputeUnitLimit(e){this.checkProgramId(e.programId);const{units:t}=Qn(vo.SetComputeUnitLimit,e.data);return{units:t}}static decodeSetComputeUnitPrice(e){this.checkProgramId(e.programId);const{microLamports:t}=Qn(vo.SetComputeUnitPrice,e.data);return{microLamports:t}}static checkProgramId(e){if(!e.equals(wo.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const vo=Object.freeze({RequestUnits:{index:0,layout:Be.n_([Be.u8("instruction"),Be.Jq("units"),Be.Jq("additionalFee")])},RequestHeapFrame:{index:1,layout:Be.n_([Be.u8("instruction"),Be.Jq("bytes")])},SetComputeUnitLimit:{index:2,layout:Be.n_([Be.u8("instruction"),Be.Jq("units")])},SetComputeUnitPrice:{index:3,layout:Be.n_([Be.u8("instruction"),ir("microLamports")])}});class wo{constructor(){}static requestUnits(e){const t=Xn(vo.RequestUnits,e);return new Bn({keys:[],programId:this.programId,data:t})}static requestHeapFrame(e){const t=Xn(vo.RequestHeapFrame,e);return new Bn({keys:[],programId:this.programId,data:t})}static setComputeUnitLimit(e){const t=Xn(vo.SetComputeUnitLimit,e);return new Bn({keys:[],programId:this.programId,data:t})}static setComputeUnitPrice(e){const t=Xn(vo.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new Bn({keys:[],programId:this.programId,data:t})}}wo.programId=new cn("ComputeBudget111111111111111111111111111111");const _o=Be.n_([Be.u8("numSignatures"),Be.u8("padding"),Be.KB("signatureOffset"),Be.KB("signatureInstructionIndex"),Be.KB("publicKeyOffset"),Be.KB("publicKeyInstructionIndex"),Be.KB("messageDataOffset"),Be.KB("messageDataSize"),Be.KB("messageInstructionIndex")]);class Eo{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:r,instructionIndex:o}=e;An(32===t.length,`Public Key must be 32 bytes but received ${t.length} bytes`),An(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const a=_o.span,s=a+t.length,c=s+r.length,u=i.Buffer.alloc(c+n.length),l=null==o?65535:o;return _o.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:l,publicKeyOffset:a,publicKeyInstructionIndex:l,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:l},u),u.fill(t,a),u.fill(r,s),u.fill(n,c),new Bn({keys:[],programId:Eo.programId,data:u})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:r}=e;An(64===t.length,`Private key must be 64 bytes but received ${t.length} bytes`);try{const e=po.fromSecretKey(t),i=e.publicKey.toBytes(),o=Jt(n,e.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(e){throw new Error(`Error creating instruction; ${e}`)}}}Eo.programId=new cn("Ed25519SigVerify111111111111111111111111111"),Gt.utils.isValidPrivateKey;const So=Gt.getPublicKey,Ao=Be.n_([Be.u8("numSignatures"),Be.KB("signatureOffset"),Be.u8("signatureInstructionIndex"),Be.KB("ethAddressOffset"),Be.u8("ethAddressInstructionIndex"),Be.KB("messageDataOffset"),Be.KB("messageDataSize"),Be.u8("messageInstructionIndex"),Be.Ik(20,"ethAddress"),Be.Ik(64,"signature"),Be.u8("recoveryId")]);class ko{constructor(){}static publicKeyToEthAddress(e){An(64===e.length,`Public key must be 64 bytes but received ${e.length} bytes`);try{return i.Buffer.from(Rt(Qt(e))).slice(-20)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:r,recoveryId:i,instructionIndex:o}=e;return ko.createInstructionWithEthAddress({ethAddress:ko.publicKeyToEthAddress(t),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:n,signature:r,recoveryId:o,instructionIndex:a=0}=e;let s;s="string"==typeof t?t.startsWith("0x")?i.Buffer.from(t.substr(2),"hex"):i.Buffer.from(t,"hex"):t,An(20===s.length,`Address must be 20 bytes but received ${s.length} bytes`);const c=12+s.length,u=c+r.length+1,l=i.Buffer.alloc(Ao.span+n.length);return Ao.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:a,ethAddressOffset:12,ethAddressInstructionIndex:a,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:a,signature:Qt(r),ethAddress:Qt(s),recoveryId:o},l),l.fill(Qt(n),Ao.span),new Bn({keys:[],programId:ko.programId,data:l})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:r}=e;An(32===t.length,`Private key must be 32 bytes but received ${t.length} bytes`);try{const e=Qt(t),o=So(e,!1).slice(1),a=i.Buffer.from(Rt(Qt(n))),[s,c]=((e,t)=>{const n=Gt.sign(e,t);return[n.toCompactRawBytes(),n.recovery]})(a,e);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:s,recoveryId:c,instructionIndex:r})}catch(e){throw new Error(`Error creating instruction; ${e}`)}}}var xo;ko.programId=new cn("KeccakSecp256k11111111111111111111111111111");const Oo=new cn("StakeConfig11111111111111111111111111111111");class Io{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class Ro{constructor(e,t,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=n}}xo=Ro,Ro.default=new xo(0,0,cn.default);class To{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Be.Jq("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(Po))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t,lockup:n}=Qn(Po.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new Io(new cn(t.staker),new cn(t.withdrawer)),lockup:new Ro(n.unixTimestamp,n.epoch,new cn(n.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),Qn(Po.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:t,stakeAuthorizationType:n}=Qn(Po.Authorize,e.data),r={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new cn(t),stakeAuthorizationType:{index:n}};return e.keys.length>3&&(r.custodianPubkey=e.keys[3].pubkey),r}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{newAuthorized:t,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=Qn(Po.AuthorizeWithSeed,e.data),o={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:r,authorityOwner:new cn(i),newAuthorizedPubkey:new cn(t),stakeAuthorizationType:{index:n}};return e.keys.length>3&&(o.custodianPubkey=e.keys[3].pubkey),o}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=Qn(Po.Split,e.data);return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}static decodeMerge(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Qn(Po.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=Qn(Po.Withdraw,e.data),n={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(n.custodianPubkey=e.keys[5].pubkey),n}static decodeDeactivate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Qn(Po.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(No.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,t){if(e.lengthBe.n_([bn("staker"),bn("withdrawer")],e))(),((e="lockup")=>Be.n_([Be.gM("unixTimestamp"),Be.gM("epoch"),bn("custodian")],e))()])},Authorize:{index:1,layout:Be.n_([Be.Jq("instruction"),bn("newAuthorized"),Be.Jq("stakeAuthorizationType")])},Delegate:{index:2,layout:Be.n_([Be.Jq("instruction")])},Split:{index:3,layout:Be.n_([Be.Jq("instruction"),Be.gM("lamports")])},Withdraw:{index:4,layout:Be.n_([Be.Jq("instruction"),Be.gM("lamports")])},Deactivate:{index:5,layout:Be.n_([Be.Jq("instruction")])},Merge:{index:7,layout:Be.n_([Be.Jq("instruction")])},AuthorizeWithSeed:{index:8,layout:Be.n_([Be.Jq("instruction"),bn("newAuthorized"),Be.Jq("stakeAuthorizationType"),wn("authoritySeed"),bn("authorityOwner")])}}),Co=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class No{constructor(){}static initialize(e){const{stakePubkey:t,authorized:n,lockup:r}=e,i=r||Ro.default,o=Xn(Po.Initialize,{authorized:{staker:Qt(n.staker.toBuffer()),withdrawer:Qt(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Qt(i.custodian.toBuffer())}}),a={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Wn,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new Bn(a)}static createAccountWithSeed(e){const t=new Mn;t.add(sr.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=e;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(e){const t=new Mn;t.add(sr.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=e;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:n,votePubkey:r}=e,i=Xn(Po.Delegate);return(new Mn).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:zn,isSigner:!1,isWritable:!1},{pubkey:Gn,isSigner:!1,isWritable:!1},{pubkey:Oo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(e){const{stakePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=e,a=Xn(Po.Authorize,{newAuthorized:Qt(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:zn,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:s,programId:this.programId,data:a})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:a,custodianPubkey:s}=e,c=Xn(Po.AuthorizeWithSeed,{newAuthorized:Qt(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:Qt(i.toBuffer())}),u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:zn,isSigner:!1,isWritable:!1}];return s&&u.push({pubkey:s,isSigner:!0,isWritable:!1}),(new Mn).add({keys:u,programId:this.programId,data:c})}static splitInstruction(e){const{stakePubkey:t,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=e,o=Xn(Po.Split,{lamports:i});return new Bn({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(e,t){const n=new Mn;return n.add(sr.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:t,space:this.space,programId:this.programId})),n.add(this.splitInstruction(e))}static splitWithSeed(e,t){const{stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,basePubkey:o,seed:a,lamports:s}=e,c=new Mn;return c.add(sr.allocate({accountPubkey:i,basePubkey:o,seed:a,space:this.space,programId:this.programId})),t&&t>0&&c.add(sr.transfer({fromPubkey:e.authorizedPubkey,toPubkey:i,lamports:t})),c.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,lamports:s}))}static merge(e){const{stakePubkey:t,sourceStakePubKey:n,authorizedPubkey:r}=e,i=Xn(Po.Merge);return(new Mn).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:zn,isSigner:!1,isWritable:!1},{pubkey:Gn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=e,a=Xn(Po.Withdraw,{lamports:i}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:zn,isSigner:!1,isWritable:!1},{pubkey:Gn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!0,isWritable:!1}),(new Mn).add({keys:s,programId:this.programId,data:a})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:n}=e,r=Xn(Po.Deactivate);return(new Mn).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:zn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}No.programId=new cn("Stake11111111111111111111111111111111111111"),No.space=200;class Bo{constructor(e,t,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=t,this.authorizedWithdrawer=n,this.commission=r}}class Mo{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Be.Jq("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(Lo))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);const{voteInit:t}=Qn(Lo.InitializeAccount,e.data);return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new Bo(new cn(t.nodePubkey),new cn(t.authorizedVoter),new cn(t.authorizedWithdrawer),t.commission)}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:t,voteAuthorizationType:n}=Qn(Lo.Authorize,e.data);return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new cn(t),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:t,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=Qn(Lo.AuthorizeWithSeed,e.data);return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new cn(t),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new cn(r),voteAuthorizationType:{index:i},votePubkey:e.keys[0].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=Qn(Lo.Withdraw,e.data);return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:t,toPubkey:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(zo.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(e,t){if(e.lengthBe.n_([bn("nodePubkey"),bn("authorizedVoter"),bn("authorizedWithdrawer"),Be.u8("commission")],e))()])},Authorize:{index:1,layout:Be.n_([Be.Jq("instruction"),bn("newAuthorized"),Be.Jq("voteAuthorizationType")])},Withdraw:{index:3,layout:Be.n_([Be.Jq("instruction"),Be.gM("lamports")])},UpdateValidatorIdentity:{index:4,layout:Be.n_([Be.Jq("instruction")])},AuthorizeWithSeed:{index:10,layout:Be.n_([Be.Jq("instruction"),((e="voteAuthorizeWithSeedArgs")=>Be.n_([Be.Jq("voteAuthorizationType"),bn("currentAuthorityDerivedKeyOwnerPubkey"),wn("currentAuthorityDerivedKeySeed"),bn("newAuthorized")],e))()])}}),Do=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class zo{constructor(){}static initializeAccount(e){const{votePubkey:t,nodePubkey:n,voteInit:r}=e,i=Xn(Lo.InitializeAccount,{voteInit:{nodePubkey:Qt(r.nodePubkey.toBuffer()),authorizedVoter:Qt(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Qt(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Wn,isSigner:!1,isWritable:!1},{pubkey:zn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Bn(o)}static createAccount(e){const t=new Mn;return t.add(sr.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){const{votePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=e,o=Xn(Lo.Authorize,{newAuthorized:Qt(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:zn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:a,programId:this.programId,data:o})}static authorizeWithSeed(e){const{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:a}=e,s=Xn(Lo.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Qt(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Qt(i.toBuffer()),voteAuthorizationType:o.index}}),c=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:zn,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:c,programId:this.programId,data:s})}static withdraw(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=e,o=Xn(Lo.Withdraw,{lamports:r}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:a,programId:this.programId,data:o})}static safeWithdraw(e,t,n){if(e.lamports>t-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return zo.withdraw(e)}static updateValidatorIdentity(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,nodePubkey:r}=e,i=Xn(Lo.UpdateValidatorIdentity),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Mn).add({keys:o,programId:this.programId,data:i})}}zo.programId=new cn("Vote111111111111111111111111111111111111111"),zo.space=3762;const jo=new cn("Va1idator1nfo111111111111111111111111111111"),Uo=it({name:nt(),website:et(nt()),details:et(nt()),keybaseUsername:et(nt())});class Fo{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let t=[...e];if(2!==En(t))return null;const n=[];for(let e=0;e<2;e++){const e=new cn(In(t,0,an)),r=1===On(t);n.push({publicKey:e,isSigner:r})}if(n[0].publicKey.equals(jo)&&n[1].isSigner){const e=wn().decode(i.Buffer.from(t)),r=JSON.parse(e);return He(r,Uo),new Fo(n[1].publicKey,r)}return null}}const Wo=new cn("Vote111111111111111111111111111111111111111"),Ho=Be.n_([bn("nodePubkey"),bn("authorizedWithdrawer"),Be.u8("commission"),Be._O(),Be.A9(Be.n_([Be._O("slot"),Be.Jq("confirmationCount")]),Be.cv(Be.Jq(),-8),"votes"),Be.u8("rootSlotValid"),Be._O("rootSlot"),Be._O(),Be.A9(Be.n_([Be._O("epoch"),bn("authorizedVoter")]),Be.cv(Be.Jq(),-8),"authorizedVoters"),Be.n_([Be.A9(Be.n_([bn("authorizedPubkey"),Be._O("epochOfLastAuthorizedSwitch"),Be._O("targetEpoch")]),32,"buf"),Be._O("idx"),Be.u8("isEmpty")],"priorVoters"),Be._O(),Be.A9(Be.n_([Be._O("epoch"),Be._O("credits"),Be._O("prevCredits")]),Be.cv(Be.Jq(),-8),"epochCredits"),Be.n_([Be._O("slot"),Be._O("timestamp")],"lastTimestamp")]);class qo{constructor(e){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=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}static fromAccountData(e){const t=Ho.decode(Qt(e),4);let n=t.rootSlot;return t.rootSlotValid||(n=null),new qo({nodePubkey:new cn(t.nodePubkey),authorizedWithdrawer:new cn(t.authorizedWithdrawer),commission:t.commission,votes:t.votes,rootSlot:n,authorizedVoters:t.authorizedVoters.map(Ko),priorVoters:$o(t.priorVoters),epochCredits:t.epochCredits,lastTimestamp:t.lastTimestamp})}}function Ko({authorizedVoter:e,epoch:t}){return{epoch:t,authorizedVoter:new cn(e)}}function Go({authorizedPubkey:e,epochOfLastAuthorizedSwitch:t,targetEpoch:n}){return{authorizedPubkey:new cn(e),epochOfLastAuthorizedSwitch:t,targetEpoch:n}}function $o({buf:e,idx:t,isEmpty:n}){return n?[]:[...e.slice(t+1).map(Go),...e.slice(0,t).map(Go)]}const Vo={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 Zo(e,t){const n=!1===t?"http":"https";if(!e)return Vo[n].devnet;const r=Vo[n][e];if(!r)throw new Error(`Unknown ${n} cluster: ${e}`);return r}async function Yo(e,t,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 a=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},s=await e.sendRawTransaction(t,a),c=o&&o.commitment,u=i?e.confirmTransaction(i,c):e.confirmTransaction(s,c),l=(await u).value;if(l.err){if(null!=s)throw new $n({action:a?.skipPreflight?"send":"simulate",signature:s,transactionMessage:`Status: (${JSON.stringify(l)})`});throw new Error(`Raw transaction ${s} failed (${JSON.stringify(l)})`)}return s}const Jo=1e9},8811:e=>{"use strict";var t={white:37,black:30,blue:34,cyan:36,green:32,magenta:35,red:31,yellow:33,brightBlack:90,brightRed:91,brightGreen:92,brightYellow:93,brightBlue:94,brightMagenta:95,brightCyan:96,brightWhite:97},n={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBrightBlack:100,bgBrightRed:101,bgBrightGreen:102,bgBrightYellow:103,bgBrightBlue:104,bgBrightMagenta:105,bgBrightCyan:106,bgBrightWhite:107},r={},i={},o={};Object.keys(t).forEach((function(e){var n=r[e]="["+t[e]+"m",a=i[e]="";o[e]=function(e){return n+e+a}})),Object.keys(n).forEach((function(e){var t=r[e]="["+n[e]+"m",a=i[e]="";o[e]=function(e){return t+e+a}})),e.exports=o,o.open=r,o.close=i},9282:(e,t,n)=>{"use strict";var r=n(4155);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var n=0;n1?n-1:0),i=1;i1?n-1:0),i=1;i1?n-1:0),i=1;i1?n-1:0),i=1;i{"use strict";var r=n(4155);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;te.length)&&(n=e.length),e.substring(n-t.length,n)===t}var v="",w="",_="",E="",S={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function A(e){var t=Object.keys(e),n=Object.create(Object.getPrototypeOf(e));return t.forEach((function(t){n[t]=e[t]})),Object.defineProperty(n,"message",{value:e.message}),n}function k(e){return m(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var x=function(e,t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(x,e);var n,i,s,l,d=(n=x,i=f(),function(){var e,t=p(n);if(i){var r=p(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return c(this,e)});function x(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,x),"object"!==y(e)||null===e)throw new g("options","Object",e);var n=e.message,i=e.operator,o=e.stackStartFn,a=e.actual,s=e.expected,l=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=n)t=d.call(this,String(n));else if(r.stderr&&r.stderr.isTTY&&(r.stderr&&r.stderr.getColorDepth&&1!==r.stderr.getColorDepth()?(v="",w="",E="",_=""):(v="",w="",E="",_="")),"object"===y(a)&&null!==a&&"object"===y(s)&&null!==s&&"stack"in a&&a instanceof Error&&"stack"in s&&s instanceof Error&&(a=A(a),s=A(s)),"deepStrictEqual"===i||"strictEqual"===i)t=d.call(this,function(e,t,n){var i="",o="",a=0,s="",c=!1,u=k(e),l=u.split("\n"),d=k(t).split("\n"),f=0,h="";if("strictEqual"===n&&"object"===y(e)&&"object"===y(t)&&null!==e&&null!==t&&(n="strictEqualObject"),1===l.length&&1===d.length&&l[0]!==d[0]){var p=l[0].length+d[0].length;if(p<=10){if(!("object"===y(e)&&null!==e||"object"===y(t)&&null!==t||0===e&&0===t))return"".concat(S[n],"\n\n")+"".concat(l[0]," !== ").concat(d[0],"\n")}else if("strictEqualObject"!==n&&p<(r.stderr&&r.stderr.isTTY?r.stderr.columns:80)){for(;l[0][f]===d[0][f];)f++;f>2&&(h="\n ".concat(function(e,t){if(t=Math.floor(t),0==e.length||0==t)return"";var n=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+e.substring(0,n-e.length)}(" ",f),"^"),f=0)}}for(var m=l[l.length-1],g=d[d.length-1];m===g&&(f++<2?s="\n ".concat(m).concat(s):i=m,l.pop(),d.pop(),0!==l.length&&0!==d.length);)m=l[l.length-1],g=d[d.length-1];var A=Math.max(l.length,d.length);if(0===A){var x=u.split("\n");if(x.length>30)for(x[26]="".concat(v,"...").concat(E);x.length>27;)x.pop();return"".concat(S.notIdentical,"\n\n").concat(x.join("\n"),"\n")}f>3&&(s="\n".concat(v,"...").concat(E).concat(s),c=!0),""!==i&&(s="\n ".concat(i).concat(s),i="");var O=0,I=S[n]+"\n".concat(w,"+ actual").concat(E," ").concat(_,"- expected").concat(E),R=" ".concat(v,"...").concat(E," Lines skipped");for(f=0;f1&&f>2&&(T>4?(o+="\n".concat(v,"...").concat(E),c=!0):T>3&&(o+="\n ".concat(d[f-2]),O++),o+="\n ".concat(d[f-1]),O++),a=f,i+="\n".concat(_,"-").concat(E," ").concat(d[f]),O++;else if(d.length1&&f>2&&(T>4?(o+="\n".concat(v,"...").concat(E),c=!0):T>3&&(o+="\n ".concat(l[f-2]),O++),o+="\n ".concat(l[f-1]),O++),a=f,o+="\n".concat(w,"+").concat(E," ").concat(l[f]),O++;else{var P=d[f],C=l[f],N=C!==P&&(!b(C,",")||C.slice(0,-1)!==P);N&&b(P,",")&&P.slice(0,-1)===C&&(N=!1,C+=","),N?(T>1&&f>2&&(T>4?(o+="\n".concat(v,"...").concat(E),c=!0):T>3&&(o+="\n ".concat(l[f-2]),O++),o+="\n ".concat(l[f-1]),O++),a=f,o+="\n".concat(w,"+").concat(E," ").concat(C),i+="\n".concat(_,"-").concat(E," ").concat(P),O+=2):(o+=i,i="",1!==T&&0!==f||(o+="\n ".concat(C),O++))}if(O>20&&f30)for(h[26]="".concat(v,"...").concat(E);h.length>27;)h.pop();t=1===h.length?d.call(this,"".concat(f," ").concat(h[0])):d.call(this,"".concat(f,"\n\n").concat(h.join("\n"),"\n"))}else{var p=k(a),m="",O=S[i];"notDeepEqual"===i||"notEqual"===i?(p="".concat(S[i],"\n\n").concat(p)).length>1024&&(p="".concat(p.slice(0,1021),"...")):(m="".concat(k(s)),p.length>512&&(p="".concat(p.slice(0,509),"...")),m.length>512&&(m="".concat(m.slice(0,509),"...")),"deepEqual"===i||"equal"===i?p="".concat(O,"\n\n").concat(p,"\n\nshould equal\n\n"):m=" ".concat(i," ").concat(m)),t=d.call(this,"".concat(p).concat(m))}return Error.stackTraceLimit=l,t.generatedMessage=!n,Object.defineProperty(u(t),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),t.code="ERR_ASSERTION",t.actual=a,t.expected=s,t.operator=i,Error.captureStackTrace&&Error.captureStackTrace(u(t),o),t.stack,t.name="AssertionError",c(t)}return s=x,(l=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:t,value:function(e,t){return m(this,o(o({},t),{},{customInspect:!1,depth:0}))}}])&&a(s.prototype,l),Object.defineProperty(s,"prototype",{writable:!1}),x}(l(Error),m.custom);e.exports=x},2136:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var a,s,c={};function u(e,t,n){n||(n=Error);var a=function(n){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(l,n);var a,s,c,u=(s=l,c=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(e){return!1}}(),function(){var e,t=o(s);if(c){var n=o(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function l(n,r,i){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),o=u.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i)),o.code=e,o}return a=l,Object.defineProperty(a,"prototype",{writable:!1}),a}(n);c[e]=a}function l(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}u("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),u("ERR_INVALID_ARG_TYPE",(function(e,t,i){var o,s,c,u,d;if(void 0===a&&(a=n(9282)),a("string"==typeof e,"'name' must be a string"),"string"==typeof t&&(s="not ",t.substr(0,4)===s)?(o="must not be",t=t.replace(/^not /,"")):o="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-9,n)===t}(e," argument"))c="The ".concat(e," ").concat(o," ").concat(l(t,"type"));else{var f=("number"!=typeof d&&(d=0),d+1>(u=e).length||-1===u.indexOf(".",d)?"argument":"property");c='The "'.concat(e,'" ').concat(f," ").concat(o," ").concat(l(t,"type"))}return c+". Received type ".concat(r(i))}),TypeError),u("ERR_INVALID_ARG_VALUE",(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===s&&(s=n(9539));var i=s.inspect(t);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(r,". Received ").concat(i)}),TypeError,RangeError),u("ERR_INVALID_RETURN_VALUE",(function(e,t,n){var i;return i=n&&n.constructor&&n.constructor.name?"instance of ".concat(n.constructor.name):"type ".concat(r(n)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(i,".")}),TypeError),u("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),r=0;r0,"At least one arg needs to be specified");var i="The ",o=t.length;switch(t=t.map((function(e){return'"'.concat(e,'"')})),o){case 1:i+="".concat(t[0]," argument");break;case 2:i+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:i+=t.slice(0,o-1).join(", "),i+=", and ".concat(t[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),e.exports.codes=c},9158:(e,t,n)=>{"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n10)return!0;for(var t=0;t57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function N(e){return Object.keys(e).filter(C).concat(l(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function B(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i{"use strict";var r=n(9509).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n>>0,l=new Uint8Array(a);e[n];){var d=t[e.charCodeAt(n)];if(255===d)return;for(var f=0,h=a-1;(0!==d||f>>0,l[h]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");o=f,n++}for(var p=a-o;p!==a&&0===l[p];)p++;var y=r.allocUnsafe(i+(a-p));y.fill(0,0,i);for(var m=i;p!==a;)y[m++]=l[p++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,i=0,o=0,a=t.length;o!==a&&0===t[o];)o++,n++;for(var u=(a-o)*l+1>>>0,d=new Uint8Array(u);o!==a;){for(var f=t[o],h=0,p=u-1;(0!==f||h>>0,d[p]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");i=h,o++}for(var y=u-i;y!==u&&0===d[y];)y++;for(var m=c.repeat(n);y{"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,o=s(e),a=o[0],c=o[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t),1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,u=r-i;su?u:s+a));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=o[a],r[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,r){for(var i,o,a=[],s=t;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},475:(e,t,n)=>{"use strict";var r=n(8764).Buffer;t.oU=function(e){{const t=r.from(e);t.reverse();const n=t.toString("hex");return 0===n.length?BigInt(0):BigInt(`0x${n}`)}},t.k$=function(e,t){{const n=e.toString(16),i=r.from(n.padStart(2*t,"0").slice(0,2*t),"hex");return i.reverse(),i}}},3550:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(6601).Buffer}catch(e){}function s(e,t){var n=e.charCodeAt(t);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 "+e)}function c(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,a=0,s=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=c(e,t,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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")]=d}catch(e){o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var f=["","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"],h=[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 y(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),n=0!==o||a!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=p[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var y=d.modrn(l).toString(e);n=(d=d.idivn(l)).isZero()?y+n:f[u-y.length]+y+n}for(this.isZero()&&(n="0"+n);n.length%t!=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 e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,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 a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(e,t){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=a>>>24,o+=2)}if(n=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 8191&t||(n+=13,t>>>=13),127&t||(n+=7,t>>>=7),15&t||(n+=4,t>>>=4),3&t||(n+=2,t>>>=2),1&t||n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,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(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,y=h>>>13,m=0|a[2],g=8191&m,b=m>>>13,v=0|a[3],w=8191&v,_=v>>>13,E=0|a[4],S=8191&E,A=E>>>13,k=0|a[5],x=8191&k,O=k>>>13,I=0|a[6],R=8191&I,T=I>>>13,P=0|a[7],C=8191&P,N=P>>>13,B=0|a[8],M=8191&B,L=B>>>13,D=0|a[9],z=8191&D,j=D>>>13,U=0|s[0],F=8191&U,W=U>>>13,H=0|s[1],q=8191&H,K=H>>>13,G=0|s[2],$=8191&G,V=G>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,ee=X>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,fe=le>>>13,he=0|s[9],pe=8191&he,ye=he>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(u+(r=Math.imul(d,F))|0)+((8191&(i=(i=Math.imul(d,W))+Math.imul(f,F)|0))<<13)|0;u=((o=Math.imul(f,W))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(y,F)|0,o=Math.imul(y,W);var ge=(u+(r=r+Math.imul(d,q)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,q)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,F),i=(i=Math.imul(g,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(y,q)|0,o=o+Math.imul(y,K)|0;var be=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,$)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(_,F)|0,o=Math.imul(_,W),r=r+Math.imul(g,q)|0,i=(i=i+Math.imul(g,K)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,V)|0;var ve=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(f,Y)|0))<<13)|0;u=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(w,q)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,K)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0;var we=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(x,F),i=(i=Math.imul(x,W))+Math.imul(O,F)|0,o=Math.imul(O,W),r=r+Math.imul(S,q)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,V)|0,r=r+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0;var _e=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;u=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(T,F)|0,o=Math.imul(T,W),r=r+Math.imul(x,q)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,r=r+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ee=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(f,oe)|0))<<13)|0;u=((o=o+Math.imul(f,ae)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(C,F),i=(i=Math.imul(C,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(R,q)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,K)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(b,ne)|0,o=o+Math.imul(b,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Se=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((o=o+Math.imul(f,ue)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(M,F),i=(i=Math.imul(M,W))+Math.imul(L,F)|0,o=Math.imul(L,W),r=r+Math.imul(C,q)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(R,$)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,V)|0,r=r+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0;var Ae=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(z,F),i=(i=Math.imul(z,W))+Math.imul(j,F)|0,o=Math.imul(j,W),r=r+Math.imul(M,q)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,r=r+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,ue)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var ke=(u+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ye)|0)+Math.imul(f,pe)|0))<<13)|0;u=((o=o+Math.imul(f,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(z,q),i=(i=Math.imul(z,K))+Math.imul(j,q)|0,o=Math.imul(j,K),r=r+Math.imul(M,$)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,V)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,r=r+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,r=r+Math.imul(g,de)|0,i=(i=i+Math.imul(g,fe)|0)+Math.imul(b,de)|0,o=o+Math.imul(b,fe)|0;var xe=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(z,$),i=(i=Math.imul(z,V))+Math.imul(j,$)|0,o=Math.imul(j,V),r=r+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(T,ne)|0,o=o+Math.imul(T,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,fe)|0;var Oe=(u+(r=r+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(b,pe)|0))<<13)|0;u=((o=o+Math.imul(b,ye)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(z,Y),i=(i=Math.imul(z,J))+Math.imul(j,Y)|0,o=Math.imul(j,J),r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,ae)|0,r=r+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,de)|0,i=(i=i+Math.imul(S,fe)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,fe)|0;var Ie=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ye)|0)+Math.imul(_,pe)|0))<<13)|0;u=((o=o+Math.imul(_,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,ee))+Math.imul(j,Q)|0,o=Math.imul(j,ee),r=r+Math.imul(M,ne)|0,i=(i=i+Math.imul(M,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(T,ce)|0,o=o+Math.imul(T,ue)|0,r=r+Math.imul(x,de)|0,i=(i=i+Math.imul(x,fe)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,fe)|0;var Re=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ye)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,ye)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(z,ne),i=(i=Math.imul(z,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(N,ce)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(R,de)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(T,de)|0,o=o+Math.imul(T,fe)|0;var Te=(u+(r=r+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(z,oe),i=(i=Math.imul(z,ae))+Math.imul(j,oe)|0,o=Math.imul(j,ae),r=r+Math.imul(M,ce)|0,i=(i=i+Math.imul(M,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(N,de)|0,o=o+Math.imul(N,fe)|0;var Pe=(u+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,ye)|0)+Math.imul(T,pe)|0))<<13)|0;u=((o=o+Math.imul(T,ye)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(z,ce),i=(i=Math.imul(z,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),r=r+Math.imul(M,de)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Ce=(u+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(z,de),i=(i=Math.imul(z,fe))+Math.imul(j,de)|0,o=Math.imul(j,fe);var Ne=(u+(r=r+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,ye)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ye)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Be=(u+(r=Math.imul(z,pe))|0)+((8191&(i=(i=Math.imul(z,ye))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,ye))+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,c[0]=me,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ee,c[7]=Se,c[8]=Ae,c[9]=ke,c[10]=xe,c[11]=Oe,c[12]=Ie,c[13]=Re,c[14]=Te,c[15]=Pe,c[16]=Ce,c[17]=Ne,c[18]=Be,0!==u&&(c[19]=u,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function b(e,t,n){return g(e,t,n)}function v(e,t){this.x=e,this.y=t}Math.imul||(m=y),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?y(this,e,t):n<1024?g(this,e,t):b(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},v.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,c=r.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(i,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;!(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(n.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(c)):(n.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,f=1;!(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new x(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){x.call(this,e),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)}_.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},i(E,_),E.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new E;else if("p224"===e)t=new S;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new k}return w[e]=t,t},x.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},x.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},x.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},x.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},x.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},x.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},x.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},x.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},x.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},x.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},x.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},x.prototype.isqr=function(e){return this.imul(e,e.clone())},x.prototype.sqr=function(e){return this.mul(e,e)},x.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=a;0!==h.cmp(s);){for(var y=h,m=0;0!==y.cmp(s);m++)y=y.redSqr();r(m=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}c=26}return i},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,x),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),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)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},5532:function(e,t,n){"use strict";var r=n(8764).Buffer,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeUnchecked=t.deserialize=t.serialize=t.BinaryReader=t.BinaryWriter=t.BorshError=t.baseDecode=t.baseEncode=void 0;const u=c(n(3550)),l=c(n(7191)),d=s(n(1379)),f=new("function"!=typeof TextDecoder?d.TextDecoder:TextDecoder)("utf-8",{fatal:!0});t.baseEncode=function(e){return"string"==typeof e&&(e=r.from(e,"utf8")),l.default.encode(r.from(e))},t.baseDecode=function(e){return r.from(l.default.decode(e))};const h=1024;class p extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}t.BorshError=p;class y{constructor(){this.buf=r.alloc(h),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=r.concat([this.buf,r.alloc(h)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",64)))}writeBuffer(e){this.buf=r.concat([r.from(this.buf.subarray(0,this.length)),e,r.alloc(h)]),this.length+=e.length}writeString(e){this.maybeResize();const t=r.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(r.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const n of e)this.maybeResize(),t(n)}toArray(){return this.buf.subarray(0,this.length)}}function m(e,t,n){const r=n.value;n.value=function(...e){try{return r.apply(this,e)}catch(e){if(e instanceof RangeError){const t=e.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t)>=0)throw new p("Reached the end of buffer when deserializing")}throw e}}}t.BinaryWriter=y;class g{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){const e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new u.default(e,"le")}readU128(){const e=this.readBuffer(16);return new u.default(e,"le")}readU256(){const e=this.readBuffer(32);return new u.default(e,"le")}readU512(){const e=this.readBuffer(64);return new u.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new p(`Expected buffer length ${e} isn't within bounds`);const t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){const e=this.readU32(),t=this.readBuffer(e);try{return f.decode(t)}catch(e){throw new p(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),n=Array();for(let r=0;r{v(e,t,n,r[0],i)}));else if(void 0!==r.kind)switch(r.kind){case"option":null==n?i.writeU8(0):(i.writeU8(1),v(e,t,n,r.type,i));break;case"map":i.writeU32(n.size),n.forEach(((n,o)=>{v(e,t,o,r.key,i),v(e,t,n,r.value,i)}));break;default:throw new p(`FieldType ${r} unrecognized`)}else w(e,n,i)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}function w(e,t,n){if("function"==typeof t.borshSerialize)return void t.borshSerialize(n);const r=e.get(t.constructor);if(!r)throw new p(`Class ${t.constructor.name} is missing in schema`);if("struct"===r.kind)r.fields.map((([r,i])=>{v(e,r,t[r],i,n)}));else{if("enum"!==r.kind)throw new p(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`);{const i=t[r.field];for(let o=0;o_(e,t,n[0],r)))}if("option"===n.kind)return r.readU8()?_(e,t,n.type,r):void 0;if("map"===n.kind){let i=new Map;const o=r.readU32();for(let a=0;a=r.values.length)throw new p(`Enum index: ${i} is out of range`);const[o,a]=r.values[i],s=_(e,o,a,n);return new t({[o]:s})}throw new p(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}a([m],g.prototype,"readU8",null),a([m],g.prototype,"readU16",null),a([m],g.prototype,"readU32",null),a([m],g.prototype,"readU64",null),a([m],g.prototype,"readU128",null),a([m],g.prototype,"readU256",null),a([m],g.prototype,"readU512",null),a([m],g.prototype,"readString",null),a([m],g.prototype,"readFixedArray",null),a([m],g.prototype,"readArray",null),t.BinaryReader=g,t.serialize=function(e,t,n=y){const r=new n;return w(e,t,r),r.toArray()},t.deserialize=function(e,t,n,r=g){const i=new r(n),o=E(e,t,i);if(i.offset{var r=n(8162);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},698:(e,t,n)=>{"use strict";var r=n(8764).Buffer;class i{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function o(e,t){return t.property?e+"["+t.property+"]":e}t.Layout=i,t.nameWithProperty=o,t.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(e.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof i))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};class a extends i{isCount(){throw new Error("ExternalLayout is abstract")}}class s extends a{constructor(e,t){if(void 0===e&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t){void 0===t&&(t=0);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}class c extends a{constructor(e,t,n){if(!(e instanceof i))throw new TypeError("layout must be a Layout");if(void 0===t)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof u||this.layout instanceof l}decode(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}class u extends i{constructor(e,t){if(super(e,t),6e+r.encode(i,t,n+e)),0);return this.count instanceof a&&this.count.encode(e.length,t,n),i}}class k extends i{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof i),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t){void 0===t&&(t=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let a=r.span;if(o=0a&&(a=r.getSpan(t,n)))}i=n,n+=a}return i+o-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?t=-1:0<=t&&(t+=n.span)}}}class x{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class O extends x{constructor(e,t){if(!(e instanceof a&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class I extends i{constructor(e,t,n){const r=e instanceof u||e instanceof l;if(r)e=new O(new c(e));else if(e instanceof a&&e.isCount())e=new O(e);else if(!(e instanceof x))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof i))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&r&&(o+=e.layout.span)),super(o,n),this.discriminator=e,this.usesPrefixDiscriminator=r,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return s(e)},this.configGetSourceVariant=function(e){s=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;void 0===t&&(t=0);const r=this.discriminator,i=r.decode(e,t);let o=this.registry[i];if(void 0===o){let a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(e,t+a)}else n=o.decode(e,t);return n}encode(e,t,n){void 0===n&&(n=0);const r=this.getSourceVariant(e);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(e[r.property],t,n),o+i.encode(e[i.property],t,n+o)}return r.encode(e,t,n)}addVariant(e,t,n){const r=new R(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return r.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class R extends i{constructor(e,t,n,r){if(!(e instanceof I))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)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!==e.defaultLayout&&0<=n.span&&n.span>e.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=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))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(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function T(e){return 0>e&&(e+=4294967296),e}class P extends i{constructor(e,t,n){if(!(e instanceof u||e instanceof l))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===n&&(n=t,t=void 0),4=t)throw new TypeError("bits must be positive integer");const r=8*e.span,i=e.fields.reduce(((e,t)=>e+t.bits),0);if(t+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=e,this.bits=t,this.valueMask=(1<>>this.start}encode(e){if(!Number.isInteger(e)||e!==T(e&this.valueMask))throw new TypeError(o("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=T(e<n&&(n=this.length.decode(e,t)),n}decode(e,t){void 0===t&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let i=this.length;if(this.length instanceof a&&(i=e.length),!r.isBuffer(e)||i!==e.length)throw new TypeError(o("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,i,"hex"),this.length instanceof a&&this.length.encode(i,t,n),i}}class M extends i{constructor(e){super(-1,e)}getSpan(e,t){if(!r.isBuffer(e))throw new TypeError("b must be a Buffer");void 0===t&&(t=0);let n=t;for(;nt.length)throw new RangeError("encoding overruns Buffer");return i.copy(t,n),t[n+o]=0,o+1}}class L extends i{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t){if(!r.isBuffer(e))throw new TypeError("b must be a Buffer");return void 0===t&&(t=0),e.length-t}decode(e,t,n){void 0===t&&(t=0);let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpant.length)throw new RangeError("encoding overruns Buffer");return i.copy(t,n),o}}class D extends i{constructor(e,t){super(0,t),this.value=e}decode(e,t,n){return this.value}encode(e,t,n){return 0}}t.ExternalLayout=a,t.GreedyCount=s,t.OffsetLayout=c,t.UInt=u,t.UIntBE=l,t.Int=d,t.IntBE=f,t.Float=w,t.FloatBE=_,t.Double=E,t.DoubleBE=S,t.Sequence=A,t.Structure=k,t.UnionDiscriminator=x,t.UnionLayoutDiscriminator=O,t.Union=I,t.VariantLayout=R,t.BitStructure=P,t.BitField=C,t.Boolean=N,t.Blob=B,t.CString=M,t.UTF8=L,t.Constant=D,t.greedy=(e,t)=>new s(e,t),t.offset=(e,t,n)=>new c(e,t,n),t.u8=e=>new u(1,e),t.u16=e=>new u(2,e),t.u24=e=>new u(3,e),t.u32=e=>new u(4,e),t.u40=e=>new u(5,e),t.u48=e=>new u(6,e),t.nu64=e=>new m(e),t.u16be=e=>new l(2,e),t.u24be=e=>new l(3,e),t.u32be=e=>new l(4,e),t.u40be=e=>new l(5,e),t.u48be=e=>new l(6,e),t.nu64be=e=>new g(e),t.s8=e=>new d(1,e),t.s16=e=>new d(2,e),t.s24=e=>new d(3,e),t.s32=e=>new d(4,e),t.s40=e=>new d(5,e),t.s48=e=>new d(6,e),t.ns64=e=>new b(e),t.s16be=e=>new f(2,e),t.s24be=e=>new f(3,e),t.s32be=e=>new f(4,e),t.s40be=e=>new f(5,e),t.s48be=e=>new f(6,e),t.ns64be=e=>new v(e),t.f32=e=>new w(e),t.f32be=e=>new _(e),t.f64=e=>new E(e),t.f64be=e=>new S(e),t.struct=(e,t,n)=>new k(e,t,n),t.bits=(e,t,n)=>new P(e,t,n),t.seq=(e,t,n)=>new A(e,t,n),t.union=(e,t,n)=>new I(e,t,n),t.unionLayoutDiscriminator=(e,t)=>new O(e,t),t.blob=(e,t)=>new B(e,t),t.cstr=e=>new M(e),t.utf8=(e,t)=>new L(e,t),t.const=(e,t)=>new D(e,t)},8764:(e,t,n)=>{"use strict";const r=n(9742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|y(e,t);let r=s(n);const i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?s(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return $(e).length;default:if(i)return r?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return x(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;os&&(n=s-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function x(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){const t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function I(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function B(e,t,n,r,i){W(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function M(e,t,n,r,i){W(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function z(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||C(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||C(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||C(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||C(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=X((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=X((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i>>=0,!r){const r=Math.pow(2,8*n-1);N(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=X((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=X((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=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),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function W(e,t,n,r,i,o){if(e>n||e3?0===t||t===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}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||q(t,e.length-(n+1))}(r,i,o)}function H(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function q(e,t,n){if(Math.floor(e)!==e)throw H(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=F(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=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((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function $(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},1924:(e,t,n)=>{"use strict";var r=n(210),i=n(5559),o=i(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"==typeof n&&o(e,".prototype.")>-1?i(n):n}},5559:(e,t,n)=>{"use strict";var r=n(8612),i=n(210),o=n(7771),a=n(4453),s=i("%Function.prototype.apply%"),c=i("%Function.prototype.call%"),u=i("%Reflect.apply%",!0)||r.call(c,s),l=n(4429),d=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=u(r,c,arguments);return o(t,1+d(0,e.length-(arguments.length-1)),!0)};var f=function(){return u(r,s,arguments)};l?l(e.exports,"apply",{value:f}):e.exports.apply=f},3204:e=>{"use strict";const t=/[\p{Lu}]/u,n=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,i=/([\p{Alpha}\p{N}_]|$)/u,o=/[_.\- ]+/,a=new RegExp("^"+o.source),s=new RegExp(o.source+i.source,"gu"),c=new RegExp("\\d+"+i.source,"gu"),u=(e,i)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(i={pascalCase:!1,preserveConsecutiveUppercase:!1,...i},0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";const o=!1===i.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(i.locale),u=!1===i.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(i.locale);return 1===e.length?i.pascalCase?u(e):o(e):(e!==o(e)&&(e=((e,r,i)=>{let o=!1,a=!1,s=!1;for(let c=0;c(r.lastIndex=0,e.replace(r,(e=>t(e)))))(e,o):o(e),i.pascalCase&&(e=u(e.charAt(0))+e.slice(1)),((e,t)=>(s.lastIndex=0,c.lastIndex=0,e.replace(s,((e,n)=>t(n))).replace(c,(e=>t(e)))))(e,u))};e.exports=u,e.exports.default=u},8306:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".GamePlayer{flex-direction:row;flex-grow:1;color:#fff;border:2px solid rgba(255,255,255,.3)}.GamePlayer>*{font-size:14px}.GamePlayer.P0{background-color:rgba(0,0,255,.3)}.GamePlayer.P1{background-color:rgba(255,0,0,.3)}.GamePlayer>.Description{opacity:.5}",""]);const s=a},5674:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".GameGridCell{position:relative;user-select:none;width:40px;height:40px;border:2px solid rgba(255,255,255,.3)}.GameGridCell.Mini{width:34px;height:34px;border:1px solid rgba(255,255,255,.3)}.GameGridCell>.Type{position:absolute;height:100%;width:100%}.GameGridCell>.Strength{position:absolute;height:100%;width:100%;text-align:center;justify-content:center;font-weight:bold}.GameGridCell>.Strength{font-size:16px}.GameGridCell.Mini>.Strength{font-size:14px}.GameGridCell>.Strength{background-color:rgba(127,127,127,.3)}.GameGridCell.Player0>.Strength{background-color:rgba(0,0,255,.3)}.GameGridCell.Player1>.Strength{background-color:rgba(255,0,0,.3)}.GameGridCell.Owned{cursor:pointer}.GameGridCell.Owned:hover{border-color:gray}.GameGridCell.Active{cursor:pointer}.GameGridCell.Active,.GameGridCell.Owned.Active{border-color:#ff0}",""]);const s=a},651:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".GameGridRows>.Row{flex-direction:row;flex-wrap:nowrap}",""]);const s=a},4093:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".MenuBar>.TitleBar{margin-top:0;cursor:pointer;font-size:20px;font-weight:bold;background:linear-gradient(90deg, #8802ff 9.81%, #e101ff 56.17%, #e101ff 93.64%)}.MenuBar>.KeysBar>.Separator{flex-grow:1;margin:0}",""]);const s=a},4721:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".MenuSession{align-items:center}.MenuSession>.Warning{color:#ff9696}",""]);const s=a},8882:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".MenuWalletDisconnected{align-items:center}.MenuWalletDisconnected>.Adapter>.Icon{width:16px}",""]);const s=a},1241:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".PageError{align-items:center}",""]);const s=a},3055:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".PageGameCreate .Logs{align-items:center;background:gray}",""]);const s=a},4460:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".PageGameLobby>.Title{background-color:#000;color:#fff;text-align:center}.PageGameLobby>.Players>.Player{flex-direction:row}.PageGameLobby>.Map{align-items:center}.PageGameLobby>.Map>.Grid{border:1px solid rgba(255,255,255,.3)}",""]);const s=a},5328:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".PageGamePlay .Players{flex-direction:row;border:2px solid rgba(255,255,255,.3)}.PageGamePlay .Players .Player{flex-grow:1}.PageGamePlay .Map{align-items:center}.PageGamePlay .Map .Grid{border:2px solid rgba(255,255,255,.3)}",""]);const s=a},1767:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,".PageHome{align-items:center}",""]);const s=a},4800:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8081),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,'*{box-sizing:border-box;border:0;margin:0;padding:0;display:flex;flex-shrink:1;flex-grow:0;flex-wrap:wrap;flex-direction:column;align-items:stretch;line-height:1.5;font-size:16px;font-family:"Courier New",monospace}html,body,#app{width:100%;height:100%;flex-wrap:nowrap}head{display:none}body{background-color:#000;color:#fff}.Content{align-items:center;justify-content:center;flex-grow:1}.VStack>*{margin:4px 0}.Container,button{padding:4px 8px}.HStack,button{flex-direction:row}.HStack>*,button>*{margin:0 4px}button{cursor:pointer;border-radius:4px}button:active{background-color:gray}button.Soft{background-color:rgba(0,0,0,0);color:#fff;border:2px solid #fff;padding:2px 6px}button.Soft:hover{background-color:rgba(255,255,255,.1)}button.Soft:active{background-color:rgba(255,255,255,.3)}button.Disabled{cursor:not-allowed;pointer-events:none;opacity:.5}.Title{text-align:center;font-weight:bold;word-break:break-word}.Hint{text-align:center;word-break:break-word}',""]);const s=a},3645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=o),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),i&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=i):l[4]="".concat(i)),t.push(l))}},t}},8081:e=>{"use strict";e.exports=function(e){return e[1]}},1227:(e,t,n)=>{var r=n(4155);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(2447)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},2447:(e,t,n)=>{e.exports=function(e){function t(e){let n,i,o,a=null;function s(...e){if(!s.enabled)return;const r=s,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";a++;const o=t.formatters[i];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"use strict";var r=n(4429),i=n(3464),o=n(4453),a=n(7296);e.exports=function(e,t,n){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],d=!!a&&a(e,t);if(r)r(e,t,{configurable:null===u&&d?d.configurable:!u,enumerable:null===s&&d?d.enumerable:!s,value:n,writable:null===c&&d?d.writable:!c});else{if(!l&&(s||c||u))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=n}}},4289:(e,t,n)=>{"use strict";var r=n(2215),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=n(2296),c=n(1044)(),u=function(e,t,n,r){if(t in e)if(!0===r){if(e[t]===n)return}else if("function"!=typeof(i=r)||"[object Function]"!==o.call(i)||!r())return;var i;c?s(e,t,n,!0):s(e,t,n)},l=function(e,t){var n=arguments.length>2?arguments[2]:{},o=r(t);i&&(o=a.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s{"use strict";var r=n(210)("%Object.defineProperty%",!0)||!1;if(r)try{r({},"a",{value:1})}catch(e){r=!1}e.exports=r},3981:e=>{"use strict";e.exports=EvalError},1648:e=>{"use strict";e.exports=Error},4726:e=>{"use strict";e.exports=RangeError},6712:e=>{"use strict";e.exports=ReferenceError},3464:e=>{"use strict";e.exports=SyntaxError},4453:e=>{"use strict";e.exports=TypeError},3915:e=>{"use strict";e.exports=URIError},6729:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i{"use strict";n.r(t),n.d(t,{default:()=>r});const r=n.p+"b3c697a99a499e4eba7a036043d2a351.png"},9114:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r=n.p+"eef947257013ce255a5e3b3ab8f1e369.png"},8632:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r=n.p+"f21c57ef8aa99b6970cd87523b7188c6.png"},8949:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r=n.p+"c1d85c9403ce3c25ab0849232426e053.png"},4029:(e,t,n)=>{"use strict";var r=n(5320),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var a;arguments.length>=3&&(a=n),"[object Array]"===i.call(e)?function(e,t,n){for(var r=0,i=e.length;r{"use strict";var t=Object.prototype.toString,n=Math.max,r=function(e,t){for(var n=[],r=0;r{"use strict";var r=n(7648);e.exports=Function.prototype.bind||r},210:(e,t,n)=>{"use strict";var r,i=n(1648),o=n(3981),a=n(4726),s=n(6712),c=n(3464),u=n(4453),l=n(3915),d=Function,f=function(e){try{return d('"use strict"; return ('+e+").constructor;")()}catch(e){}},h=Object.getOwnPropertyDescriptor;if(h)try{h({},"")}catch(e){h=null}var p=function(){throw new u},y=h?function(){try{return p}catch(e){try{return h(arguments,"callee").get}catch(e){return p}}}():p,m=n(1405)(),g=n(8185)(),b=Object.getPrototypeOf||(g?function(e){return e.__proto__}:null),v={},w="undefined"!=typeof Uint8Array&&b?b(Uint8Array):r,_={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":m&&b?b([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":v,"%AsyncGenerator%":v,"%AsyncGeneratorFunction%":v,"%AsyncIteratorPrototype%":v,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?r:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":d,"%GeneratorFunction%":v,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&b?b(b([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&m&&b?b((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":a,"%ReferenceError%":s,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&m&&b?b((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&b?b(""[Symbol.iterator]()):r,"%Symbol%":m?Symbol:r,"%SyntaxError%":c,"%ThrowTypeError%":y,"%TypedArray%":w,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":l,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(b)try{null.error}catch(e){var E=b(b(e));_["%Error.prototype%"]=E}var S=function e(t){var n;if("%AsyncFunction%"===t)n=f("async function () {}");else if("%GeneratorFunction%"===t)n=f("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=f("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&b&&(n=b(i.prototype))}return _[t]=n,n},A={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},k=n(8612),x=n(8824),O=k.call(Function.call,Array.prototype.concat),I=k.call(Function.apply,Array.prototype.splice),R=k.call(Function.call,String.prototype.replace),T=k.call(Function.call,String.prototype.slice),P=k.call(Function.call,RegExp.prototype.exec),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,N=/\\(\\)?/g,B=function(e,t){var n,r=e;if(x(A,r)&&(r="%"+(n=A[r])[0]+"%"),x(_,r)){var i=_[r];if(i===v&&(i=S(r)),void 0===i&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:i}}throw new c("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===P(/^%?[^%]*%?$/,e))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(e){var t=T(e,0,1),n=T(e,-1);if("%"===t&&"%"!==n)throw new c("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new c("invalid intrinsic syntax, expected opening `%`");var r=[];return R(e,C,(function(e,t,n,i){r[r.length]=n?R(i,N,"$1"):t||e})),r}(e),r=n.length>0?n[0]:"",i=B("%"+r+"%",t),o=i.name,a=i.value,s=!1,l=i.alias;l&&(r=l[0],I(n,O([0,1],l)));for(var d=1,f=!0;d=n.length){var g=h(a,p);a=(f=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[p]}else f=x(a,p),a=a[p];f&&!s&&(_[o]=a)}}return a}},7296:(e,t,n)=>{"use strict";var r=n(210)("%Object.getOwnPropertyDescriptor%",!0);if(r)try{r([],"length")}catch(e){r=null}e.exports=r},1044:(e,t,n)=>{"use strict";var r=n(4429),i=function(){return!!r};i.hasArrayLengthDefineBug=function(){if(!r)return null;try{return 1!==r([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},8185:e=>{"use strict";var t={__proto__:null,foo:{}},n=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof n)}},1405:(e,t,n)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,i=n(5419);e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&i()}},5419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},6410:(e,t,n)=>{"use strict";var r=n(5419);e.exports=function(){return r()&&!!Symbol.toStringTag}},8824:(e,t,n)=>{"use strict";var r=Function.prototype.call,i=Object.prototype.hasOwnProperty,o=n(8612);e.exports=o.call(r,i)},645:(e,t)=>{t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,c=(1<>1,l=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=u}return(h?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,c,u=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*y}},5717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},2584:(e,t,n)=>{"use strict";var r=n(6410)(),i=n(1924)("Object.prototype.toString"),o=function(e){return!(r&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},a=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,e.exports=s?o:a},5320:e=>{"use strict";var t,n,r=Function.prototype.toString,i="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof i&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw n}}),n={},i((function(){throw 42}),null,t)}catch(e){e!==n&&(i=null)}else i=null;var o=/^\s*class\b/,a=function(e){try{var t=r.call(e);return o.test(t)}catch(e){return!1}},s=function(e){try{return!a(e)&&(r.call(e),!0)}catch(e){return!1}},c=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),d=function(){return!1};if("object"==typeof document){var f=document.all;c.call(f)===c.call(document.all)&&(d=function(e){if((l||!e)&&(void 0===e||"object"==typeof e))try{var t=c.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=i?function(e){if(d(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{i(e,null,t)}catch(e){if(e!==n)return!1}return!a(e)&&s(e)}:function(e){if(d(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(u)return s(e);if(a(e))return!1;var t=c.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&s(e)}},8662:(e,t,n)=>{"use strict";var r,i=Object.prototype.toString,o=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=n(6410)(),c=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(a.test(o.call(e)))return!0;if(!s)return"[object GeneratorFunction]"===i.call(e);if(!c)return!1;if(void 0===r){var t=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(e){}}();r=!!t&&c(t)}return c(e)===r}},8611:e=>{"use strict";e.exports=function(e){return e!=e}},360:(e,t,n)=>{"use strict";var r=n(5559),i=n(4289),o=n(8611),a=n(9415),s=n(3194),c=r(a(),Number);i(c,{getPolyfill:a,implementation:o,shim:s}),e.exports=c},9415:(e,t,n)=>{"use strict";var r=n(8611);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:r}},3194:(e,t,n)=>{"use strict";var r=n(4289),i=n(9415);e.exports=function(){var e=i();return r(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},5692:(e,t,n)=>{"use strict";var r=n(6430);e.exports=function(e){return!!r(e)}},1198:(e,t,n)=>{"use strict";const r=n(4608).v4,i=n(7741),o=function(e,t){if(!(this instanceof o))return new o(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return r()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};e.exports=o,o.prototype.request=function(e,t,n,r){const o=this;let a=null;const s=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&s)throw new TypeError("JSON-RPC 1.0 does not support batching");if(s||!s&&e&&"object"==typeof e&&"function"==typeof t)r=t,a=e;else{"function"==typeof n&&(r=n,n=void 0);const o="function"==typeof r;try{a=i(e,t,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(o)return r(e);throw e}if(!o)return a}let c;try{c=JSON.stringify(a,this.options.replacer)}catch(e){return r(e)}return this.callServer(c,(function(e,t){o._parseResponse(e,t,r)})),a},o.prototype._parseResponse=function(e,t,n){if(e)return void n(e);if(!t)return n();let r;try{r=JSON.parse(t,this.options.reviver)}catch(e){return n(e)}if(3===n.length){if(Array.isArray(r)){const e=function(e){return void 0!==e.error},t=function(t){return!e(t)};return n(null,r.filter(e),r.filter(t))}return n(null,r.error,r.result)}n(null,r)}},7741:(e,t,n)=>{"use strict";const r=n(4608).v4;e.exports=function(e,t,n,i){if("string"!=typeof e)throw new TypeError(e+" 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 a={method:e};if(2===o&&(a.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");a.params=t}if(void 0===n){const e="function"==typeof i.generator?i.generator:function(){return r()};a.id=e(a,i)}else 2===o&&null===n?i.notificationIdNull&&(a.id=null):a.id=n;return a}},7824:e=>{var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,s){s=s||{};var c,u,l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(a){var s=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return s*o;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*r;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===l&&isFinite(e))return s.long?(c=e,(u=Math.abs(c))>=i?a(c,u,i,"day"):u>=r?a(c,u,r,"hour"):u>=n?a(c,u,n,"minute"):u>=t?a(c,u,t,"second"):c+" ms"):function(e){var o=Math.abs(e);return o>=i?Math.round(e/i)+"d":o>=r?Math.round(e/r)+"h":o>=n?Math.round(e/n)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},4244:e=>{"use strict";var t=function(e){return e!=e};e.exports=function(e,n){return 0===e&&0===n?1/e==1/n:e===n||!(!t(e)||!t(n))}},609:(e,t,n)=>{"use strict";var r=n(4289),i=n(5559),o=n(4244),a=n(5624),s=n(2281),c=i(a(),Object);r(c,{getPolyfill:a,implementation:o,shim:s}),e.exports=c},5624:(e,t,n)=>{"use strict";var r=n(4244);e.exports=function(){return"function"==typeof Object.is?Object.is:r}},2281:(e,t,n)=>{"use strict";var r=n(5624),i=n(4289);e.exports=function(){var e=r();return i(Object,{is:e},{is:function(){return Object.is!==e}}),e}},8987:(e,t,n)=>{"use strict";var r;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=n(1414),s=Object.prototype.propertyIsEnumerable,c=!s.call({toString:null},"toString"),u=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(e){var t=e.constructor;return t&&t.prototype===e},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!f["$"+e]&&i.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{d(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();r=function(e){var t=null!==e&&"object"==typeof e,n="[object Function]"===o.call(e),r=a(e),s=t&&"[object String]"===o.call(e),f=[];if(!t&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var p=u&&n;if(s&&e.length>0&&!i.call(e,0))for(var y=0;y0)for(var m=0;m{"use strict";var r=Array.prototype.slice,i=n(1414),o=Object.keys,a=o?function(e){return o(e)}:n(8987),s=Object.keys;a.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return i(e)?s(r.call(e)):s(e)})}else Object.keys=a;return Object.keys||a},e.exports=a},1414:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var n=t.call(e),r="[object Arguments]"===n;return r||(r="[object Array]"!==n&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),r}},2837:(e,t,n)=>{"use strict";var r=n(2215),i=n(5419)(),o=n(1924),a=Object,s=o("Array.prototype.push"),c=o("Object.prototype.propertyIsEnumerable"),u=i?Object.getOwnPropertySymbols:null;e.exports=function(e,t){if(null==e)throw new TypeError("target must be an object");var n=a(e);if(1===arguments.length)return n;for(var o=1;o{"use strict";var r=n(2837);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),n={},r=0;r{"use strict";e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},4155:e=>{var t,n,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,c=[],u=!1,l=-1;function d(){u&&s&&(u=!1,s.length?c=s.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=a(d);u=!0;for(var t=c.length;t;){for(s=c,c=[];++l1)for(var n=1;n{"use strict";var r=n(7294),i=n(3840);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n